pisper 0.6.23 → 0.6.24

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 (123) hide show
  1. package/package.json +6 -6
  2. package/web/.vite/manifest.json +590 -561
  3. package/web/assets/{AppDialog-_fH6eQpb.js → AppDialog-BcXOXBcR.js} +1 -1
  4. package/web/assets/{AppOverlays-BMST1vfu.js → AppOverlays-DhOsSE6q.js} +1 -1
  5. package/web/assets/{AssetsPage-CDJmOEP7.js → AssetsPage-7Fuwati9.js} +1 -1
  6. package/web/assets/{BoardPage-CJT8VYBj.js → BoardPage-C81aOK4p.js} +3 -3
  7. package/web/assets/{ChannelsPage-l3o-utCr.js → ChannelsPage-LM4bpKzy.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-CdJHIq2M.js → ChatAppearancePage-DQr-uhHb.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-7EAqApuM.js → ChatHistoryPage-DcjG1hoQ.js} +1 -1
  10. package/web/assets/ChatPage-HBq1cr2I.js +553 -0
  11. package/web/assets/{ConfigPage-Qd6FIlD6.js → ConfigPage-Bcjc5mbO.js} +4 -4
  12. package/web/assets/{DesktopWindowControls-X6khTXXD.js → DesktopWindowControls-BWe5YIjj.js} +1 -1
  13. package/web/assets/{FeaturePage-CgoODqI_.js → FeaturePage-DGauTCbU.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-WMfxb0MX.js → FileAttachmentPreview-IZzA3f8k.js} +1 -1
  15. package/web/assets/{FloatingWidgets-CtU5t-r2.js → FloatingWidgets-DgIJkrEC.js} +1 -1
  16. package/web/assets/FocusRuntimeControls-Bgq7LvMl.js +1 -0
  17. package/web/assets/{GitDiffViewer-AcMle1-H.js → GitDiffViewer-CypHOHdP.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-jq84FKmf.js → ManageProjectsDialog-DxiTEqYf.js} +1 -1
  19. package/web/assets/{MarkdownMessage-BDrWMmiv.js → MarkdownMessage-CuaozZah.js} +1 -1
  20. package/web/assets/{McpPage-Dyz-7b-d.js → McpPage-BbmxMKuy.js} +1 -1
  21. package/web/assets/{MemoryPage-CG-PNmFi.js → MemoryPage-BeI2YTUn.js} +1 -1
  22. package/web/assets/{MobileNavigation-oAbj8oEW.js → MobileNavigation-IZrksubf.js} +1 -1
  23. package/web/assets/{MorePage-7NckHj2X.js → MorePage-DObfXE0e.js} +1 -1
  24. package/web/assets/{NewFolderDialog-CSwYKD8L.js → NewFolderDialog-CeRiD1xe.js} +1 -1
  25. package/web/assets/{PageHeader-BWTQQV6l.js → PageHeader-D8QTuWd6.js} +1 -1
  26. package/web/assets/{PhoneDrawer-CRjYXK4U.js → PhoneDrawer-Dfmmixh5.js} +1 -1
  27. package/web/assets/{PhoneMenuButton-YyU4CxN-.js → PhoneMenuButton-Bbna_Bcf.js} +1 -1
  28. package/web/assets/{PhoneTopBar-fFBj5SYy.js → PhoneTopBar-Dz94PR8O.js} +1 -1
  29. package/web/assets/{PluginsPage-TtUACDkO.js → PluginsPage-0rmSVMfr.js} +1 -1
  30. package/web/assets/{SafeModePrompt-BdJZpk9Z.js → SafeModePrompt-CAfT8lBS.js} +1 -1
  31. package/web/assets/{SchedulesPage-CEont77M.js → SchedulesPage-C3TpSm9t.js} +1 -1
  32. package/web/assets/SessionBrowserPane-DMTNqq-e.js +2 -0
  33. package/web/assets/{SessionContextPanel-UpOQ6Tf5.js → SessionContextPanel-DoS-Xqny.js} +2 -2
  34. package/web/assets/{SessionHome-ByCLax94.js → SessionHome-047YRkeb.js} +1 -1
  35. package/web/assets/SessionInspector-GXGZ9n87.js +1 -0
  36. package/web/assets/{SessionShell-DzcjZ9sC.js → SessionShell-BqNSjTbQ.js} +1 -1
  37. package/web/assets/{SettingsSidebar-BnzGBl2P.js → SettingsSidebar-a9IEYCfr.js} +1 -1
  38. package/web/assets/{ShortcutHelpDialog-6xpCSBSl.js → ShortcutHelpDialog-B1RT_EMe.js} +1 -1
  39. package/web/assets/{ShortcutKeys-wE65pcQn.js → ShortcutKeys-DIEI9JQZ.js} +1 -1
  40. package/web/assets/{SidebarUpdateStatus-1ObaQPYU.js → SidebarUpdateStatus-phIx4K_T.js} +1 -1
  41. package/web/assets/{SkillsPage-DCqMIsRZ.js → SkillsPage-CZuR-0QX.js} +1 -1
  42. package/web/assets/{TaskProcessesPane-B4o1GC7K.js → TaskProcessesPane-x73TNzuV.js} +1 -1
  43. package/web/assets/{TaskTerminalView-DxVr8Wtj.js → TaskTerminalView-D2UVtmT1.js} +1 -1
  44. package/web/assets/{TerminalPanel-lHTUD4Da.js → TerminalPanel-C0U35k57.js} +1 -1
  45. package/web/assets/{WebDesktopPet-KS-ffs_Y.js → WebDesktopPet-CJtB44aG.js} +1 -1
  46. package/web/assets/WorkflowsPage-o4p12fMI.js +1 -0
  47. package/web/assets/{WorkspacePicker-BdQxcQ7F.js → WorkspacePicker-C7hhcfZV.js} +1 -1
  48. package/web/assets/{api-CWaE7hay.js → api-BmSvZCuH.js} +1 -1
  49. package/web/assets/{app-update-BhZYouFz.js → app-update-DhpOY37a.js} +1 -1
  50. package/web/assets/{approval-confirm-hgX2Qj5h.js → approval-confirm-Dc3BZGo4.js} +1 -1
  51. package/web/assets/board-messages-BptuVfY-.js +1 -0
  52. package/web/assets/{board-projects-Br5xIhXi.js → board-projects-C7DazgZG.js} +1 -1
  53. package/web/assets/{bots-store-BxXimpjG.js → bots-store-CeTfxdyY.js} +1 -1
  54. package/web/assets/{chat-api-DIe7JvSq.js → chat-api-DHqVwcpJ.js} +1 -1
  55. package/web/assets/{client-store-BVvrKxe7.js → client-store-Dif482Kx.js} +1 -1
  56. package/web/assets/{config-search-BS9VXlM0.js → config-search-CKpXm_hp.js} +1 -1
  57. package/web/assets/{dialog-VGmRGR6P.js → dialog-DFcH7POi.js} +1 -1
  58. package/web/assets/{events-CAk4qwf5.js → events-C7sXXop4.js} +1 -1
  59. package/web/assets/focus-session-composer-bits-D2XiGLcj.js +1 -0
  60. package/web/assets/{folder-paths-9JtGeIlu.js → folder-paths-CsQLylLL.js} +1 -1
  61. package/web/assets/{hosts-Cc6SO6LM.js → hosts-CwTc21QE.js} +1 -1
  62. package/web/assets/i18n-YQ8mc9k7.js +1 -0
  63. package/web/assets/{index-dYNkGdsI.css → index-DJA4qaOu.css} +1 -1
  64. package/web/assets/{index-BEFqinGB.js → index-DjSjahBi.js} +2 -2
  65. package/web/assets/mount-app-DAxz1ll-.js +9 -0
  66. package/web/assets/pause-CYWpPg1R.js +1 -0
  67. package/web/assets/permission-rules-api-D1Tbe4E9.js +1 -0
  68. package/web/assets/{pick-system-directory-BEo0M2BR.js → pick-system-directory-CQS5pqM-.js} +1 -1
  69. package/web/assets/placements-BuU0Zuqy.js +2 -0
  70. package/web/assets/{popover-CyHncZuo.js → popover-CXB2yzW6.js} +1 -1
  71. package/web/assets/{public-BLPYRVOl.js → public-BVKkvQiF.js} +2 -2
  72. package/web/assets/{public-BxfK5CJX.js → public-BVuJa7Dh.js} +1 -1
  73. package/web/assets/public-D1nVPEiV.js +1 -0
  74. package/web/assets/{public-components--elKl8rY.js → public-components-B6uxO_ZB.js} +1 -1
  75. package/web/assets/public-diff-CCVYk91T.js +1 -0
  76. package/web/assets/public-events-CVn8fEHx.js +1 -0
  77. package/web/assets/{public-flags-bV1lnTa9.js → public-flags-KylDNCsK.js} +1 -1
  78. package/web/assets/{public-session-71n0uBba.js → public-session-DjI86F5J.js} +1 -1
  79. package/web/assets/{public-sidebar-COsk0-e3.js → public-sidebar-PhHPuas_.js} +1 -1
  80. package/web/assets/{runtime-capabilities-store-DIlItxug.js → runtime-capabilities-store-CTtXyNjK.js} +1 -1
  81. package/web/assets/{safe-mode-instance-B4YViTAj.js → safe-mode-instance-_WZgKT1M.js} +1 -1
  82. package/web/assets/safe-mode-sentinel-CVhmZl77.js +1 -0
  83. package/web/assets/{session-change-summary-api-Dvl_So5i.js → session-change-summary-api-DENj-A9c.js} +1 -1
  84. package/web/assets/{session-home-CpduZY-Y.js → session-home-D1MkpdBS.js} +1 -1
  85. package/web/assets/{session-organization-api-C3f-pQuJ.js → session-organization-api-Cm9HoIme.js} +1 -1
  86. package/web/assets/{session-scope-9NO78BDR.js → session-scope-BnKeB5vZ.js} +1 -1
  87. package/web/assets/{session-tree-actions-Ch4rkxjV.js → session-tree-actions-DhF8lJLn.js} +1 -1
  88. package/web/assets/{session-tree-summary-DXft8Rmr.js → session-tree-summary-DEJ52bdp.js} +1 -1
  89. package/web/assets/{shortcuts-BtoPU0le.js → shortcuts-DnykOp5e.js} +1 -1
  90. package/web/assets/{side-chat-context-D7xA1822.js → side-chat-context-C2SzUmd5.js} +4 -4
  91. package/web/assets/{sidebar-CG-HyJsS.js → sidebar-bemTfe07.js} +1 -1
  92. package/web/assets/{sidebar-store-C9Pot2yY.js → sidebar-store-Be8dU3KV.js} +1 -1
  93. package/web/assets/{speech-session-TxJG88R-.js → speech-session-4UWWW7HR.js} +1 -1
  94. package/web/assets/{startup-queries-VYxaEx9w.js → startup-queries-iq2o5pqJ.js} +1 -1
  95. package/web/assets/{use-i18n-D2lZDIiK.js → use-i18n-DCxQRXLH.js} +1 -1
  96. package/web/assets/{use-open-bot-CFe4Kt8r.js → use-open-bot-BTTe7141.js} +1 -1
  97. package/web/assets/{use-studio-actions-CfZNLW6c.js → use-studio-actions-CvTVL6vy.js} +1 -1
  98. package/web/assets/{useCatalogProjects-CGj_Phaf.js → useCatalogProjects-D0_Xilel.js} +1 -1
  99. package/web/assets/useNewProjectPicker-C3dVgDqI.js +2 -0
  100. package/web/assets/{useNow-CtiiZXYi.js → useNow-BrhALV5l.js} +1 -1
  101. package/web/assets/{usePhoneShell-CnoUyYeJ.js → usePhoneShell-BleJZMk4.js} +1 -1
  102. package/web/assets/{useSessionListQuery-BeFsCihm.js → useSessionListQuery-CSTrzBD6.js} +1 -1
  103. package/web/assets/{useSessionRowActions-Cv7ZLvGZ.js → useSessionRowActions-CBOzJhLW.js} +1 -1
  104. package/web/assets/{useSidebarModel-BFDzcvAc.js → useSidebarModel-AYsswvjm.js} +1 -1
  105. package/web/assets/{web-preview-BvYYjssc.js → web-preview-B9ooQu6f.js} +1 -1
  106. package/web/assets/{web-preview-events-DREck2MQ.js → web-preview-events-DZb37WWK.js} +1 -1
  107. package/web/assets/{workspace-order-store-BDSlzOUk.js → workspace-order-store-CQ4SHO-9.js} +1 -1
  108. package/web/index.html +2 -2
  109. package/web/assets/ChatPage-DPnOu_7p.js +0 -553
  110. package/web/assets/FocusRuntimeControls-DSAsb9Mz.js +0 -1
  111. package/web/assets/SessionBrowserPane-C41VsVCn.js +0 -2
  112. package/web/assets/SessionInspector-BQ-ZzmN8.js +0 -1
  113. package/web/assets/WorkflowsPage-BiWUVESO.js +0 -1
  114. package/web/assets/board-messages-DRw0EP3S.js +0 -1
  115. package/web/assets/i18n-BkTAd6ln.js +0 -1
  116. package/web/assets/mount-app-Z24rEaKY.js +0 -9
  117. package/web/assets/permission-rules-api-C_to5cI_.js +0 -1
  118. package/web/assets/placements-41bRhaLX.js +0 -2
  119. package/web/assets/public-Dxz02eyM.js +0 -1
  120. package/web/assets/public-diff-DuYNyToX.js +0 -1
  121. package/web/assets/public-events-CVwkgTyV.js +0 -1
  122. package/web/assets/safe-mode-sentinel-BOIlJBCx.js +0 -1
  123. package/web/assets/useNewProjectPicker-pn-RD8BP.js +0 -2
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,n,r}from"./vendor-react-DwNgTV1j.js";import{d as i,u as a}from"./i18n-BkTAd6ln.js";import{t as o}from"./use-i18n-D2lZDIiK.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./arrow-up-DST6-qVQ.js";import{t as l}from"./braces-DQcXLGFF.js";import{t as u}from"./check-2vYc6QaP.js";import{t as d}from"./chevron-right-C3t2Rckj.js";import{r as f}from"./dist-V8chnW6-.js";import{t as p}from"./pencil-U08v_vV9.js";import{t as m}from"./refresh-cw-TbWxTY4K.js";import{t as h}from"./search-D0mqDaf_.js";import{t as g}from"./square-bHHVTT3G.js";import{t as _}from"./wrench-6pg6_bqI.js";import{t as v}from"./x-07u4-129.js";import{i as y,t as b}from"./dist-41X0pdUs.js";import{c as x,n as S}from"./dist-BsRXXcSL.js";import{a as C,o as w,r as T,t as E}from"./dist-BHkR6BLP.js";import{i as D,n as O,t as k}from"./popover-CyHncZuo.js";import{t as A}from"./slider-DTmAZl-R.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as M}from"./button-CCcCN8tE.js";import{t as N}from"./kbd-CAufZTkl.js";import{s as P}from"./shortcuts-BtoPU0le.js";import{n as F,o as ee,r as te,t as ne}from"./sheet-BTaIEX4w.js";import{r as I}from"./format-DMJQzoZ7.js";import{t as re}from"./StatusGlyph-1KgitlUg.js";import{i as ie,s as ae}from"./run-activity-CwfO0cui.js";import"./dialog-VGmRGR6P.js";import{n as oe,t as se}from"./input-group-h8z63MzW.js";import{t as ce}from"./model-display-kDwvtxrW.js";var le=s(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ue=s(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),de=s(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),L=e(t(),1);function fe(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function R(e,t,n,r){return n.length?[{invocation:`/${e}`,description:t},...n.map(t=>({invocation:`/${e} ${t.value}`,description:t.label,current:t.current,run:()=>r(t.value)}))]:[]}function pe({t:e,models:t,model:n,onModel:r,thinkingLevels:i,thinkingLevel:a,thinkingLabel:o,onThinking:s,executionModes:c,executionMode:l,executionLabel:u,onExecutionMode:d,runModes:f,runMode:p,runModeLabel:m,onRunMode:h}){return[...R(`model`,e(`chat:commands.builtin.model`),t.map(e=>({value:e.key,label:e.providerName?`${e.label} · ${e.providerName}`:e.label,current:e.key===n})),r),...R(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...R(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?R(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:m(e),current:e===p})),h):[]]}function me(e,t,n){let r=e=>e.toLocaleLowerCase(n),i=r(t),a=i.search(/\s/);if(a<0)return e.filter(e=>!e.invocation.includes(` `)&&r(`${e.invocation} ${e.description}`).includes(i));let o=`/${i.slice(0,a)} `,s=i.slice(a).trim();return e.filter(e=>r(e.invocation).startsWith(o)&&r(`${e.invocation} ${e.description}`).includes(s))}var he=10485760,ge=20971520,_e=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),ve=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),ye=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),be=[`image/*`,`text/*`,`application/json`,...[...ve,..._e,...ye].map(e=>`.${e}`)].join(`,`);function xe(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function Se(e){return[...e?.types||[]].includes(`Files`)}function Ce(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(String(i.result).split(`,`)[1]||``),i.onerror=()=>r(i.error||Error(t(`chat:attachments.couldNotReadFile`))),i.readAsDataURL(e)})}function we(e){return e.toLowerCase().split(`.`).at(-1)||``}async function Te(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>he)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=we(e.name),i={id:`${e.name}-${e.lastModified}-${e.size}`,name:e.name,mimeType:e.type||`application/octet-stream`,size:e.size};if(e.type.startsWith(`image/`)||ve.has(n))r.push({...i,kind:`image`,data:await Ce(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||_e.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(ye.has(n))r.push({...i,kind:`document`,extension:n,data:await Ce(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function Ee(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function De(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:Ee(e),path:e}))}function Oe(e=[],t,n){let r=(0,L.useCallback)((e,t)=>i(e,a(),t),[]),[o,s]=(0,L.useState)(()=>[...e]),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)([]),f=(0,L.useRef)(new Map),p=(0,L.useRef)(0),m=(0,L.useRef)(n);m.current=n,(0,L.useEffect)(()=>{let e=f.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let h=(0,L.useRef)([...e]),g=(0,L.useCallback)(e=>{h.current=e,s(e),t?.(e)},[t]),_=(0,L.useCallback)(async e=>{let t=n,i=[...e||[]].slice(0,8).map(e=>{let t=`preparing-${++p.current}`,n={name:e.name,cancelled:!1};return f.current.set(t,n),{id:t,job:n,file:e}}),a=()=>d([...f.current].map(([e,t])=>({id:e,name:t.name})));a(),l(``);let o=!1;for(let{id:e,job:n,file:s}of i)try{let i=await Te([s],r);if(n.cancelled||m.current!==t||!f.current.has(e))continue;let a=[...h.current,...i].slice(0,8);if(a.filter(e=>e.kind!==`path`).reduce((e,t)=>e+(t.size||0),0)>ge)throw Error(r(`chat:attachments.totalAttachmentSizeCannotExceed20MB`));g(a),o=!0}catch(e){!n.cancelled&&m.current===t&&l(e instanceof Error?e.message:String(e))}finally{f.current.delete(e),m.current===t&&a()}return o},[n,g,r]);return{attachments:o,attachmentError:c,preparingAttachments:u,addFiles:_,pasteFiles:(0,L.useCallback)(e=>{let t=xe(e.clipboardData);t.length&&(e.preventDefault(),_(t))},[_]),dropFiles:(0,L.useCallback)(e=>{if(!Se(e.dataTransfer))return;e.preventDefault();let t=xe(e.dataTransfer);t.length&&_(t)},[_]),removeAttachment:(0,L.useCallback)(e=>{let t=f.current.get(e);if(t){t.cancelled=!0,f.current.delete(e),d([...f.current].map(([e,t])=>({id:e,name:t.name})));return}g(h.current.filter(t=>t.id!==e))},[g]),clearAttachments:(0,L.useCallback)(()=>{for(let e of f.current.values())e.cancelled=!0;f.current.clear(),d([]),g([])},[g]),addAttachments:(0,L.useCallback)(e=>{if(m.current!==n)return;l(``);let t=[...h.current];for(let n of e)t.some(e=>e.id===n.id)||t.push(n);g(t.slice(0,8))},[n,g]),replaceAttachments:g,setError:(0,L.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var ke=`new-task`,z=new Map,B=new Map;function Ae(e,t){let n=t.match(/^\/[^\s]*(?:\s+([\s\S]*))?$/),r=(n?n[1]||``:t).trim();return`${e}${r?` ${r}`:` `}`}function je(e){return{text:e?.text||``,attachments:[...e?.attachments||[]]}}function V(e){return je(z.get(e))}function H(e,t){if(!e)return;let n={...V(e),...t};n.attachments=[...n.attachments];let r=V(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&B.set(e,(B.get(e)||0)+1),z.delete(e),!(!n.text&&!n.attachments.length)&&z.set(e,n))}function Me(e){B.set(e,(B.get(e)||0)+1),z.delete(e)}function Ne(e,t){let n=[...e.attachments],r=new Set(n.map(e=>e.id));for(let e of t.attachments){let t=e.id;if(!t||r.has(t)){let n=1;do t=`${e.id||`attachment`}-restored-${n++}`;while(r.has(t))}r.add(t),n.push({...e,id:t})}return{text:e.text&&t.text?`${e.text}\n${t.text}`:e.text||t.text,attachments:n}}function Pe(e){let t=(0,L.useRef)(e);t.current=e;let n=(0,L.useRef)(!0);(0,L.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,L.useRef)(V(e)),[i,a]=(0,L.useState)(r.current.text),o=(0,L.useCallback)(t=>H(e,{attachments:t}),[e]),s=Oe(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,L.useEffect)(()=>{let t=V(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,L.useCallback)(t=>{a(t),H(e,{text:t})},[e]),selection:s,clearDraft:(0,L.useCallback)(()=>{let r=V(e);r.text!==i||r.attachments.length!==s.attachments.length||r.attachments.some((e,t)=>e!==s.attachments[t])||(Me(e),!(!n.current||t.current!==e)&&(a(``),l()))},[l,s.attachments,e,i]),restoreDraft:(0,L.useCallback)(r=>{let i=Ne(V(e),r);return H(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,L.useCallback)(()=>{let r=V(e),i=B.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=V(e),l={text:(B.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};H(e,l),!(!n.current||t.current!==e)&&(a(l.text),c(l.attachments))}}},[c,e])}}var Fe=e(n(),1);function Ie({anchor:e,menu:t,viewport:n,placement:r=`top`,align:i=`start`,maxHeight:a=1/0}){let o=n.top+8,s=Math.max(o,n.top+n.height-8),c=n.left+8,l=Math.max(c,n.left+n.width-8),u={top:Math.max(0,Math.min(e.top,s)-o-8),bottom:Math.max(0,s-Math.max(e.bottom,o)-8)},d=Math.min(t.height,a),f=r===`top`?`bottom`:`top`,p=d>u[r]&&u[f]>u[r]?f:r,m=Math.min(a,u[p]),h=Math.min(d,m),g=Math.min(t.width,l-c);return{side:p,left:Math.max(c,Math.min(i===`end`?e.right-g:e.left,l-g)),top:Math.max(o,Math.min(p===`top`?e.top-8-h:e.bottom+8,s-h)),width:g,maxHeight:m}}var U=r();function Le({open:e,anchorRef:t,menuRef:n,placement:r=`top`,align:i=`start`,matchAnchorWidth:a=!1,maxHeight:o,id:s,className:c,role:l,ariaLabel:u,onClose:d,children:f}){return(0,L.useEffect)(()=>{if(!e||!d)return;let t=e=>{e.key===`Escape`&&(e.stopPropagation(),d())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,d]),(0,L.useLayoutEffect)(()=>{if(!e)return;let s=()=>{let e=n.current,s=t.current;if(!e||!s)return;let c=s.getBoundingClientRect(),l=window.visualViewport;e.style.width=a?`${c.width}px`:``;let u=Ie({anchor:c,menu:{width:e.getBoundingClientRect().width,height:e.scrollHeight},viewport:{left:l?.offsetLeft??0,top:l?.offsetTop??0,width:l?.width??window.innerWidth,height:l?.height??window.innerHeight},placement:r,align:i,maxHeight:o});e.dataset.side=u.side,e.style.maxHeight=`${u.maxHeight}px`,e.style.overflowY=`auto`,e.style.width=`${u.width}px`,e.style.top=`${u.top}px`,e.style.bottom=`auto`,e.style.right=`auto`,e.style.left=`${u.left}px`};s();let c=null,l=()=>{c===null&&(c=window.requestAnimationFrame(()=>{c=null,s()}))},u=typeof ResizeObserver>`u`?null:new ResizeObserver(l);return n.current&&u?.observe(n.current),t.current&&u?.observe(t.current),window.addEventListener(`resize`,s),window.addEventListener(`scroll`,s,!0),window.visualViewport?.addEventListener(`resize`,l),window.visualViewport?.addEventListener(`scroll`,l),()=>{u?.disconnect(),c!==null&&window.cancelAnimationFrame(c),window.removeEventListener(`resize`,s),window.removeEventListener(`scroll`,s,!0),window.visualViewport?.removeEventListener(`resize`,l),window.visualViewport?.removeEventListener(`scroll`,l)}},[e,t,n,r,i,a,o]),e?(0,Fe.createPortal)((0,U.jsx)(`div`,{ref:n,id:s,className:c,style:{position:`fixed`,zIndex:65},role:l,"aria-label":u,children:f}),document.body):null}function Re({resourceKey:e,loadCommands:t,builtinCommands:n=[],value:r,onChange:i,inputRef:a,placement:s=`top`}){let{t:c,language:d}=o(),f=(0,L.useId)(),p=(0,L.useRef)(null),m=r.match(/^\/([^\n]{0,120})$/),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(!1),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(0),T=m?.[1]||``,E=/\s/.test(T),D=(0,L.useRef)(t);D.current=t;let O=(0,L.useMemo)(()=>me(n,T,d),[n,d,T]),k=!!(m&&h!==r&&(!E||O.length));(0,L.useEffect)(()=>{g(``),v(null),S(!1)},[e]),(0,L.useEffect)(()=>{if(!k||_)return;let e=!0;return b(!0),S(!1),D.current().then(t=>{e&&v(t.commands||[])}).catch(()=>{e&&(v([]),S(!0))}).finally(()=>e&&b(!1)),()=>{e=!1}},[_,k,e]);let A=(0,L.useMemo)(()=>{let e=O.map(e=>({kind:`builtin`,command:e}));if(E)return e;let t=T.toLocaleLowerCase(d),n=(_||[]).filter(e=>!t||`${e.invocation} ${e.name} ${e.description}`.toLocaleLowerCase(d).includes(t));return[...e,...n.map(e=>({kind:`resource`,command:e}))]},[E,O,_,d,T]);(0,L.useEffect)(()=>{w(0)},[T,_]);let j=()=>{g(r)},M=e=>{if(e.kind===`builtin`){let t=e.command.run?``:`${e.command.invocation} `;i(t),g(``),w(0),e.command.run&&e.command.run(),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length))});return}let t=Ae(e.command.invocation,r);i(t),g(t),requestAnimationFrame(()=>{let e=a.current;e&&(e.focus(),e.setSelectionRange(t.length,t.length),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)})};(0,L.useEffect)(()=>{if(!k)return;let e=e=>{if(document.activeElement===a.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),j();return}A.length&&(e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),w(e=>(e+1)%A.length)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),w(e=>(e-1+A.length)%A.length)):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),M(A[Math.min(C,A.length-1)])))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}),(0,L.useEffect)(()=>{let e=a.current;if(!k||!e)return;let t={role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":f,"aria-activedescendant":A.length?`${f}-${Math.min(C,A.length-1)}`:``},n=Object.keys(t).map(t=>[t,e.getAttribute(t)]);for(let[n,r]of Object.entries(t))r?e.setAttribute(n,r):e.removeAttribute(n);return()=>{for(let[t,r]of n)t&&(r===null?e.removeAttribute(t):e.setAttribute(t,r))}},[C,a,f,k,A.length]);let N={user:c(`chat:commands.scope.user`),project:c(`chat:commands.scope.project`),package:c(`chat:commands.scope.package`),custom:c(`chat:commands.scope.custom`)};return(0,U.jsx)(Le,{open:k,anchorRef:a,menuRef:p,placement:s,matchAnchorWidth:!0,maxHeight:330,id:f,role:`listbox`,ariaLabel:c(`chat:commands.open`),className:`permission-mode-menu composer-command-menu overflow-y-auto rounded-md bg-solid p-1 text-content shadow-float`,children:(0,U.jsxs)(`div`,{className:`chat-resource-list composer-command-list flex min-h-0 [flex:1_1_0] flex-col gap-px overflow-y-auto [overscroll-behavior:contain] [scrollbar-gutter:stable] [touch-action:pan-y] [&_>_button]:grid [&_>_button]:w-full [&_>_button]:cursor-pointer [&_>_button]:grid-cols-[28px_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-2 [&_>_button]:rounded-sm [&_>_button]:px-1.5 [&_>_button]:py-1 [&_>_button]:text-left [&_>_button]:text-content [&_>_button.active]:bg-surface-hover max-[650px]:[&_>_button]:min-h-11 [&_button_>_span:nth-child(2)]:flex [&_button_>_span:nth-child(2)]:min-w-0 [&_button_>_span:nth-child(2)]:flex-col [&_strong]:truncate [&_strong]:font-mono [&_strong]:text-[13px] [&_strong]:font-medium [&_small]:truncate [&_small]:font-sans [&_small]:text-xs [&_small]:font-normal [&_small]:text-content-muted [&_em]:text-xs [&_em]:whitespace-nowrap [&_em]:text-content-muted [&_em]:not-italic [&_>_p]:m-auto [&_>_p]:px-2 [&_>_p]:py-1.5 [&_>_p]:text-xs [&_>_p]:text-content-muted`,children:[A.map((e,t)=>{let{command:n}=e,r=e.kind===`builtin`?e.command.current?u:de:e.command.source===`prompt`?ue:l,i=e.kind===`resource`?e.command:null;return(0,U.jsxs)(`button`,{type:`button`,role:`option`,id:`${f}-${t}`,"aria-selected":t===C,className:t===C?`active`:``,onMouseEnter:()=>w(t),onMouseDown:e=>e.preventDefault(),onClick:()=>M(e),children:[(0,U.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,U.jsx)(r,{size:15})}),(0,U.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,U.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,U.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,U.jsx)(`small`,{children:n.description||c(`chat:commands.noDescription`)})]}),(0,U.jsx)(`em`,{children:i?(0,U.jsxs)(U.Fragment,{children:[i.source===`prompt`?c(`chat:commands.prompt`):c(`chat:commands.skill`),` · `,N[i.scope]]}):e.kind===`builtin`&&e.command.current?c(`chat:commands.builtin.current`):c(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!A.length&&(0,U.jsx)(`p`,{children:c(y?`chat:commands.loading`:x?`chat:commands.loadError`:`chat:commands.empty`)})]})})}var W=`relative max-[650px]:after:absolute max-[650px]:after:-inset-1`,ze=`inline-flex h-7 min-w-0 shrink cursor-pointer items-center gap-1.5 rounded-sm border border-transparent px-2 text-[13px] text-content-secondary transition-colors hover:bg-surface-hover hover:text-content aria-expanded:bg-surface-hover aria-expanded:text-content max-[650px]:h-9 max-[650px]:rounded-full max-[650px]:bg-surface-muted max-[650px]:dark:bg-surface-active max-[650px]:px-3 max-[650px]:text-content min-[651px]:pointer-coarse:h-11 ${W}`,Be=`grid size-8 min-w-8 flex-none cursor-pointer place-items-center rounded-sm border-0 bg-transparent text-content-muted transition-colors hover:bg-surface-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50 max-[650px]:size-9 max-[650px]:min-w-9 min-[651px]:pointer-coarse:size-11 min-[651px]:pointer-coarse:min-w-11 ${W}`,Ve=`max-[650px]:size-4`;function He(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}function Ue({startedAt:e}){let[t,n]=(0,L.useState)(()=>Date.now());(0,L.useEffect)(()=>{let e=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let r=ae(e,null,t);return r?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-mono text-[12.5px] text-content-muted tabular-nums`,"data-tray-clock":!0,children:He(r)}):null}var We=`flex min-h-[34px] min-w-0 items-center gap-2 pr-1.5 pl-3 text-[13px] max-[650px]:min-h-11 max-[650px]:pr-0 pointer-coarse:min-h-11`,Ge=`grid size-[26px] flex-none cursor-pointer place-items-center rounded-sm text-content-muted opacity-0 transition-opacity duration-(--d-fast) group-hover/queued:opacity-100 group-focus-within/queued:opacity-100 hover:bg-surface-hover hover:text-content focus-visible:opacity-100 disabled:cursor-default disabled:opacity-40 max-[650px]:size-11 max-[650px]:opacity-100 pointer-coarse:size-11 pointer-coarse:opacity-100 [@media(hover:none)]:opacity-100`;function Ke({streaming:e,compaction:t,startedAt:n,stopping:r=!1,onStop:i,queuedInputs:a=[],withdrawingInputIds:s=[],onEdit:c,onCancel:l,onSendNow:u,runRow:d=!0,queueList:f=!0}){let{t:m}=o(),h=!!t?.active,_=!!e&&d||h,y=f?a:[];if(!_&&!y.length)return null;let b=m(`chat:focusSession.sentToTheRunningAgent`);return(0,U.jsxs)(`div`,{className:`composer-tray mx-3.5 flex min-w-0 flex-col overflow-hidden rounded-t-(--r-lg) border border-b-0 border-stroke bg-well text-content-secondary max-[650px]:mx-2 [&>*+*]:border-t [&>*+*]:border-stroke`,"data-composer-tray":!0,children:[_&&(0,U.jsxs)(`div`,{className:We,"data-run-bar":h?`compacting`:`running`,children:[(0,U.jsxs)(`span`,{role:`status`,className:`flex min-w-0 flex-1 items-center gap-2`,children:[h?(0,U.jsx)(M,{className:`size-3.5 flex-none text-content-secondary`}):(0,U.jsx)(re,{status:`run`,className:`size-4`}),(0,U.jsx)(`span`,{className:`shrink-0 text-content`,children:m(h?`chat:focusSession.compactingContext`:`chat:focusSession.running`)}),e&&(0,U.jsx)(Ue,{startedAt:n})]}),e&&i&&(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex h-[26px] shrink-0 cursor-pointer items-center gap-1.5 rounded-sm px-2 text-[13px] text-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60 max-[650px]:h-11 max-[650px]:min-w-[72px] max-[650px]:justify-center pointer-coarse:h-11 pointer-coarse:min-w-[72px]`,"aria-label":m(r?`chat:focusSession.stopping`:`chat:focusSession.stop`),title:m(`chat:focusSession.stopRunShortcut`),"aria-busy":r||void 0,disabled:r,onClick:i,"data-run-stop":!0,children:[(0,U.jsx)(g,{size:10,fill:`currentColor`,"aria-hidden":`true`}),m(r?`chat:focusSession.stopping`:`chat:focusSession.stop`),(0,U.jsx)(N,{className:`max-[650px]:hidden pointer-coarse:hidden`,children:`Esc`})]})]}),y.length>0&&(0,U.jsx)(`ul`,{className:`m-0 flex max-h-[136px] min-w-0 list-none flex-col overflow-x-hidden overflow-y-auto overscroll-contain p-0 [&>*+*]:border-t [&>*+*]:border-stroke-soft`,"aria-label":b,"data-pisper-queue-size":y.length,tabIndex:y.length>3?0:void 0,children:y.map((e,t)=>{let n=typeof e.id==`string`?e.id:``,r=s.includes(n),i=!n||r,a=String(e.text||``);return(0,U.jsxs)(`li`,{className:j(We,`group/queued`),"aria-busy":r||void 0,children:[(0,U.jsx)(`span`,{className:`inline-flex h-[18px] flex-none items-center rounded-xs border border-stroke bg-solid px-1.5 text-[11.5px] text-content-muted`,"data-queued-behavior":e.behavior===`steer`?`steer`:`followUp`,children:e.behavior===`steer`?m(`board:composer.queuedSteer`):m(`board:composer.queuedFollowUp`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content [overflow-wrap:anywhere]`,title:a,children:a}),u&&(0,U.jsx)(`button`,{type:`button`,className:Ge,"aria-label":m(`board:composer.sendQueuedNow`),title:m(`board:composer.sendQueuedNow`),disabled:i,"data-queued-send-now":!0,onClick:()=>u(n),children:(0,U.jsx)(le,{size:14,"aria-hidden":`true`})}),c&&(0,U.jsx)(`button`,{type:`button`,className:Ge,"aria-label":m(`board:composer.editQueued`),title:m(`board:composer.editQueued`),disabled:i,"data-queued-edit":!0,onClick:()=>void c(n),children:(0,U.jsx)(p,{size:14,"aria-hidden":`true`})}),l&&(0,U.jsx)(`button`,{type:`button`,className:Ge,"aria-label":m(`board:composer.cancelQueued`),title:m(`board:composer.cancelQueued`),disabled:i,"data-queued-cancel":!0,onClick:()=>void l(n),children:(0,U.jsx)(v,{size:14,"aria-hidden":`true`})})]},n||`${e.behavior}-${t}`)})})]})}function qe({invocation:e,onRemove:t}){let{t:n}=o();return(0,U.jsxs)(`div`,{className:`composer-resource-chip [&.workflow]:border-success-border [&.workflow]:bg-success-soft [&.workflow]:text-success-strong [&_button]:grid [&_button]:size-6 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:text-content-muted [&_button]:hover:bg-surface-hover [&_button]:hover:text-content inline-flex h-7 self-start items-center gap-1.5 rounded-sm border border-star-border bg-star-soft pr-0.5 pl-2 text-xs font-medium text-star-strong max-[650px]:h-11 max-[650px]:[&_button]:size-11 ${e.kind}`,children:[e.kind===`tool`?(0,U.jsx)(_,{size:13}):(0,U.jsx)(l,{size:13}),(0,U.jsxs)(`span`,{children:[e.kind===`skill`?`Skill`:e.kind===`tool`?n(`chat:resourcePicker.tool`):n(`chat:resourcePicker.workflow`),` `,`· `,e.resourceName]}),(0,U.jsx)(`button`,{type:`button`,"aria-label":n(`chat:resourcePicker.remove`),onClick:t,children:(0,U.jsx)(v,{size:13})})]})}function Je({streaming:e,queueing:t,submitting:n=!1,stopping:r=!1,preparing:i=!1,hasDraft:a=!1,canQueue:s=!1,blockedReason:l,disabled:u,onLongPress:d,longPressHint:f,onStop:p}){let{t:h}=o(),_=P(`sendMessage`),v=(0,L.useRef)(null),y=(0,L.useRef)(!1),b=()=>{v.current&&clearTimeout(v.current),v.current=null};(0,L.useEffect)(()=>{let e=v;return()=>{e.current&&clearTimeout(e.current)}},[]);let x=!!(p&&e&&!a),S=!!(e&&!(a&&s))&&!x,C=t||n||r||i,w=u||C||S||!!l,T=h(i?`chat:focusSession.preparingAttachments`:r?`chat:focusSession.stopping`:x?`chat:focusSession.stop`:`chat:focusSession.sendMessage`);return(0,U.jsx)(`button`,{type:x?`button`:`submit`,"data-send-mode":x?`stop`:`send`,className:`send-button grid size-8 min-w-8 flex-none cursor-pointer place-items-center rounded-full border border-transparent bg-star text-on-accent transition-[background-color,opacity] select-none [-webkit-touch-callout:none] hover:enabled:bg-star-hover active:enabled:translate-y-px disabled:cursor-not-allowed disabled:opacity-30 aria-disabled:opacity-30 max-[650px]:disabled:bg-surface-muted max-[650px]:disabled:text-content max-[650px]:disabled:opacity-100 max-[650px]:aria-disabled:bg-surface-muted max-[650px]:aria-disabled:text-content max-[650px]:aria-disabled:opacity-100 max-[650px]:dark:disabled:bg-surface-active max-[650px]:dark:aria-disabled:bg-surface-active data-[send-mode=stop]:bg-surface-muted data-[send-mode=stop]:text-content data-[send-mode=stop]:hover:enabled:bg-surface-hover dark:data-[send-mode=stop]:bg-surface-active max-[650px]:size-9 max-[650px]:min-w-9 min-[651px]:pointer-coarse:size-11 min-[651px]:pointer-coarse:min-w-11 ${W}`,title:l||(!C&&_?`${T} (${_})`:T),"aria-label":l?`${T}: ${l}`:T,"aria-busy":C||void 0,"aria-disabled":w||void 0,"aria-description":d&&!x?f:void 0,"data-long-press":d&&!x?`steer`:void 0,onPointerDown:e=>{y.current=!1,!(!d||x||w||e.pointerType===`mouse`)&&(b(),v.current=setTimeout(()=>{v.current=null,y.current=!0,d()},500))},onPointerUp:b,onPointerCancel:b,onPointerLeave:b,onContextMenu:e=>{d&&e.preventDefault()},onClick:e=>{if(y.current){y.current=!1,e.preventDefault();return}if(w){e.preventDefault();return}x&&p?.()},disabled:!l&&w,children:C?(0,U.jsx)(m,{className:`animate-spin ${Ve}`,size:17}):x?(0,U.jsx)(g,{size:13,fill:`currentColor`,"aria-hidden":`true`}):(0,U.jsx)(c,{size:17,strokeWidth:2.1,className:Ve})})}function Ye({levels:e,value:t,labelFor:n,onCommit:r,disabled:i=!1,ariaLabel:a,title:o,trailing:s,className:c}){let[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),p=(0,L.useRef)(!1),m=Math.max(0,e.indexOf(t)),h=l??m,g=n(e[h]||t),_=i||d||e.length<2,v=e.join(`|`);(0,L.useEffect)(()=>{u(null)},[t,v]);let y=async n=>{let i=e[n];if(_||p.current||!i||i===t){u(null);return}p.current=!0,f(!0);try{await r(i)}finally{p.current=!1,f(!1),u(null)}};return(0,U.jsxs)(`div`,{className:j(`min-w-0`,c),children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 px-0.5 pb-1`,children:[o&&(0,U.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:o}),(0,U.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] leading-5 font-medium text-accent-fg`,"aria-live":`polite`,children:g}),s]})]}),(0,U.jsx)(A,{className:j(`h-7`,`[&_[data-slot=slider-range]]:bg-[linear-gradient(90deg,var(--star-border),var(--star))]`,`[&_[data-slot=slider-thumb]]:size-4 [&_[data-slot=slider-thumb]]:bg-[radial-gradient(circle,var(--star)_0_2px,var(--key-bg)_2.5px)]`),showSteps:!0,min:0,max:Math.max(1,e.length-1),step:1,value:[h],disabled:_,"aria-label":a,valueText:g,onValueChange:([e])=>u(e),onValueCommit:([e])=>void y(e)}),e.length>1&&(0,U.jsxs)(`div`,{className:`flex justify-between px-0.5 pt-0.5 text-xs text-content-faint`,"aria-hidden":`true`,children:[(0,U.jsx)(`span`,{children:n(e[0])}),(0,U.jsx)(`span`,{children:n(e.at(-1)||``)})]})]})}var Xe=96,Ze=.6,Qe=`10%`;function $e({onDismiss:e,className:t}){let n=(0,L.useRef)(null),r=e=>{e.sheet.style.transform=``,e.sheet.style.transition=``},i=e=>{if(e.button!==0)return;let t=e.currentTarget.closest(`[data-slot="sheet-content"]`);t&&(e.currentTarget.setPointerCapture?.(e.pointerId),t.style.transition=`none`,n.current={pointerId:e.pointerId,startY:e.clientY,startAt:performance.now(),sheet:t,offset:0})},a=e=>{let t=n.current;!t||t.pointerId!==e.pointerId||(t.offset=Math.max(0,e.clientY-t.startY),t.sheet.style.transform=`translateY(${t.offset}px)`)},o=t=>{let{sheet:n}=t;n.style.setProperty(`--tw-exit-translate-y`,`calc(${t.offset}px + ${Qe})`);let i=()=>{n.removeEventListener(`animationstart`,a),r(t),n.style.removeProperty(`--tw-exit-translate-y`)},a=e=>{e.target===n&&n.dataset.state!==`closed`&&i()};n.addEventListener(`animationstart`,a),e(),requestAnimationFrame(()=>{n.isConnected&&n.dataset.state!==`closed`&&i()})},s=e=>{let t=n.current;if(!t||t.pointerId!==e.pointerId)return;n.current=null;let i=t.offset/Math.max(1,performance.now()-t.startAt);if(t.offset>=Xe||t.offset>24&&i>=Ze){o(t);return}r(t)},c=()=>{let e=n.current;n.current=null,e&&r(e)};return(0,U.jsx)(`div`,{"aria-hidden":`true`,"data-sheet-drag-handle":!0,className:j(`flex h-8 w-full flex-none cursor-grab touch-none items-start justify-center select-none active:cursor-grabbing`,t),onPointerDown:i,onPointerMove:a,onPointerUp:s,onPointerCancel:c,onLostPointerCapture:c,children:(0,U.jsx)(`span`,{className:`mt-2.5 h-1 w-9 rounded-full bg-stroke-strong`})})}function et({sheet:e,title:t,trigger:n,children:r,open:i,onOpenChange:a,align:o,side:s,sideOffset:c,className:l,sheetClassName:u}){let[d,f]=(0,L.useState)(!1),p=i??d,m=e=>{i===void 0&&f(e),a?.(e)};return e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(b,{"aria-haspopup":`dialog`,"aria-expanded":p,onClick:()=>m(!0),children:n}),(0,U.jsx)(ne,{open:p,onOpenChange:m,children:(0,U.jsxs)(F,{side:`bottom`,showCloseButton:!1,"data-popover-sheet":!0,className:j(`max-h-[85dvh] gap-1 overflow-y-auto rounded-t-(--r-sheet) px-3 pt-1 pb-[calc(12px+var(--pisper-safe-area-bottom))]`,u),children:[(0,U.jsx)($e,{onDismiss:()=>m(!1)}),(0,U.jsx)(ee,{className:`px-2 pt-1 pb-1 text-base font-semibold`,children:t}),(0,U.jsx)(te,{className:`sr-only`,children:t}),r]})})]}):(0,U.jsxs)(k,{open:p,onOpenChange:m,children:[(0,U.jsx)(D,{asChild:!0,children:n}),(0,U.jsx)(O,{align:o,side:s,sideOffset:c,className:l,children:r})]})}var tt=1,nt=.9,rt=.8,it=.17,at=.1,ot=.999,st=.9999,ct=.99,lt=/[\\\/_+.#"@\[\(\{&]/,ut=/[\\\/_+.#"@\[\(\{&]/g,dt=/[\s-]/,ft=/[\s-]/g;function pt(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?tt:ct;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=pt(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=tt:lt.test(e.charAt(l-1))?(d*=rt,p=e.slice(i,l-1).match(ut),p&&i>0&&(d*=ot**+p.length)):dt.test(e.charAt(l-1))?(d*=nt,m=e.slice(i,l-1).match(ft),m&&i>0&&(d*=ot**+m.length)):(d*=it,i>0&&(d*=ot**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=st)),(d<at&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=pt(e,t,n,r,l+1,a+2,o),f*at>d&&(d=f*at)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function mt(e){return e.toLowerCase().replace(ft,` `)}function ht(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,pt(e,t,mt(e),mt(t),0,0,{})}var G=`[cmdk-group=""]`,gt=`[cmdk-group-items=""]`,_t=`[cmdk-group-heading=""]`,vt=`[cmdk-item=""]`,yt=`${vt}:not([aria-disabled="true"])`,bt=`cmdk-item-select`,K=`data-value`,xt=(e,t,n)=>ht(e,t,n),St=L.createContext(void 0),q=()=>L.useContext(St),Ct=L.createContext(void 0),wt=()=>L.useContext(Ct),Tt=L.createContext(void 0),Et=L.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=Lt(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=S(),y=S(),b=S(),C=L.useRef(null),w=zt();Y(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),Y(()=>{w(6,j)},[]);let T=L.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)A(),O(),w(1,k);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(w(7,()=>{n.current.selectedItemId=M()?.id,T.emit()}),r||w(5,j),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}T.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),E=L.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,D(t,r)),w(2,()=>{O(),T.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),w(3,()=>{A(),O(),n.current.value||k(),T.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=M();w(4,()=>{A(),t?.getAttribute(`id`)===e&&k(),T.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:C}),[]);function D(e,t){let r=s.current?.filter??xt;return e?r(e,n.current.search,t):0}function O(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;N().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(gt);t?t.appendChild(e.parentElement===t?e:e.closest(`${gt} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${gt} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${G}[${K}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(K);T.setState(`value`,e||void 0)}function A(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=D(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function j(){var e;let t=M();t&&(t.parentElement?.firstChild===t&&((e=t.closest(G)?.querySelector(_t))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${vt}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(yt)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(K))}function F(e){var t;let n=M(),r=N(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&T.setState(`value`,a.getAttribute(K))}function ee(e){let t=M()?.closest(G),n;for(;t&&!n;)t=e>0?Ft(t,G):It(t,G),n=t?.querySelector(yt);n?T.setState(`value`,n.getAttribute(K)):F(e)}let te=()=>P(N().length-1),ne=e=>{e.preventDefault(),e.metaKey?te():e.altKey?ee(1):F(1)},I=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?ee(-1):F(-1)};return L.createElement(x.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ne(e);break;case`ArrowDown`:ne(e);break;case`p`:case`k`:g&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),te();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(bt);t.dispatchEvent(e)}}}}},L.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:Vt},c),Q(e,e=>L.createElement(Ct.Provider,{value:T},L.createElement(St.Provider,{value:E},e))))}),Dt=L.forwardRef((e,t)=>{let n=S(),r=L.useRef(null),i=L.useContext(Tt),a=q(),o=Lt(e),s=o.current?.forceMount??i?.forceMount;Y(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Rt(n,r,[e.value,e.children,r],e.keywords),l=wt(),u=Z(e=>e.value&&e.value===c.current),d=Z(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);L.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(bt,f),()=>t.removeEventListener(bt,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...b}=e;return L.createElement(x.div,{ref:y(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Ot=L.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=S(),s=L.useRef(null),c=L.useRef(null),l=S(),u=q(),d=Z(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Y(()=>u.group(o),[]),Rt(o,s,[e.value,e.heading,c]);let f=L.useMemo(()=>({id:o,forceMount:i}),[i]);return L.createElement(x.div,{ref:y(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&L.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Q(e,e=>L.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},L.createElement(Tt.Provider,{value:f},e))))}),kt=L.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=L.useRef(null),a=Z(e=>!e.search);return!n&&!a?null:L.createElement(x.div,{ref:y(i,t),...r,"cmdk-separator":``,role:`separator`})}),At=L.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=wt(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=q();return L.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),L.createElement(x.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),jt=L.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=L.useRef(null),o=L.useRef(null),s=Z(e=>e.selectedItemId),c=q();return L.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),L.createElement(x.div,{ref:y(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Q(e,e=>L.createElement(`div`,{ref:y(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Mt=L.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return L.createElement(E,{open:n,onOpenChange:r},L.createElement(w,{container:o},L.createElement(C,{"cmdk-overlay":``,className:i}),L.createElement(T,{"aria-label":e.label,"cmdk-dialog":``,className:a},L.createElement(Et,{ref:t,...s}))))}),Nt=L.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?L.createElement(x.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Pt=L.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return L.createElement(x.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>L.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(Et,{List:jt,Item:Dt,Input:At,Group:Ot,Separator:kt,Dialog:Mt,Empty:Nt,Loading:Pt});function Ft(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function It(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Lt(e){let t=L.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?L.useEffect:L.useLayoutEffect;function X(e){let t=L.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=wt(),n=()=>e(t.snapshot());return L.useSyncExternalStore(t.subscribe,n,n)}function Rt(e,t,n,r=[]){let i=L.useRef(),a=q();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(K,s),i.current=s}),i}var zt=()=>{let[e,t]=L.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Bt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&L.isValidElement(t)?L.cloneElement(Bt(t),{ref:t.ref},n(t.props.children)):n(t)}var Vt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function Ht({className:e,...t}){return(0,U.jsx)(J,{"data-slot":`command`,className:j(`flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground`,e),...t})}function Ut({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,U.jsxs)(se,{className:`h-8! rounded-sm! border-stroke bg-surface-subtle shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,U.jsx)(J.Input,{"data-slot":`command-input`,className:j(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,U.jsx)(oe,{children:(0,U.jsx)(h,{className:`size-4 shrink-0 opacity-50`})})]})})}function Wt({className:e,...t}){return(0,U.jsx)(J.List,{"data-slot":`command-list`,className:j(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function Gt({className:e,...t}){return(0,U.jsx)(J.Empty,{"data-slot":`command-empty`,className:j(`py-6 text-center text-sm`,e),...t})}function Kt({className:e,...t}){return(0,U.jsx)(J.Group,{"data-slot":`command-group`,className:j(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function qt({className:e,children:t,...n}){return(0,U.jsxs)(J.Item,{"data-slot":`command-item`,className:j(`group/command-item relative flex min-h-7.5 max-[650px]:min-h-11 pointer-coarse:min-h-11 cursor-default items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-accent data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,U.jsx)(u,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function Jt(e,t){let n=t.find(t=>t.key===e);return n?`${n.providerName} · ${n.label}`:e.split(`/`).at(-1)||e}function Yt({model:e,availableModels:t,sessionUsage:n,contextUsage:r}){let{t:i,language:a}=o(),s=n?.timing&&typeof n.timing==`object`?n.timing:null,c=Math.max(0,Number(s?.firstTokenSamples)||0),l=Math.max(0,Number(s?.requests)||0),u=c>0?Number(s?.firstTokenTotalMs)/c:null,d=l>0?Number(s?.durationTotalMs)/l:null,f=r?.tokens==null?null:Math.max(0,Number(r.tokens)||0),p=!!n?.cacheReported,m=[[i(`chat:focusSession.statCurrentModel`),e?Jt(e,t||[]):`—`],[i(`chat:focusSession.statContextTokens`),f==null?`—`:`${I(f)} / ${I(r?.contextWindow)}`],[i(`chat:focusSession.statInputTokens`),I(n?.input)],[i(`chat:focusSession.statOutputTokens`),I(n?.output)],[i(`chat:focusSession.statCacheReadTokens`),p?I(n?.cacheRead):`—`],[i(`chat:focusSession.statCacheWriteTokens`),p?I(n?.cacheWrite):`—`],[i(`chat:focusSession.statReasoningTokens`),I(n?.reasoning)],[i(`chat:focusSession.statProcessedTokens`),I(n?.processedTokens)],[i(`chat:focusSession.statRequests`),String(Math.max(0,Number(n?.requests)||0))],[i(`chat:focusSession.statAvgFirstToken`),u==null?`—`:ie(u,a)],[i(`chat:focusSession.statAvgDuration`),d==null?`—`:ie(d,a)]];return(0,U.jsxs)(`div`,{className:`session-stats-panel grid gap-[3px]`,"aria-label":i(`chat:focusSession.sessionStats`),children:[m.map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-[10px] text-[length:var(--app-small-size)]`,children:[(0,U.jsx)(`span`,{className:`min-w-0 shrink-0 text-[var(--text-muted)]`,children:e}),(0,U.jsx)(`strong`,{className:`min-w-0 truncate text-right font-[500] text-[var(--text)] [font-variant-numeric:tabular-nums]`,children:t})]},e)),(0,U.jsx)(`small`,{className:`text-[var(--text-secondary)] text-[length:var(--app-small-size)] leading-normal`,children:i(`chat:focusSession.sessionStatsHint`)})]})}function Xt({usage:e,sessionUsage:t,model:n,availableModels:r,onThresholdChange:i}){let{t:a}=o(),s=Number(e?.contextWindow)||0,c=e?.compactAtPercent==null?80:Number(e.compactAtPercent),l=Number.isFinite(c)?Math.round(c):80,[u,f]=(0,L.useState)(l),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(``),_=(0,L.useRef)(l),v=(0,L.useRef)(void 0);(0,L.useEffect)(()=>{window.clearTimeout(v.current),f(l),_.current=l},[l]),(0,L.useEffect)(()=>()=>window.clearTimeout(v.current),[]);let y=e?.percent!=null&&Number.isFinite(Number(e.percent))?Math.max(0,Number(e?.percent)):null,b=Math.max(0,Number(t?.processedTokens)||0),x=Number(t?.cacheHitRate),S=t?.cacheHitRate!=null&&Number.isFinite(x),C=s?`${e?.tokens==null?`—`:I(e.tokens)} / ${I(s)}${y==null?``:` · ${Math.round(y)}%`}`:``,w=e?.autoCompactEnabled&&e.compactionCapacityPercent!=null?a(`chat:focusSession.contextUsageToCompactionTokensPercent`,{percent:Math.round(Number(e.compactionCapacityPercent)),tokens:I(e.remainingBeforeCompaction)}):``,T=async e=>{let t=Math.min(95,Math.max(10,Math.round(e)));if(f(t),!(!i||t===_.current)){m(!0),g(``);try{await i(t),_.current=t}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},E=e=>{window.clearTimeout(v.current),f(e),v.current=window.setTimeout(()=>void T(e),250)},D=e=>{window.clearTimeout(v.current),T(e)},O=(e,t,n,r)=>(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-usage-row":n,title:r,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:e}),(0,U.jsx)(`strong`,{className:`min-w-0 truncate text-right font-medium text-content tabular-nums`,children:t})]});return(0,U.jsxs)(`div`,{className:`context-usage-section grid gap-1.5 border-t border-stroke-soft px-2 pt-2 pb-1.5`,"data-context-usage":!0,children:[C&&(0,U.jsxs)(`div`,{className:`grid gap-1`,children:[O(a(`board:composer.contextUsage`),C,`context`),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`block h-[3px] overflow-hidden rounded-full bg-surface-active`,children:(0,U.jsx)(`span`,{className:`block h-full rounded-full bg-content-secondary`,style:{width:`${Math.min(100,y||0)}%`}})})]}),b>0&&O(a(`board:composer.sessionTokens`),a(`board:composer.tokens`,{tokens:I(b)}),`tokens`),O(a(`board:composer.cacheHitLabel`),S?`${Math.round(Math.max(0,x))}%`:`—`,`cache`,S?void 0:a(`chat:focusSession.cacheHitRateUnavailable`)),s>0&&(0,U.jsxs)(`details`,{className:`group/usage min-w-0 text-xs`,onToggle:e=>{let t=e.currentTarget;t.open&&requestAnimationFrame(()=>t.scrollIntoView({block:`nearest`}))},children:[(0,U.jsxs)(`summary`,{className:`flex min-h-7 cursor-pointer list-none items-center gap-1 rounded-sm text-content-secondary hover:text-content focus-visible:outline-2 focus-visible:outline-focus max-[650px]:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(d,{size:13,"aria-hidden":`true`,className:`transition-transform duration-(--d-fast) group-open/usage:rotate-90`}),a(`chat:focusSession.sessionStats`)]}),(0,U.jsxs)(`div`,{className:`grid gap-2 pt-1.5`,children:[(0,U.jsx)(Yt,{model:n,availableModels:r,sessionUsage:t,contextUsage:e}),w&&(0,U.jsx)(`small`,{className:`text-content-muted`,children:w}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between font-medium text-content`,children:[(0,U.jsx)(`span`,{children:a(`chat:focusSession.autoCompactionThreshold`)}),(0,U.jsxs)(`output`,{className:`tabular-nums`,children:[u,`%`]})]}),(0,U.jsx)(A,{min:10,max:95,step:1,value:[u],className:`h-5 w-full`,"aria-label":a(`chat:focusSession.autoCompactionThreshold`),valueText:`${u}%`,disabled:p,onValueChange:([e])=>E(e),onValueCommit:([e])=>D(e)}),(0,U.jsx)(`small`,{className:h?`text-danger`:`text-content-muted`,children:h||(p?a(`chat:focusSession.savingCompactionThreshold`):`\xA0`)})]})]})]})}function $(e,t){return{off:e(`chat:focusSession.thinkingLabel.off`),minimal:e(`chat:focusSession.thinkingLabel.minimal`),low:e(`chat:focusSession.thinkingLabel.low`),medium:e(`chat:focusSession.thinkingLabel.medium`),high:e(`chat:focusSession.thinkingLabel.high`),xhigh:e(`chat:focusSession.thinkingLabel.xhigh`),max:e(`chat:focusSession.thinkingLabel.max`)}[t]||t}function Zt({model:e,models:t,onModelChange:n,thinkingLevel:r,levels:i,status:a,message:s,onThinkingChange:c,modelDisabled:l,thinkingDisabled:u,deferred:d=!1,pendingModel:p=!1,usage:m,sheet:h=!1,side:g=`top`,thinkingIsDefault:_=!1,onThinkingReset:v,triggerClassName:y}){let{t:b}=o(),[x,S]=(0,L.useState)(!1),C=t.find(t=>t.key===e),w=t.map(e=>e.label),T=C?.label||e.split(`/`).at(-1)||``,E=T?ce(T,w):b(`chat:focusSession.toolbarModel`),D=[...t.reduce((e,t)=>{let n=e.get(t.providerName)||[];return n.push(t),e.set(t.providerName,n)},new Map)],O=a!==`unsupported`&&i.length>0,k=O?$(b,r||i[0]):`—`,A=p?b(`chat:focusSession.thinkingAfterModelSwitch`):O?k:s||b(a===`unsupported`?`chat:focusSession.thinkingLevelUnsupported`:`chat:focusSession.loadingThinkingLevels`),M=u||x||!O||i.length<2,N=`${b(`chat:focusSession.modelAndThinking`)} · ${Jt(e,t)} · ${A}`;return(0,U.jsxs)(et,{sheet:h,title:b(`chat:focusSession.modelAndThinking`),align:`end`,side:g,sideOffset:8,className:`model-effort-popover w-[272px] max-w-[calc(100vw_-_24px)] gap-0 p-1`,trigger:(0,U.jsxs)(`button`,{type:`button`,className:j(`model-effort-pill inline-flex h-[30px] min-w-0 max-w-[260px] cursor-pointer items-center gap-1.5 rounded-sm border border-transparent pr-1.5 pl-2.5 text-[13px] text-content transition-colors hover:bg-surface-hover disabled:cursor-default disabled:opacity-60 aria-expanded:bg-surface-hover max-[650px]:h-9 max-[650px]:gap-1 max-[650px]:rounded-full max-[650px]:bg-surface-muted max-[650px]:dark:bg-surface-active max-[650px]:px-3 max-[650px]:text-sm min-[651px]:pointer-coarse:h-11`,W,y),"aria-label":N,title:N,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium max-[650px]:hidden`,children:E}),(0,U.jsx)(`span`,{className:`hidden font-medium whitespace-nowrap max-[650px]:inline`,children:b(`chat:focusSession.modelChipShort`)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint max-[650px]:hidden`,children:`·`}),(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted max-[650px]:hidden`,children:O?$(b,r||i[0]):`—`}),(0,U.jsx)(f,{size:14,className:`shrink-0 text-content-muted max-[650px]:hidden`,"aria-hidden":`true`})]}),children:[(0,U.jsxs)(`div`,{className:`model-effort-model flex flex-col gap-1 p-1.5 pb-2`,children:[(0,U.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-content-muted`,children:b(`chat:focusSession.toolbarModel`)}),(0,U.jsxs)(Ht,{defaultValue:e,filter:(e,t,n)=>+!![e,...n||[]].join(` `).toLowerCase().includes(t.trim().toLowerCase()),className:`rounded-sm! border border-stroke-soft bg-transparent p-0`,"aria-label":b(`chat:focusSession.currentChatModel`),children:[t.length>6&&(0,U.jsx)(Ut,{placeholder:b(`chat:focusSession.searchModels`)}),(0,U.jsxs)(Wt,{className:`max-h-56`,children:[(0,U.jsx)(Gt,{className:`py-4 text-xs text-content-muted`,children:t.length?b(`chat:focusSession.noMatchingModels`):b(`chat:focusSession.noModelsAvailable`)}),!C&&e&&(0,U.jsx)(Kt,{children:(0,U.jsx)(qt,{value:e,"data-checked":!0,disabled:!0,children:(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:E})})}),D.map(([t,r])=>(0,U.jsx)(Kt,{heading:t,children:r.map(t=>{let r=ce(t.label,w);return(0,U.jsx)(qt,{value:t.key,keywords:[t.label,t.providerName],"data-checked":t.key===e,disabled:l||x,onSelect:()=>{t.key!==e&&n(t.key)},children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,title:t.label,children:[(0,U.jsx)(`span`,{className:`wrap-anywhere`,children:r}),r!==t.label&&(0,U.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:t.label})]})},t.key)})},t))]})]})]}),O&&(0,U.jsx)(Ye,{className:`border-t border-stroke-soft p-1.5 pt-2`,title:b(`chat:focusSession.thinkingLevelTitle`),levels:i,value:r,labelFor:e=>$(b,e),onCommit:async e=>{S(!0);try{await c(e)}finally{S(!1)}},disabled:M,ariaLabel:b(`chat:focusSession.currentThinkingLevel`),trailing:_?(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-content-faint`,children:b(`chat:focusSession.thinkingModelDefault`)}):v?(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 cursor-pointer rounded-sm text-xs text-content-muted underline-offset-2 hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-focus`,onClick:v,children:b(`chat:focusSession.thinkingReset`)}):void 0}),d&&(0,U.jsx)(`p`,{className:`px-2 pt-1 pb-2 text-xs leading-4 text-content-muted`,role:`status`,children:b(`chat:focusSession.runtimeSelectionDeferred`)}),(!O||i.length===1)&&(0,U.jsx)(`p`,{className:`border-t border-stroke-soft px-2 pt-2 pb-1.5 text-xs leading-relaxed text-content-muted`,role:`status`,children:O?b(`chat:focusSession.thinkingLevelFixed`,{level:k}):A}),m]})}export{ue as C,fe as S,Pe as _,$e as a,De as b,Ve as c,Je as d,Ke as f,Ae as g,Me as h,et as i,W as l,ke as m,Zt as n,ze as o,Re as p,$ as r,Be as s,Xt as t,qe as u,be as v,pe as x,Se as y};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-AcMle1-H.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-D2lZDIiK.js","assets/i18n-BkTAd6ln.js","assets/vendor-router-CSN_DGvx.js","assets/index-BEFqinGB.js","assets/index-dYNkGdsI.css","assets/storage-8QW6lXuT.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-CAk4qwf5.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-DxVr8Wtj.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-Cz6vFMXv.js","assets/AppSelect-BD6RAaJ5.js","assets/use-mobile-C2tPBAza.js","assets/select-DD_WO-gs.js","assets/check-2vYc6QaP.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/dist-V8chnW6-.js","assets/dist-BsRXXcSL.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-B4o1GC7K.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-WMfxb0MX.js","assets/api-CWaE7hay.js","assets/abort-signal-f4JsiYKX.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-DsgBuvJv.js","assets/dist-BaBySQmo.js","assets/format-DMJQzoZ7.js","assets/dialog-VGmRGR6P.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-BDrWMmiv.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.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,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-D2lZDIiK.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-up-DST6-qVQ.js";import{t as c}from"./check-2vYc6QaP.js";import{t as l}from"./chevron-down-CxtxIjiP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{t as d}from"./earth-Ddy13fHh.js";import{t as f}from"./external-link-CEQqPcqc.js";import{i as p}from"./GitDiffViewer-AcMle1-H.js";import{t as m}from"./file-Bllajneu.js";import{F as h,_ as g,a as _,f as v,g as y,i as b,o as x,r as S}from"./side-chat-context-D7xA1822.js";import{t as C}from"./git-branch-N7LGjtzt.js";import{t as w}from"./image-BY_c3FYU.js";import{t as T}from"./link-2-mgasYn21.js";import{t as E}from"./message-square-SKjZyY3v.js";import{t as D}from"./refresh-cw-TbWxTY4K.js";import{t as O}from"./square-bHHVTT3G.js";import"./tooltip-D4MFbqcG.js";import{t as k}from"./utils-C8uzG5AZ.js";import{n as A,t as j}from"./button-CCcCN8tE.js";import{c as M,r as ee}from"./shortcuts-BtoPU0le.js";import{t as N}from"./chat-api-DIe7JvSq.js";import{t as P}from"./input-CPw-zkYh.js";import{n as F}from"./session-change-summary-api-Dvl_So5i.js";import{n as I,t as L}from"./PageState-Cz6vFMXv.js";import{t as R}from"./AppSelect-BD6RAaJ5.js";import{t as z}from"./web-preview-BvYYjssc.js";import"./collapsible-Dcoy-qnz.js";import{o as B}from"./session-tree-summary-DXft8Rmr.js";var V=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),H=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),U=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),W=e(n(),1),G=r(),K={completed:`completed`,in_progress:`running`,blocked:`blocked`,pending:`pending`};function q(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function J({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,G.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${K[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,G.jsx)(c,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,G.jsx)(A,{className:`size-3.5`}):e===`blocked`?(0,G.jsx)(U,{size:11,strokeWidth:2}):(0,G.jsx)(V,{size:11,strokeWidth:2}),(0,G.jsx)(`span`,{className:`sr-only`,children:n})]})}function Y({item:e,current:t,t:n}){return(0,G.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,G.jsx)(J,{status:e.blocked?`blocked`:e.status,t:n}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,G.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:n(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,G.jsx)(h,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,G.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:n(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,G.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,G.jsx)(U,{size:11,className:`flex-none`}),(0,G.jsx)(`span`,{className:`truncate`,children:n(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function X({plan:e,header:t,collapsible:n=!1}){let{t:r}=i(),a=(0,W.useRef)(null),[o,s]=(0,W.useState)(!0),c=e?.items||[],u=q(c),d=u.filter(e=>e.status===`completed`).length,f=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,p=u.filter(e=>e.blocked).length,m=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,W.useLayoutEffect)(()=>{if(n&&!o)return;let e=a.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top?e.scrollTop-=r.top-i.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[n,m,o,u.length]),!c.length)return null;let h=u.find(e=>e.id===m),g=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(H,{className:`flex-none text-content-muted`,size:15}),(0,G.jsx)(`strong`,{className:`tabular-nums`,children:r(`chat:planBoard.progress`,{completed:d,total:c.length})}),h?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:h.title,children:h.title}):null,(0,G.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[f>0&&(0,G.jsx)(`span`,{children:r(`chat:planBoard.countInProgress`,{count:f})}),p>0&&(0,G.jsx)(`span`,{className:`blocked text-danger`,children:r(`chat:planBoard.countBlocked`,{count:p})})]}),t,n?(0,G.jsx)(l,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),_=(0,G.jsx)(`ul`,{ref:a,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,G.jsx)(Y,{item:e,current:e.id===m,t:r},e.id))});return n?(0,G.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:o,onToggle:e=>s(e.currentTarget.open),children:[(0,G.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":r(`chat:planBoard.toggleAriaLabel`),children:g}),_]}):(0,G.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":r(`chat:planBoard.ariaLabel`),children:[(0,G.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:g}),_]})}var te=(0,W.memo)(X),ne=(0,W.lazy)(()=>t(()=>import(`./GitDiffViewer-AcMle1-H.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function Z({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?N.getFileDiff(e,t,{signal:r}):N.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,G.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,G.jsx)(A,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,G.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,G.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,G.jsx)(W.Suspense,{fallback:null,children:(0,G.jsx)(ne,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function re({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>N.getVcsChanges(e,{signal:t})}),l=p(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),d=(0,W.useMemo)(()=>y(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),f=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),m=c.error?.message||c.data?.error,h=c.data?.files||[];return(0,G.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!m&&(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,d.added]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.removed]})]}),(0,G.jsx)(j,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,G.jsx)(D,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,G.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,G.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,G.jsx)(C,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(j,{variant:`ghost`,size:`sm`,disabled:!h.length||!!m,onClick:()=>o({expandedFiles:h.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,G.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!m&&f.map(e=>(0,G.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,G.jsx)(I,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):m?(0,G.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:m}):c.data?.isRepo?h.length?(0,G.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:h.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,G.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,G.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,G.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,G.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(d.files,t.path)&&(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,d.files[t.path].added]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.files[t.path].removed]})]})]}),n&&(0,G.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,G.jsx)(Z,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,G.jsx)(L,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,G.jsx)(L,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Q(e){return e instanceof Error?e.message:String(e)}function ie({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,W.useState)(0),[s,c]=(0,W.useState)(0),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!0),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),T=(0,W.useRef)(!1),E=(0,W.useRef)(0),D=(0,W.useRef)(0),O=(0,W.useRef)(!0),k=(0,W.useRef)(!1),A=(0,W.useRef)(t);return(0,W.useLayoutEffect)(()=>{A.current=t},[t]),(0,W.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,W.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),N.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Q(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await N.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Q(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await N.approveSessionFileChanges(e,t.path):await N.revertSessionFileChanges(e,t.path);if(F(e),!T.current||i!==E.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){T.current&&i===E.current&&g(Q(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var ae=(0,W.lazy)(()=>t(()=>import(`./TaskTerminalView-DxVr8Wtj.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,19,10,20,14,13,15,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),oe=(0,W.lazy)(()=>t(()=>import(`./TaskProcessesPane-B4o1GC7K.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,38,10,19,20,39,25,15,29,34,12,13,14,21,22,23,24,26,27,28,30,31,32,33,35]))),se=(0,W.lazy)(()=>t(()=>import(`./FileAttachmentPreview-WMfxb0MX.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,41,42,43,10,44,45,11,46,13,29,15,31,47,12,14,48,49,50,32,51,52,53,54,55,25,56,57])));function ce({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=p(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,W.useContext)(g),[s,c]=(0,W.useState)(``),l=(0,W.useRef)(null),d=e.find(e=>e.id===s),f=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,G.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,G.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,G.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,G.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,G.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(P,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,G.jsxs)(R,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,G.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,G.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,G.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,G.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!f.length&&(0,G.jsx)(L,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),f.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?w:e.method===`path`?T:m;return(0,G.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,G.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,G.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,G.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,G.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,G.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,G.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,G.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,G.jsx)(j,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),d&&(0,G.jsx)(W.Suspense,{fallback:null,children:(0,G.jsx)(se,{attachment:d.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof d.attachment.downloadUrl==`string`&&window.open(d.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function le({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:c}=S(e),l=r.session?.id??``,u=(0,W.useMemo)(()=>e=>a.subscribeSessionState(l,e),[a,l]),d=(0,W.useMemo)(()=>()=>a.getSessionState(l),[a,l]),f=(0,W.useSyncExternalStore)(u,d),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),[y,C]=(0,W.useState)(``),w=(0,W.useRef)(!1),T=(0,W.useRef)(!1),D=(0,W.useRef)(r.draft);D.current=r.draft;let k=(0,W.useRef)(null),N=M(e=>e.bindings),P=b(f,r.session);(0,W.useEffect)(()=>{t&&o(e)},[t,o,e]);let F=async t=>{t.preventDefault();let n=D.current.trim();if(!(!n||w.current||P||r.expired)){w.current=!0,m(!0),C(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;D.current.trim()===n&&c(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){C(B(e))}finally{w.current=!1,m(!1)}}},I=(0,W.useCallback)(async()=>{if(!(!l||a.getSessionState(l).streaming)){C(``);try{await a.retry(l),await o(e)}catch(e){C(B(e))}}},[o,e,a,l]),L=async()=>{if(!(!l||h)){g(!0);try{C(``),await a.abort(l)}catch(e){C(B(e))}finally{g(!1)}}},R=(0,G.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,G.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,G.jsx)(E,{className:`size-4`,"aria-hidden":`true`})}),(0,G.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,G.jsxs)(j,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&k.current?.focus()},children:[r.loading&&(0,G.jsx)(A,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),z=y||r.error||f.error;return(0,G.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,G.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),l?(0,G.jsx)(x,{sessionId:l,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:R,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:P,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(l),onRetryLastTurn:I}):(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:R}),(0,G.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:F,children:[z&&(0,G.jsx)(v,{error:z,onRetry:r.error||!f.loaded?async()=>{await o(e)}:I}),(0,G.jsx)(_,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(l,e,t)}catch{}}}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,G.jsx)(`textarea`,{ref:k,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>c(e,t.target.value),onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:e=>{!T.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&ee(e.nativeEvent,N.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,G.jsx)(j,{type:P?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(P?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:P?h:p||r.loading||r.expired||!r.draft.trim(),onClick:P?()=>void L():void 0,children:p||h?(0,G.jsx)(A,{className:`size-4 text-current`}):P?(0,G.jsx)(O,{size:13,fill:`currentColor`}):(0,G.jsx)(s,{size:17})})]})]})]})}var $=(0,W.createContext)(null),ue=()=>{let e=(0,W.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},de=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(!1),l=(0,W.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,W.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,G.jsx)($.Provider,{value:u,children:(0,G.jsx)(`div`,{className:k(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},fe=({className:e,loading:t,src:n,...r})=>{let{url:i}=ue();return(0,G.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,G.jsx)(`iframe`,{className:k(`block size-full border-0 bg-background`,e),loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-presentation`,src:(n??i)||void 0,title:`Preview`,...r}),t]})};function pe({page:e,onChange:t}){let{t:n}=i(),{draft:r,url:a}=e,[o,s]=(0,W.useState)(!1);return(0,G.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,G.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=z(r,window.location.href);s(!n),n&&t({url:n})},children:[(0,G.jsx)(P,{"aria-label":n(`common:webPreview.url`),className:`flex-1 font-mono`,value:r,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,G.jsx)(j,{type:`submit`,variant:`secondary`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,G.jsx)(de,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:a,children:(0,G.jsx)(fe,{src:a,title:n(`common:webPreview.title`)})},a):(0,G.jsx)(L,{icon:d,className:`min-h-0 flex-1`,title:n(`chat:sessionContext.browserEmpty`)}),a&&(0,G.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(f,{size:14}),n(`common:webPreview.openExternal`)]}),(0,G.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`common:webPreview.embedNotice`)})]})}export{ae as a,Z as c,oe as i,te as l,le as n,ie as o,ce as r,re as s,pe as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-D2lZDIiK.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-DIlItxug.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{i as c}from"./permission-rules-api-C_to5cI_.js";import{t as l}from"./check-2vYc6QaP.js";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,t as _}from"./SessionBrowserPane-C41VsVCn.js";import{t as v}from"./earth-Ddy13fHh.js";import{t as y}from"./ellipsis-CfGKfbq6.js";import{o as b}from"./GitDiffViewer-AcMle1-H.js";import{B as ee,I as te,R as x,c as ne,g as S,s as re,v as C}from"./side-chat-context-D7xA1822.js";import{t as w}from"./git-branch-N7LGjtzt.js";import{t as ie}from"./message-square-SKjZyY3v.js";import{t as ae}from"./plus-fQbSqB1n.js";import{t as T}from"./refresh-cw-TbWxTY4K.js";import{t as oe}from"./square-terminal-BVG6cUT1.js";import{t as se}from"./x-07u4-129.js";import{c as ce,i as E,p as le,r as D,t as O}from"./dropdown-menu-Ds0gD8S8.js";import{i as ue,n as de,t as fe}from"./popover-CyHncZuo.js";import{t as pe}from"./segmented-control-xkrEOP_d.js";import{t as k}from"./utils-C8uzG5AZ.js";import{t as A}from"./button-CCcCN8tE.js";import{t as me}from"./chat-api-DIe7JvSq.js";import{a as j,r as M}from"./format-DMJQzoZ7.js";import{t as he}from"./StatusGlyph-1KgitlUg.js";import{t as ge}from"./session-change-summary-api-Dvl_So5i.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{i as _e,n as F,r as ve}from"./MarkdownMessage-BDrWMmiv.js";import{t as ye}from"./route-context-DvWDul4T.js";import"./web-preview-BvYYjssc.js";import{n as be}from"./terminal-context-aIsIJPn8.js";var xe=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Se=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),I=e(t(),1),L=n(),R={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function Ce(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 z(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function B({title:e,children:t}){return(0,L.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,L.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function V({status:e,name:t,detail:n,t:r}){let i=R[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,L.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,L.jsx)(he,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,L.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,L.jsx)(`span`,{className:`flex-none text-content-muted`,children:Ce(e,r)})]}),n&&(0,L.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function H(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function we({plan:e,goal:t,team:n,activity:i}){let{t:a}=r(),o=Array.isArray(n?.tasks)?n.tasks:[],s=H(i),c=!!(t?.id&&String(t.objective||``).trim()),l=!!e?.items?.length;if(!c&&!l&&!o.length&&!s.length)return(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,L.jsx)(P,{compact:!0,icon:x,title:a(`chat:sessionContext.planEmpty`)})});let u=Number(t?.mode===`team`?t?.teamTokenBudget:t?.tokenBudget)||0;return(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[c&&t&&(0,L.jsx)(B,{title:a(`board:inspector.goal`),children:(0,L.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,L.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(t.objective)}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,L.jsx)(`span`,{children:z(t,a)}),(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,L.jsx)(`span`,{children:u>0?a(`chat:focusSession.usedBudgetTokensUsed`,{used:M(t.tokensUsed),budget:M(u)}):a(`chat:focusSession.usedUnlimitedGoalTokens`,{used:M(t.tokensUsed)})})]})]})}),l&&(0,L.jsx)(B,{title:a(`board:inspector.plan`),children:(0,L.jsx)(p,{plan:e})}),o.length>0&&(0,L.jsx)(B,{title:a(`board:inspector.team`),children:(0,L.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:o.map((e,t)=>(0,L.jsx)(V,{status:e.status,name:e.taskName||a(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:a},e.id||`${e.taskName}-${t}`))})}),s.length>0&&(0,L.jsx)(B,{title:a(`board:inspector.subAgents`),children:(0,L.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,L.jsx)(V,{status:e.status,name:String(e.taskName||``).trim()||a(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:a},String(e.id||t)))})})]})}var U=100;function W(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var Te={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Ee={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function G(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function K(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function De(e,t){window.dispatchEvent(new CustomEvent(ye,{detail:{message:e,tone:t}}))}function q({added:e,removed:t}){return e===null||t===null?null:(0,L.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,L.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function J({status:e,children:t}){let{t:n}=r();return(0,L.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,L.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,L.jsxs)(O,{children:[(0,L.jsx)(le,{asChild:!0,children:(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,L.jsx)(y,{"aria-hidden":`true`})})}),(0,L.jsx)(D,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Y({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,L.jsxs)(`span`,{className:k(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Ee[e]),title:n,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,children:Te[e]}),(0,L.jsx)(`span`,{className:`sr-only`,children:n})]})}function X({files:e,selected:t,label:n,onSelect:r}){let i=(0,I.useRef)(null);return(0,L.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,U).map(e=>{let n=e.path===t,{directory:i,name:a}=G(e.path);return(0,L.jsx)(`li`,{className:`px-1`,children:(0,L.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Te[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:k(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,L.jsx)(Y,{status:e.status}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,L.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,L.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,L.jsx)(q,{added:e.added,removed:e.removed})]})},e.path)}),e.length>U&&(0,L.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,L.jsx)(Oe,{count:e.length-U})})]})}function Oe({count:e}){let{t}=r();return(0,L.jsx)(L.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Z=600;function ke({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:l}=r(),u=c(e=>e.diffMode),f=c(e=>e.setDiffMode),p=(0,I.useRef)(null),[m,h]=(0,I.useState)(0);(0,I.useLayoutEffect)(()=>{let e=p.current;if(!e)return;let t=()=>h(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let g=m===0||m>=Z,_=g?u:`unified`,v=g?void 0:l(`board:changes.splitTooNarrow`);return(0,L.jsxs)(`section`,{ref:p,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,L.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,L.jsx)(Y,{status:t.status}),(0,L.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,L.jsx)(q,{added:t.added,removed:t.removed}),(0,L.jsx)(pe,{size:`sm`,"aria-label":l(`board:changes.diffView`),title:v,"aria-description":v,value:_,onValueChange:f,options:[{value:`unified`,label:l(`board:changes.unified`)},{value:`split`,label:l(`board:changes.split`),disabled:!g}]})]}),(0,L.jsx)(d,{sessionId:e,path:t.path,scope:n,revision:i,mode:_,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,L.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function Ae({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=K(e,t);return(0,L.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await ve(i,_e),De(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){De(e instanceof F&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof F&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,L.jsx)(xe,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Q(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function $(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function je({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:u,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:g,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=h({sessionId:e,streaming:n,requestConfirm:o}),x=u?.files??[],ne=i?.expandedFiles?.[0],S=x.find(e=>e.path===ne)??x[0],re=e=>a?.({expandedFiles:[e]}),C=(e,t)=>f?.kind===e&&f.path===t,w=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,L.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,L.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,L.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:u?.summary.files??0})}),u&&u.summary.files>0&&(0,L.jsx)(q,{added:u.summary.added,removed:u.summary.removed})]})}),v&&(0,L.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,L.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!u?(0,L.jsx)(N,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(X,{files:x.map(e=>({...Q(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):$(e.formatChange,s)})),selected:S?.path??``,label:s(`board:changes.files`),onSelect:re}),S&&(0,L.jsx)(ke,{sessionId:e,file:Q(S),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:k(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,S.approved?`text-st-done`:`text-content-muted`),"data-change-state":S.reverted?`reverted`:S.approved?`approved`:`pending`,children:[S.approved&&!S.reverted&&(0,L.jsx)(l,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),S.reverted?s(`board:changes.revertedAt`,{time:j(S.changedAt,c)}):S.approved?s(`board:changes.approvedAt`,{time:j(S.changedAt,c)}):s(`board:changes.pendingAt`,{time:j(S.changedAt,c)})]}),S.pending&&!S.approved&&!S.reverted&&(0,L.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:w,onClick:()=>void b({kind:`approve`,path:S.path}),children:[C(`approve`,S.path)?(0,L.jsx)(T,{className:`animate-spin`}):(0,L.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,L.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||S.reverted||!S.canRevert,title:w,onClick:()=>void b({kind:`revert`,path:S.path}),children:[C(`revert`,S.path)?(0,L.jsx)(T,{className:`animate-spin`}):(0,L.jsx)(te,{}),s(`board:changes.revertFile`)]}),(0,L.jsx)(Ae,{cwd:t,path:S.path})]})})]}):!v&&(0,L.jsx)(P,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,L.jsxs)(J,{status:f?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):g>0?s(`board:changes.pending`,{count:g}):null,children:[g>0&&(0,L.jsxs)(E,{disabled:m,title:w,onSelect:()=>void b({kind:`approve`}),children:[(0,L.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(u?.summary.files??0)>0&&(0,L.jsxs)(E,{disabled:m||_===0,title:w??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,L.jsx)(te,{}),s(`board:changes.revertAll`)]}),(g>0||(u?.summary.files??0)>0)&&(0,L.jsx)(ce,{}),(0,L.jsxs)(E,{disabled:d||!!f,onSelect:ee,children:[(0,L.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function Me({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>me.getVcsChanges(e,{signal:t})}),l=(0,I.useMemo)(()=>S(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:W(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,L.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,L.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,L.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,L.jsx)(q,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,L.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,L.jsx)(w,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,L.jsx)(N,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,L.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(X,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,L.jsx)(ke,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,L.jsx)(Ae,{cwd:t,path:p.path})]})})]}):(0,L.jsx)(P,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,L.jsx)(P,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,L.jsx)(J,{status:c.isFetching?(0,L.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,L.jsxs)(E,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,L.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function Ne({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,L.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,L.jsx)(pe,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,L.jsx)(Me,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,L.jsx)(je,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,L.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var Pe=[];function Fe(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function Ie({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:d,team:p,activity:h,planTab:y,sources:te,mode:S,requestConfirm:w,onClose:T,onOpenComponents:ce,componentTabs:E,autoFocus:le=!1}){let{t:D}=r(),O=S===`sheet`,me=be(),j=o(e=>e.capabilities),M=!!me&&a(j,`terminal`),he=a(j,`vcs`),N=c(e=>e.tab),_e=c(e=>e.setTab),F=c(e=>e.terminalView),ve=c(e=>e.setTerminalView),ye=c(e=>e.changesView),xe=c(e=>e.setChangesView),R=C(e=>e.sessions[t]?.pages)??Pe,Ce=R.some(e=>e.kind===`side-chat`),z=N===`side-chat`&&!Ce||N===`plan`&&!y?`changes`:N,B=Fe(z,F,ye),V=B?R.find(e=>e.kind===B):void 0,H=!O&&E?E.tabs(n):[],[U,W]=(0,I.useState)(null),[Te,Ee]=(0,I.useState)(!1),G=H.some(e=>e.id===U)?U:null;(0,I.useEffect)(()=>W(null),[N]);let K=(0,I.useRef)(null);(0,I.useEffect)(()=>{K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[z,G]);let De=(0,I.useRef)(le);(0,I.useEffect)(()=>{if(!De.current)return;let e=requestAnimationFrame(()=>K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,I.useEffect)(()=>{if(!B||V||(B===`terminal`||B===`processes`)&&!M)return;let e=C.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,B,{type:`add`,kind:B}),n||e.update(t,B,{type:`workspace`,contentOpen:!1})},[B,V,t,M]);let q=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>ge(t),staleTime:1e4}),J=q.data?.status===`known`?q.data.changedFiles??0:0,Y=[{id:`changes`,icon:b,label:J>0?D(`board:inspector.changesCount`,{count:J}):D(`board:inspector.changes`)},{id:`terminal`,icon:oe,label:D(`board:inspector.terminal`)},{id:`files`,icon:ee,label:D(`board:inspector.files`)},{id:`preview`,icon:v,label:D(`board:inspector.preview`)},...y?[{id:`plan`,icon:x,label:D(`board:inspector.plan`)}]:[],...Ce?[{id:`side-chat`,icon:ie,label:D(`board:inspector.sideChat`)}]:[]],X=e=>{V&&C.getState().update(t,V.kind,{type:`view`,id:V.id,patch:e})},Oe=()=>{let n=R.find(e=>e.kind===`side-chat`);if(n&&C.getState().update(t,`side-chat`,{type:`close`,id:n.id}),_e(`changes`),O){T();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Z=t=>`${e}-component-${t}-tab`,ke=e=>{W(null),_e(e)},Ae=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Y.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),...H.map(e=>({component:e.id,id:Z(e.id)}))],r=n.findIndex(e=>G?e.component===G:e.fixed===z),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?W(i.component):i.fixed&&ke(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},Q=(0,L.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:D(`chat:focusSession.gitLoading`)}),$;if(G&&E)$=E.render(G,{sessionId:t,cwd:n});else if(z===`changes`)$=(0,L.jsx)(Ne,{sessionId:t,cwd:n,streaming:s,scope:ye,onScopeChange:xe,vcsAvailable:he,view:V?.view,onViewChange:V?X:void 0,requestConfirm:w});else if(z===`terminal`)$=M?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,L.jsx)(pe,{size:`sm`,"aria-label":D(`board:inspector.terminalScope`),value:F,onValueChange:ve,options:[{value:`terminal`,label:D(`board:inspector.terminal`)},{value:`processes`,label:D(`board:inspector.processes`)}]})}),(0,L.jsx)(I.Suspense,{fallback:Q,children:V?F===`processes`?(0,L.jsx)(f,{sessionId:t,view:V.view,onViewChange:X,onOpenTerminal:e=>{let n=C.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),ve(`terminal`)}}):(0,L.jsx)(u,{sessionId:t,cwd:n,terminalId:V.resourceId||void 0,onCreated:e=>C.getState().update(t,`terminal`,{type:`resource`,id:V.id,resourceId:e})},V.id):Q})]}):(0,L.jsx)(P,{compact:!0,icon:oe,title:D(`board:inspector.terminalUnavailable`)});else if(z===`files`)$=V?(0,L.jsx)(g,{sources:te,view:V.view,onViewChange:X}):Q;else if(z===`preview`){let e=s?re([...h]):null;$=V?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:[e&&(0,L.jsx)(`div`,{className:`max-h-[50%] shrink-0 overflow-y-auto border-b border-stroke-soft p-2`,children:(0,L.jsx)(ne,{target:e,fallbackImage:e.previewImage,streaming:s})}),(0,L.jsx)(_,{page:V,onChange:e=>C.getState().update(t,`browser`,{type:`browser`,id:V.id,...e})})]}):Q}else $=z===`plan`?(0,L.jsx)(we,{plan:l,goal:d,team:p,activity:h}):(0,L.jsx)(m,{parentId:t,active:!0});return(0,L.jsxs)(`section`,{id:e,"aria-label":D(`board:inspector.label`),"data-session-inspector":S,"data-inspector-tab":z,"data-inspector-component":G??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,L.jsxs)(`header`,{className:k(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,O?`h-[52px]`:S===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,L.jsxs)(`div`,{ref:K,role:`tablist`,"aria-label":D(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Ae,children:[Y.map(({id:t,icon:n,label:r})=>{let i=!G&&t===z;return(0,L.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:k(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,O?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>ke(t),children:[!O&&(0,L.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!G&&z===`side-chat`&&(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:k(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.sideChat`)}),onClick:Oe,children:(0,L.jsx)(se,{"aria-hidden":`true`})}),!O&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),H.map(({id:t,label:n})=>{let r=t===G;return(0,L.jsx)(`button`,{id:Z(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:k(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>W(t),children:(0,L.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!O&&(0,L.jsxs)(fe,{open:Te,onOpenChange:Ee,children:[(0,L.jsx)(ue,{asChild:!0,children:(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":D(`board:inspector.add`),title:D(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,L.jsx)(ae,{"aria-hidden":`true`})})}),(0,L.jsxs)(de,{align:`end`,className:`w-64 text-xs`,children:[E?.addMenu?E.addMenu({cwd:n,onAdded:e=>{W(e),Ee(!1)}}):(0,L.jsx)(`p`,{className:`text-content-secondary`,children:D(`board:inspector.addHint`)}),ce&&(0,L.jsx)(A,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:ce,children:D(`board:inspector.openComponents`)})]})]}),(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:k(`flex-none`,O&&`size-11`),"aria-label":D(`board:inspector.close`),title:D(`board:inspector.close`),"aria-controls":e,onClick:T,children:S===`aside`?(0,L.jsx)(Se,{"aria-hidden":`true`}):(0,L.jsx)(se,{"aria-hidden":`true`})})]}),(0,L.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":G?Z(G):`${e}-${z}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:$})]})}export{Ie as SessionInspector};