pisper 0.6.24 → 0.6.25
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.
- package/package.json +5 -5
- package/web/.vite/manifest.json +769 -631
- package/web/assets/{AppDialog-BcXOXBcR.js → AppDialog-CuxO26Km.js} +1 -1
- package/web/assets/{AppOverlays-DhOsSE6q.js → AppOverlays-Bt5SL3PY.js} +1 -1
- package/web/assets/{AppSelect-BD6RAaJ5.js → AppSelect-DQYKUW5E.js} +1 -1
- package/web/assets/{AssetsPage-7Fuwati9.js → AssetsPage-BE6AzOGC.js} +1 -1
- package/web/assets/{BoardPage-C81aOK4p.js → BoardPage-DX0fJ_ap.js} +3 -3
- package/web/assets/ChannelsPage-CyT7oDYZ.js +1 -0
- package/web/assets/{ChatAppearancePage-DQr-uhHb.js → ChatAppearancePage-B6Dzj2Bj.js} +1 -1
- package/web/assets/ChatHistoryPage-Cq20l93c.js +1 -0
- package/web/assets/ChatPage-DgiS-Qj_.js +553 -0
- package/web/assets/ConfigPage-CgrWdzb5.js +5 -0
- package/web/assets/{DesktopWindowControls-BWe5YIjj.js → DesktopWindowControls-D8axeuEx.js} +1 -1
- package/web/assets/FeaturePage-BB1TeMlr.js +1 -0
- package/web/assets/{FileAttachmentPreview-IZzA3f8k.js → FileAttachmentPreview-DPjT_iYk.js} +1 -1
- package/web/assets/{FloatingWidgets-DgIJkrEC.js → FloatingWidgets-FI1S4hdn.js} +1 -1
- package/web/assets/FocusRuntimeControls-CvAx-KDV.js +1 -0
- package/web/assets/{GitDiffViewer-CypHOHdP.js → GitDiffViewer-DwFfeFOA.js} +1 -1
- package/web/assets/{ManageProjectsDialog-DxiTEqYf.js → ManageProjectsDialog-BSLNf6qD.js} +1 -1
- package/web/assets/{MarkdownMessage-CuaozZah.js → MarkdownMessage-NK7Ixb4Y.js} +1 -1
- package/web/assets/{McpPage-BbmxMKuy.js → McpPage-Cn-yDgC5.js} +1 -1
- package/web/assets/MemoryEvolution-B8IeSLcd.js +1 -0
- package/web/assets/MemoryPage-ZwoG_oj6.js +2 -0
- package/web/assets/{MobileNavigation-IZrksubf.js → MobileNavigation-DK5a0kZU.js} +1 -1
- package/web/assets/{MorePage-DObfXE0e.js → MorePage-BL8nDnTQ.js} +1 -1
- package/web/assets/{NewFolderDialog-CeRiD1xe.js → NewFolderDialog-COkq83LW.js} +1 -1
- package/web/assets/{PageHeader-D8QTuWd6.js → PageHeader-BBTCMqXc.js} +1 -1
- package/web/assets/{PhoneDrawer-Dfmmixh5.js → PhoneDrawer-BcPKJWl-.js} +1 -1
- package/web/assets/{PhoneMenuButton-Bbna_Bcf.js → PhoneMenuButton-D6vdTZdF.js} +1 -1
- package/web/assets/{PhoneTopBar-Dz94PR8O.js → PhoneTopBar-MqNeI69v.js} +1 -1
- package/web/assets/{PluginsPage-0rmSVMfr.js → PluginsPage-Bp71HpKD.js} +1 -1
- package/web/assets/{SafeModePrompt-CAfT8lBS.js → SafeModePrompt-CpvvU5wL.js} +1 -1
- package/web/assets/SchedulesPage-Drs10rEV.js +1 -0
- package/web/assets/{SessionBrowserPane-DMTNqq-e.js → SessionBrowserPane-DjtB4MCI.js} +2 -2
- package/web/assets/SessionContextPanel-ETfnp4pT.js +2 -0
- package/web/assets/{SessionHome-047YRkeb.js → SessionHome-CHBw3ZvP.js} +1 -1
- package/web/assets/SessionInspector-DVaRflQy.js +1 -0
- package/web/assets/{SessionShell-BqNSjTbQ.js → SessionShell-CwfQAX7i.js} +1 -1
- package/web/assets/{SettingsSidebar-a9IEYCfr.js → SettingsSidebar-FgC-tlY2.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-B1RT_EMe.js → ShortcutHelpDialog-DKbIkUnk.js} +1 -1
- package/web/assets/{ShortcutKeys-DIEI9JQZ.js → ShortcutKeys-BuHXNKVW.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-phIx4K_T.js → SidebarUpdateStatus-LKwNKESF.js} +1 -1
- package/web/assets/{SkillsPage-CZuR-0QX.js → SkillsPage-BbnerW44.js} +1 -1
- package/web/assets/{TaskProcessesPane-x73TNzuV.js → TaskProcessesPane-B2fyZEK9.js} +1 -1
- package/web/assets/{TaskTerminalView-D2UVtmT1.js → TaskTerminalView-CKApgF75.js} +1 -1
- package/web/assets/{TerminalPanel-C0U35k57.js → TerminalPanel-D03WycYm.js} +1 -1
- package/web/assets/{WebDesktopPet-CJtB44aG.js → WebDesktopPet-K2dbcbnQ.js} +1 -1
- package/web/assets/WorkflowsPage-CmzftCtz.js +1 -0
- package/web/assets/{WorkspacePicker-C7hhcfZV.js → WorkspacePicker-DbdbTOV2.js} +1 -1
- package/web/assets/{api-BmSvZCuH.js → api-BW_X0FMZ.js} +1 -1
- package/web/assets/{app-update-DhpOY37a.js → app-update-DYFXTosD.js} +1 -1
- package/web/assets/{approval-confirm-Dc3BZGo4.js → approval-confirm-DQ5N_lJB.js} +1 -1
- package/web/assets/archive-ojKJT7Fp.js +1 -0
- package/web/assets/{board-projects-C7DazgZG.js → board-projects-CrejrMrn.js} +1 -1
- package/web/assets/book-open-BuHHD9os.js +1 -0
- package/web/assets/bots-store-CNXTx3UY.js +1 -0
- package/web/assets/{chat-api-DHqVwcpJ.js → chat-api-Bo6nhq40.js} +1 -1
- package/web/assets/chevrons-up-down-C2sEPdAh.js +1 -0
- package/web/assets/{client-store-Dif482Kx.js → client-store-DzgOPMlh.js} +1 -1
- package/web/assets/{config-search-CKpXm_hp.js → config-search-BiQmWst4.js} +1 -1
- package/web/assets/{dialog-DFcH7POi.js → dialog-DFZX_Dek.js} +1 -1
- package/web/assets/dist-BS3ekNDj.js +1 -0
- package/web/assets/{events-C7sXXop4.js → events-PfANjkHx.js} +1 -1
- package/web/assets/{focus-session-composer-bits-D2XiGLcj.js → focus-session-composer-bits-C_LOpJH_.js} +1 -1
- package/web/assets/{folder-paths-CsQLylLL.js → folder-paths-aRRH_MYq.js} +1 -1
- package/web/assets/{hosts-CwTc21QE.js → hosts-lvoPwC3T.js} +1 -1
- package/web/assets/i18n-EVP8yIdy.js +1 -0
- package/web/assets/index-D_zLThH_.js +2 -0
- package/web/assets/index-l96Dl6z6.css +2 -0
- package/web/assets/memory-api-DkPje--t.js +1 -0
- package/web/assets/message-circle-D-XrK6Ft.js +1 -0
- package/web/assets/{mobile-remote-fallback-C2Q0wAa6.js → mobile-remote-fallback-LLMZWoIu.js} +1 -1
- package/web/assets/mount-app-7pFSwVLO.js +9 -0
- package/web/assets/{permission-rules-api-D1Tbe4E9.js → permission-rules-api-CAJsSBA5.js} +1 -1
- package/web/assets/{pick-system-directory-CQS5pqM-.js → pick-system-directory-yk6L7wR2.js} +1 -1
- package/web/assets/pin-off-BpRu_vrC.js +1 -0
- package/web/assets/placements-CMrgmg3t.js +2 -0
- package/web/assets/{popover-CXB2yzW6.js → popover--q2hs_pT.js} +1 -1
- package/web/assets/{public-D1nVPEiV.js → public-62LVX7HU.js} +1 -1
- package/web/assets/public-DWbrDr0p.js +3 -0
- package/web/assets/{public-BVKkvQiF.js → public-DkqrpWXx.js} +2 -2
- package/web/assets/{public-components-B6uxO_ZB.js → public-components-DHMvCgH2.js} +1 -1
- package/web/assets/public-diff-WjbTu91T.js +1 -0
- package/web/assets/public-events-CTdTIu5Q.js +1 -0
- package/web/assets/{public-flags-KylDNCsK.js → public-flags-D9LdpQwJ.js} +1 -1
- package/web/assets/public-greeting-DEKYruJJ.js +1 -0
- package/web/assets/{public-session-DjI86F5J.js → public-session-B9UHA6rN.js} +1 -1
- package/web/assets/{public-sidebar-PhHPuas_.js → public-sidebar-Lne86i_K.js} +1 -1
- package/web/assets/{runtime-capabilities-store-CTtXyNjK.js → runtime-capabilities-store-BNM5Ug-5.js} +1 -1
- package/web/assets/{safe-mode-instance-_WZgKT1M.js → safe-mode-instance-DnTP7EUr.js} +1 -1
- package/web/assets/safe-mode-sentinel-DOhqH4gj.js +1 -0
- package/web/assets/select-Bbk9bmXO.js +1 -0
- package/web/assets/send-Cj-W03w_.js +1 -0
- package/web/assets/{session-change-summary-api-DENj-A9c.js → session-change-summary-api-DMTwGz7o.js} +1 -1
- package/web/assets/{session-home-D1MkpdBS.js → session-home-DUpZt2dn.js} +1 -1
- package/web/assets/session-list-BRMu9JWa.js +1 -0
- package/web/assets/{session-organization-api-Cm9HoIme.js → session-organization-api-BGyp66Uv.js} +1 -1
- package/web/assets/{session-scope-BnKeB5vZ.js → session-scope-DZITSvZr.js} +1 -1
- package/web/assets/{session-tree-actions-DhF8lJLn.js → session-tree-actions-CRWyFqAD.js} +1 -1
- package/web/assets/{session-tree-summary-DEJ52bdp.js → session-tree-summary-HTmAo_9V.js} +1 -1
- package/web/assets/{shortcuts-DnykOp5e.js → shortcuts-D72gQCwH.js} +1 -1
- package/web/assets/side-chat-context-D1hZOT7g.js +7 -0
- package/web/assets/{sidebar-bemTfe07.js → sidebar-sj8X80Y9.js} +1 -1
- package/web/assets/{sidebar-store-Be8dU3KV.js → sidebar-store-CXZ7QrOr.js} +1 -1
- package/web/assets/slider-De8rWVNs.js +1 -0
- package/web/assets/sliders-horizontal-Dryf1XyC.js +1 -0
- package/web/assets/{speech-session-4UWWW7HR.js → speech-session-D2GQEOAL.js} +1 -1
- package/web/assets/{startup-queries-iq2o5pqJ.js → startup-queries-CuEXV1Zu.js} +1 -1
- package/web/assets/{storage-8QW6lXuT.js → storage-DtvZ_lEu.js} +1 -1
- package/web/assets/tool-labels-Bexnwp5q.js +1 -0
- package/web/assets/undo-2-C-xQ0UVT.js +1 -0
- package/web/assets/{use-i18n-DCxQRXLH.js → use-i18n-_vdxObu5.js} +1 -1
- package/web/assets/{use-open-bot-BTTe7141.js → use-open-bot-BTxzOAbZ.js} +1 -1
- package/web/assets/{use-studio-actions-CvTVL6vy.js → use-studio-actions-CbMHRZpd.js} +1 -1
- package/web/assets/{useCatalogProjects-D0_Xilel.js → useCatalogProjects-BEkCpADy.js} +1 -1
- package/web/assets/{useNewProjectPicker-C3dVgDqI.js → useNewProjectPicker-CUtLjwYE.js} +2 -2
- package/web/assets/{useNow-BrhALV5l.js → useNow-eQeBCqQk.js} +1 -1
- package/web/assets/{usePhoneShell-BleJZMk4.js → usePhoneShell-DZHZWXnN.js} +1 -1
- package/web/assets/{useSessionListQuery-CSTrzBD6.js → useSessionListQuery-BoUzmjZC.js} +1 -1
- package/web/assets/{useSessionRowActions-CBOzJhLW.js → useSessionRowActions-DCqDrGZY.js} +1 -1
- package/web/assets/{useSidebarModel-AYsswvjm.js → useSidebarModel-CZAfH4Fa.js} +1 -1
- package/web/assets/{web-preview-B9ooQu6f.js → web-preview-XrRFo42l.js} +1 -1
- package/web/assets/{web-preview-events-DZb37WWK.js → web-preview-events-Ba6duwGi.js} +1 -1
- package/web/assets/workflow-messages-Cc4pX_oo.js +1 -0
- package/web/assets/{workspace-order-store-CQ4SHO-9.js → workspace-order-store-Ao4OZ13V.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/ChannelsPage-LM4bpKzy.js +0 -1
- package/web/assets/ChatHistoryPage-DcjG1hoQ.js +0 -1
- package/web/assets/ChatPage-HBq1cr2I.js +0 -553
- package/web/assets/ConfigPage-Bcjc5mbO.js +0 -5
- package/web/assets/FeaturePage-DGauTCbU.js +0 -1
- package/web/assets/FocusRuntimeControls-Bgq7LvMl.js +0 -1
- package/web/assets/MemoryPage-BeI2YTUn.js +0 -1
- package/web/assets/SchedulesPage-C3TpSm9t.js +0 -1
- package/web/assets/SessionContextPanel-DoS-Xqny.js +0 -2
- package/web/assets/SessionInspector-GXGZ9n87.js +0 -1
- package/web/assets/WorkflowsPage-o4p12fMI.js +0 -1
- package/web/assets/bots-store-CeTfxdyY.js +0 -1
- package/web/assets/dist-V8chnW6-.js +0 -1
- package/web/assets/i18n-YQ8mc9k7.js +0 -1
- package/web/assets/index-DJA4qaOu.css +0 -2
- package/web/assets/index-DjSjahBi.js +0 -2
- package/web/assets/mount-app-DAxz1ll-.js +0 -9
- package/web/assets/placements-BuU0Zuqy.js +0 -2
- package/web/assets/public-BVuJa7Dh.js +0 -3
- package/web/assets/public-diff-CCVYk91T.js +0 -1
- package/web/assets/public-events-CVn8fEHx.js +0 -1
- package/web/assets/safe-mode-sentinel-CVhmZl77.js +0 -1
- package/web/assets/select-DD_WO-gs.js +0 -1
- package/web/assets/send-QxBfLFo-.js +0 -1
- package/web/assets/session-list-BeyOEzyU.js +0 -1
- package/web/assets/side-chat-context-C2SzUmd5.js +0 -7
- package/web/assets/slider-DTmAZl-R.js +0 -1
- package/web/assets/tool-labels-ghvpPFmc.js +0 -1
- package/web/assets/workflow-messages-Cj35aJZc.js +0 -1
- package/web/memory-galaxy-background.webp +0 -0
|
@@ -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-YQ8mc9k7.js";import{t as o}from"./use-i18n-DCxQRXLH.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./braces-DQcXLGFF.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{r as d}from"./dist-V8chnW6-.js";import{i as f}from"./focus-session-composer-bits-D2XiGLcj.js";import{t as p}from"./search-D0mqDaf_.js";import{i as m,t as h}from"./dist-41X0pdUs.js";import{c as g,n as _}from"./dist-BsRXXcSL.js";import{a as v,o as y,r as b,t as x}from"./dist-BHkR6BLP.js";import{i as S,n as C,t as w}from"./popover-CXB2yzW6.js";import{t as T}from"./slider-DTmAZl-R.js";import{t as E}from"./utils-C8uzG5AZ.js";import{n as D,o as O,r as k,t as A}from"./sheet-BTaIEX4w.js";import{r as j}from"./format-DMJQzoZ7.js";import{i as M}from"./run-activity-CwfO0cui.js";import"./dialog-DFcH7POi.js";import{n as N,t as P}from"./input-group-h8z63MzW.js";import{t as F}from"./model-display-kDwvtxrW.js";var I=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`}]]),L=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`}]]),R=e(t(),1);function ee(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function z(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 te({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[...z(`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),...z(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...z(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?z(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:m(e),current:e===p})),h):[]]}function ne(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 re=10485760,ie=20971520,ae=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),oe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),se=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),ce=[`image/*`,`text/*`,`application/json`,...[...oe,...ae,...se].map(e=>`.${e}`)].join(`,`);function le(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function ue(e){return[...e?.types||[]].includes(`Files`)}function de(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 fe(e){return e.toLowerCase().split(`.`).at(-1)||``}async function pe(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>re)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=fe(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/`)||oe.has(n))r.push({...i,kind:`image`,data:await de(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||ae.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(se.has(n))r.push({...i,kind:`document`,extension:n,data:await de(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function me(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function he(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:me(e),path:e}))}function ge(e=[],t,n){let r=(0,R.useCallback)((e,t)=>i(e,a(),t),[]),[o,s]=(0,R.useState)(()=>[...e]),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)([]),f=(0,R.useRef)(new Map),p=(0,R.useRef)(0),m=(0,R.useRef)(n);m.current=n,(0,R.useEffect)(()=>{let e=f.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let h=(0,R.useRef)([...e]),g=(0,R.useCallback)(e=>{h.current=e,s(e),t?.(e)},[t]),_=(0,R.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 pe([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)>ie)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,R.useCallback)(e=>{let t=le(e.clipboardData);t.length&&(e.preventDefault(),_(t))},[_]),dropFiles:(0,R.useCallback)(e=>{if(!ue(e.dataTransfer))return;e.preventDefault();let t=le(e.dataTransfer);t.length&&_(t)},[_]),removeAttachment:(0,R.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,R.useCallback)(()=>{for(let e of f.current.values())e.cancelled=!0;f.current.clear(),d([]),g([])},[g]),addAttachments:(0,R.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,R.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var _e=`new-task`,B=new Map,V=new Map;function ve(e,t){let n=t.match(/^\/[^\s]*(?:\s+([\s\S]*))?$/),r=(n?n[1]||``:t).trim();return`${e}${r?` ${r}`:` `}`}function ye(e){return{text:e?.text||``,attachments:[...e?.attachments||[]]}}function H(e){return ye(B.get(e))}function U(e,t){if(!e)return;let n={...H(e),...t};n.attachments=[...n.attachments];let r=H(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&V.set(e,(V.get(e)||0)+1),B.delete(e),!(!n.text&&!n.attachments.length)&&B.set(e,n))}function be(e){V.set(e,(V.get(e)||0)+1),B.delete(e)}function xe(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 Se(e){let t=(0,R.useRef)(e);t.current=e;let n=(0,R.useRef)(!0);(0,R.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,R.useRef)(H(e)),[i,a]=(0,R.useState)(r.current.text),o=(0,R.useCallback)(t=>U(e,{attachments:t}),[e]),s=ge(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,R.useEffect)(()=>{let t=H(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,R.useCallback)(t=>{a(t),U(e,{text:t})},[e]),selection:s,clearDraft:(0,R.useCallback)(()=>{let r=H(e);r.text!==i||r.attachments.length!==s.attachments.length||r.attachments.some((e,t)=>e!==s.attachments[t])||(be(e),!(!n.current||t.current!==e)&&(a(``),l()))},[l,s.attachments,e,i]),restoreDraft:(0,R.useCallback)(r=>{let i=xe(H(e),r);return U(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,R.useCallback)(()=>{let r=H(e),i=V.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=H(e),l={text:(V.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};U(e,l),!(!n.current||t.current!==e)&&(a(l.text),c(l.attachments))}}},[c,e])}}var Ce=e(n(),1);function we({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 W=r();function Te({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,R.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,R.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=we({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,Ce.createPortal)((0,W.jsx)(`div`,{ref:n,id:s,className:c,style:{position:`fixed`,zIndex:65},role:l,"aria-label":u,children:f}),document.body):null}function Ee({resourceKey:e,loadCommands:t,builtinCommands:n=[],value:r,onChange:i,inputRef:a,placement:s=`top`}){let{t:u,language:d}=o(),f=(0,R.useId)(),p=(0,R.useRef)(null),m=r.match(/^\/([^\n]{0,120})$/),[h,g]=(0,R.useState)(``),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(0),T=m?.[1]||``,E=/\s/.test(T),D=(0,R.useRef)(t);D.current=t;let O=(0,R.useMemo)(()=>ne(n,T,d),[n,d,T]),k=!!(m&&h!==r&&(!E||O.length));(0,R.useEffect)(()=>{g(``),v(null),S(!1)},[e]),(0,R.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,R.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,R.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=ve(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,R.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,R.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:u(`chat:commands.scope.user`),project:u(`chat:commands.scope.project`),package:u(`chat:commands.scope.package`),custom:u(`chat:commands.scope.custom`)};return(0,W.jsx)(Te,{open:k,anchorRef:a,menuRef:p,placement:s,matchAnchorWidth:!0,maxHeight:330,id:f,role:`listbox`,ariaLabel:u(`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,W.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?l:L:e.command.source===`prompt`?I:c,i=e.kind===`resource`?e.command:null;return(0,W.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,W.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,W.jsx)(r,{size:15})}),(0,W.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,W.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,W.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,W.jsx)(`small`,{children:n.description||u(`chat:commands.noDescription`)})]}),(0,W.jsx)(`em`,{children:i?(0,W.jsxs)(W.Fragment,{children:[i.source===`prompt`?u(`chat:commands.prompt`):u(`chat:commands.skill`),` · `,N[i.scope]]}):e.kind===`builtin`&&e.command.current?u(`chat:commands.builtin.current`):u(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!A.length&&(0,W.jsx)(`p`,{children:u(y?`chat:commands.loading`:x?`chat:commands.loadError`:`chat:commands.empty`)})]})})}function De({levels:e,value:t,labelFor:n,onCommit:r,disabled:i=!1,ariaLabel:a,title:o,trailing:s,className:c}){let[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(!1),p=(0,R.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,R.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,W.jsxs)(`div`,{className:E(`min-w-0`,c),children:[(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 px-0.5 pb-1`,children:[o&&(0,W.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:o}),(0,W.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate text-[13px] leading-5 font-medium text-accent-fg`,"aria-live":`polite`,children:g}),s]})]}),(0,W.jsx)(T,{className:E(`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,W.jsxs)(`div`,{className:`flex justify-between px-0.5 pt-0.5 text-xs text-content-faint`,"aria-hidden":`true`,children:[(0,W.jsx)(`span`,{children:n(e[0])}),(0,W.jsx)(`span`,{children:n(e.at(-1)||``)})]})]})}var Oe=96,ke=.6,Ae=`10%`;function je({onDismiss:e,className:t}){let n=(0,R.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 + ${Ae})`);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>=Oe||t.offset>24&&i>=ke){o(t);return}r(t)},c=()=>{let e=n.current;n.current=null,e&&r(e)};return(0,W.jsx)(`div`,{"aria-hidden":`true`,"data-sheet-drag-handle":!0,className:E(`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,W.jsx)(`span`,{className:`mt-2.5 h-1 w-9 rounded-full bg-stroke-strong`})})}function Me({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,R.useState)(!1),p=i??d,m=e=>{i===void 0&&f(e),a?.(e)};return e?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(h,{"aria-haspopup":`dialog`,"aria-expanded":p,onClick:()=>m(!0),children:n}),(0,W.jsx)(A,{open:p,onOpenChange:m,children:(0,W.jsxs)(D,{side:`bottom`,showCloseButton:!1,"data-popover-sheet":!0,className:E(`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,W.jsx)(je,{onDismiss:()=>m(!1)}),(0,W.jsx)(O,{className:`px-2 pt-1 pb-1 text-base font-semibold`,children:t}),(0,W.jsx)(k,{className:`sr-only`,children:t}),r]})})]}):(0,W.jsxs)(w,{open:p,onOpenChange:m,children:[(0,W.jsx)(S,{asChild:!0,children:n}),(0,W.jsx)(C,{align:o,side:s,sideOffset:c,className:l,children:r})]})}var Ne=1,Pe=.9,Fe=.8,Ie=.17,Le=.1,Re=.999,ze=.9999,Be=.99,Ve=/[\\\/_+.#"@\[\(\{&]/,He=/[\\\/_+.#"@\[\(\{&]/g,Ue=/[\s-]/,We=/[\s-]/g;function Ge(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ne:Be;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=Ge(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ne:Ve.test(e.charAt(l-1))?(d*=Fe,p=e.slice(i,l-1).match(He),p&&i>0&&(d*=Re**+p.length)):Ue.test(e.charAt(l-1))?(d*=Pe,m=e.slice(i,l-1).match(We),m&&i>0&&(d*=Re**+m.length)):(d*=Ie,i>0&&(d*=Re**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ze)),(d<Le&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Ge(e,t,n,r,l+1,a+2,o),f*Le>d&&(d=f*Le)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ke(e){return e.toLowerCase().replace(We,` `)}function qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Ge(e,t,Ke(e),Ke(t),0,0,{})}var G=`[cmdk-group=""]`,Je=`[cmdk-group-items=""]`,Ye=`[cmdk-group-heading=""]`,Xe=`[cmdk-item=""]`,Ze=`${Xe}:not([aria-disabled="true"])`,Qe=`cmdk-item-select`,K=`data-value`,$e=(e,t,n)=>qe(e,t,n),et=R.createContext(void 0),q=()=>R.useContext(et),tt=R.createContext(void 0),nt=()=>R.useContext(tt),rt=R.createContext(void 0),it=R.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=ht(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:v=!0,...y}=e,b=_(),x=_(),S=_(),C=R.useRef(null),w=_t();Y(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),Y(()=>{w(6,j)},[]);let T=R.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(S);e?e.focus():(i=document.getElementById(b))==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=R.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:b,inputId:S,labelId:x,listInnerRef:C}),[]);function D(e,t){let r=s.current?.filter??$e;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(Je);t?t.appendChild(e.parentElement===t?e:e.closest(`${Je} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Je} > *`))}),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(Ye))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${Xe}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(Ze)||[])}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 I(e){let t=M()?.closest(G),n;for(;t&&!n;)t=e>0?pt(t,G):mt(t,G),n=t?.querySelector(Ze);n?T.setState(`value`,n.getAttribute(K)):F(e)}let L=()=>P(N().length-1),ee=e=>{e.preventDefault(),e.metaKey?L():e.altKey?I(1):F(1)},z=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?I(-1):F(-1)};return R.createElement(g.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&ee(e);break;case`ArrowDown`:ee(e);break;case`p`:case`k`:v&&e.ctrlKey&&z(e);break;case`ArrowUp`:z(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),L();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(Qe);t.dispatchEvent(e)}}}}},R.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:yt},c),Q(e,e=>R.createElement(tt.Provider,{value:T},R.createElement(et.Provider,{value:E},e))))}),at=R.forwardRef((e,t)=>{let n=_(),r=R.useRef(null),i=R.useContext(rt),a=q(),o=ht(e),s=o.current?.forceMount??i?.forceMount;Y(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=gt(n,r,[e.value,e.children,r],e.keywords),l=nt(),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);R.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Qe,f),()=>t.removeEventListener(Qe,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:h,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return R.createElement(g.div,{ref:m(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:p,onClick:h?void 0:f},e.children)}),ot=R.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=_(),s=R.useRef(null),c=R.useRef(null),l=_(),u=q(),d=Z(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Y(()=>u.group(o),[]),gt(o,s,[e.value,e.heading,c]);let f=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(g.div,{ref:m(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&R.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Q(e,e=>R.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},R.createElement(rt.Provider,{value:f},e))))}),st=R.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=R.useRef(null),a=Z(e=>!e.search);return!n&&!a?null:R.createElement(g.div,{ref:m(i,t),...r,"cmdk-separator":``,role:`separator`})}),ct=R.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=nt(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=q();return R.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),R.createElement(g.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)}})}),lt=R.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=R.useRef(null),o=R.useRef(null),s=Z(e=>e.selectedItemId),c=q();return R.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)}}},[]),R.createElement(g.div,{ref:m(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Q(e,e=>R.createElement(`div`,{ref:m(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ut=R.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return R.createElement(x,{open:n,onOpenChange:r},R.createElement(y,{container:o},R.createElement(v,{"cmdk-overlay":``,className:i}),R.createElement(b,{"aria-label":e.label,"cmdk-dialog":``,className:a},R.createElement(it,{ref:t,...s}))))}),dt=R.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?R.createElement(g.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ft=R.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return R.createElement(g.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>R.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(it,{List:lt,Item:at,Input:ct,Group:ot,Separator:st,Dialog:ut,Empty:dt,Loading:ft});function pt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function mt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ht(e){let t=R.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?R.useEffect:R.useLayoutEffect;function X(e){let t=R.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=nt(),n=()=>e(t.snapshot());return R.useSyncExternalStore(t.subscribe,n,n)}function gt(e,t,n,r=[]){let i=R.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 _t=()=>{let[e,t]=R.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 vt(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&&R.isValidElement(t)?R.cloneElement(vt(t),{ref:t.ref},n(t.props.children)):n(t)}var yt={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function bt({className:e,...t}){return(0,W.jsx)(J,{"data-slot":`command`,className:E(`flex size-full flex-col overflow-hidden rounded-md! bg-popover p-1 text-popover-foreground`,e),...t})}function xt({className:e,...t}){return(0,W.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,W.jsxs)(P,{className:`h-8! rounded-sm! border-stroke bg-surface-subtle shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,W.jsx)(J.Input,{"data-slot":`command-input`,className:E(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,W.jsx)(N,{children:(0,W.jsx)(p,{className:`size-4 shrink-0 opacity-50`})})]})})}function St({className:e,...t}){return(0,W.jsx)(J.List,{"data-slot":`command-list`,className:E(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function Ct({className:e,...t}){return(0,W.jsx)(J.Empty,{"data-slot":`command-empty`,className:E(`py-6 text-center text-sm`,e),...t})}function wt({className:e,...t}){return(0,W.jsx)(J.Group,{"data-slot":`command-group`,className:E(`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 Tt({className:e,children:t,...n}){return(0,W.jsxs)(J.Item,{"data-slot":`command-item`,className:E(`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,W.jsx)(l,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function Et(e,t){let n=t.find(t=>t.key===e);return n?`${n.providerName} · ${n.label}`:e.split(`/`).at(-1)||e}function Dt({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?Et(e,t||[]):`—`],[i(`chat:focusSession.statContextTokens`),f==null?`—`:`${j(f)} / ${j(r?.contextWindow)}`],[i(`chat:focusSession.statInputTokens`),j(n?.input)],[i(`chat:focusSession.statOutputTokens`),j(n?.output)],[i(`chat:focusSession.statCacheReadTokens`),p?j(n?.cacheRead):`—`],[i(`chat:focusSession.statCacheWriteTokens`),p?j(n?.cacheWrite):`—`],[i(`chat:focusSession.statReasoningTokens`),j(n?.reasoning)],[i(`chat:focusSession.statProcessedTokens`),j(n?.processedTokens)],[i(`chat:focusSession.statRequests`),String(Math.max(0,Number(n?.requests)||0))],[i(`chat:focusSession.statAvgFirstToken`),u==null?`—`:M(u,a)],[i(`chat:focusSession.statAvgDuration`),d==null?`—`:M(d,a)]];return(0,W.jsxs)(`div`,{className:`session-stats-panel grid gap-[3px]`,"aria-label":i(`chat:focusSession.sessionStats`),children:[m.map(([e,t])=>(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-[10px] text-[length:var(--app-small-size)]`,children:[(0,W.jsx)(`span`,{className:`min-w-0 shrink-0 text-[var(--text-muted)]`,children:e}),(0,W.jsx)(`strong`,{className:`min-w-0 truncate text-right font-[500] text-[var(--text)] [font-variant-numeric:tabular-nums]`,children:t})]},e)),(0,W.jsx)(`small`,{className:`text-[var(--text-secondary)] text-[length:var(--app-small-size)] leading-normal`,children:i(`chat:focusSession.sessionStatsHint`)})]})}function Ot({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,[d,f]=(0,R.useState)(l),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(``),_=(0,R.useRef)(l),v=(0,R.useRef)(void 0);(0,R.useEffect)(()=>{window.clearTimeout(v.current),f(l),_.current=l},[l]),(0,R.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?`—`:j(e.tokens)} / ${j(s)}${y==null?``:` · ${Math.round(y)}%`}`:``,w=e?.autoCompactEnabled&&e.compactionCapacityPercent!=null?a(`chat:focusSession.contextUsageToCompactionTokensPercent`,{percent:Math.round(Number(e.compactionCapacityPercent)),tokens:j(e.remainingBeforeCompaction)}):``,E=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)}}},D=e=>{window.clearTimeout(v.current),f(e),v.current=window.setTimeout(()=>void E(e),250)},O=e=>{window.clearTimeout(v.current),E(e)},k=(e,t,n,r)=>(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-usage-row":n,title:r,children:[(0,W.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:e}),(0,W.jsx)(`strong`,{className:`min-w-0 truncate text-right font-medium text-content tabular-nums`,children:t})]});return(0,W.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,W.jsxs)(`div`,{className:`grid gap-1`,children:[k(a(`board:composer.contextUsage`),C,`context`),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`block h-[3px] overflow-hidden rounded-full bg-surface-active`,children:(0,W.jsx)(`span`,{className:`block h-full rounded-full bg-content-secondary`,style:{width:`${Math.min(100,y||0)}%`}})})]}),b>0&&k(a(`board:composer.sessionTokens`),a(`board:composer.tokens`,{tokens:j(b)}),`tokens`),k(a(`board:composer.cacheHitLabel`),S?`${Math.round(Math.max(0,x))}%`:`—`,`cache`,S?void 0:a(`chat:focusSession.cacheHitRateUnavailable`)),s>0&&(0,W.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,W.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,W.jsx)(u,{size:13,"aria-hidden":`true`,className:`transition-transform duration-(--d-fast) group-open/usage:rotate-90`}),a(`chat:focusSession.sessionStats`)]}),(0,W.jsxs)(`div`,{className:`grid gap-2 pt-1.5`,children:[(0,W.jsx)(Dt,{model:n,availableModels:r,sessionUsage:t,contextUsage:e}),w&&(0,W.jsx)(`small`,{className:`text-content-muted`,children:w}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between font-medium text-content`,children:[(0,W.jsx)(`span`,{children:a(`chat:focusSession.autoCompactionThreshold`)}),(0,W.jsxs)(`output`,{className:`tabular-nums`,children:[d,`%`]})]}),(0,W.jsx)(T,{min:10,max:95,step:1,value:[d],className:`h-5 w-full`,"aria-label":a(`chat:focusSession.autoCompactionThreshold`),valueText:`${d}%`,disabled:p,onValueChange:([e])=>D(e),onValueCommit:([e])=>O(e)}),(0,W.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 kt({model:e,models:t,onModelChange:n,thinkingLevel:r,levels:i,status:a,message:s,onThinkingChange:c,modelDisabled:l,thinkingDisabled:u,deferred:p=!1,pendingModel:m=!1,usage:h,sheet:g=!1,side:_=`top`,thinkingIsDefault:v=!1,onThinkingReset:y,triggerClassName:b}){let{t:x}=o(),[S,C]=(0,R.useState)(!1),w=t.find(t=>t.key===e),T=t.map(e=>e.label),D=w?.label||e.split(`/`).at(-1)||``,O=D?F(D,T):x(`chat:focusSession.toolbarModel`),k=[...t.reduce((e,t)=>{let n=e.get(t.providerName)||[];return n.push(t),e.set(t.providerName,n)},new Map)],A=a!==`unsupported`&&i.length>0,j=A?$(x,r||i[0]):`—`,M=m?x(`chat:focusSession.thinkingAfterModelSwitch`):A?j:s||x(a===`unsupported`?`chat:focusSession.thinkingLevelUnsupported`:`chat:focusSession.loadingThinkingLevels`),N=u||S||!A||i.length<2,P=`${x(`chat:focusSession.modelAndThinking`)} · ${Et(e,t)} · ${M}`;return(0,W.jsxs)(Me,{sheet:g,title:x(`chat:focusSession.modelAndThinking`),align:`end`,side:_,sideOffset:8,className:`model-effort-popover w-[272px] max-w-[calc(100vw_-_24px)] gap-0 p-1`,trigger:(0,W.jsxs)(`button`,{type:`button`,className:E(`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`,f,b),"aria-label":P,title:P,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium max-[650px]:hidden`,children:O}),(0,W.jsx)(`span`,{className:`hidden font-medium whitespace-nowrap max-[650px]:inline`,children:x(`chat:focusSession.modelChipShort`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint max-[650px]:hidden`,children:`·`}),(0,W.jsx)(`span`,{className:`shrink-0 text-content-muted max-[650px]:hidden`,children:A?$(x,r||i[0]):`—`}),(0,W.jsx)(d,{size:14,className:`shrink-0 text-content-muted max-[650px]:hidden`,"aria-hidden":`true`})]}),children:[(0,W.jsxs)(`div`,{className:`model-effort-model flex flex-col gap-1 p-1.5 pb-2`,children:[(0,W.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-content-muted`,children:x(`chat:focusSession.toolbarModel`)}),(0,W.jsxs)(bt,{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":x(`chat:focusSession.currentChatModel`),children:[t.length>6&&(0,W.jsx)(xt,{placeholder:x(`chat:focusSession.searchModels`)}),(0,W.jsxs)(St,{className:`max-h-56`,children:[(0,W.jsx)(Ct,{className:`py-4 text-xs text-content-muted`,children:t.length?x(`chat:focusSession.noMatchingModels`):x(`chat:focusSession.noModelsAvailable`)}),!w&&e&&(0,W.jsx)(wt,{children:(0,W.jsx)(Tt,{value:e,"data-checked":!0,disabled:!0,children:(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:O})})}),k.map(([t,r])=>(0,W.jsx)(wt,{heading:t,children:r.map(t=>{let r=F(t.label,T);return(0,W.jsx)(Tt,{value:t.key,keywords:[t.label,t.providerName],"data-checked":t.key===e,disabled:l||S,onSelect:()=>{t.key!==e&&n(t.key)},children:(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-col`,title:t.label,children:[(0,W.jsx)(`span`,{className:`wrap-anywhere`,children:r}),r!==t.label&&(0,W.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:t.label})]})},t.key)})},t))]})]})]}),A&&(0,W.jsx)(De,{className:`border-t border-stroke-soft p-1.5 pt-2`,title:x(`chat:focusSession.thinkingLevelTitle`),levels:i,value:r,labelFor:e=>$(x,e),onCommit:async e=>{C(!0);try{await c(e)}finally{C(!1)}},disabled:N,ariaLabel:x(`chat:focusSession.currentThinkingLevel`),trailing:v?(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-content-faint`,children:x(`chat:focusSession.thinkingModelDefault`)}):y?(0,W.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:y,children:x(`chat:focusSession.thinkingReset`)}):void 0}),p&&(0,W.jsx)(`p`,{className:`px-2 pt-1 pb-2 text-xs leading-4 text-content-muted`,role:`status`,children:x(`chat:focusSession.runtimeSelectionDeferred`)}),(!A||i.length===1)&&(0,W.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:A?x(`chat:focusSession.thinkingLevelFixed`,{level:j}):M}),h]})}export{je as a,be as c,ce as d,ue as f,I as g,ee as h,Me as i,ve as l,te as m,kt as n,Ee as o,he as p,$ as r,_e as s,Ot as t,Se as u};
|
|
@@ -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-DCxQRXLH.js";import{t as i}from"./api-BmSvZCuH.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./check-2vYc6QaP.js";import{t as s}from"./file-code-corner-BnE1ljT0.js";import{t as c}from"./info-DATxy0fb.js";import{t as l}from"./pencil-U08v_vV9.js";import{t as u}from"./plus-fQbSqB1n.js";import{t as d}from"./refresh-cw-TbWxTY4K.js";import{t as f}from"./sparkles-S_eeuqn9.js";import{t as p}from"./trash-2-CNrPOoPR.js";import{t as m}from"./x-07u4-129.js";import{t as h}from"./more-pages-D_PnxLN0.js";import{i as ee,n as g,t as te}from"./tooltip-D4MFbqcG.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as _,t as v}from"./button-CCcCN8tE.js";import{s as y}from"./shortcuts-DnykOp5e.js";import{t as b}from"./input-CPw-zkYh.js";import{t as x}from"./textarea-DmATpOqT.js";import{n as S,r as re,t as ie}from"./PageState-Cz6vFMXv.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./FeaturePage-DGauTCbU.js";import{n as C}from"./field-DoLEb0np.js";import{t as w}from"./AppSelect-BD6RAaJ5.js";import{c as fe,i as pe,n as T,t as me}from"./app-primitives-Drz_SjnR.js";var E=a(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),D=a(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),O=e(t(),1);function he(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(()=>!document.hidden),[s,c]=(0,O.useState)(!0),l=(0,O.useCallback)(e=>{i(e)},[]);return(0,O.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,O.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var k=n(),A={width:600,height:420,cx:300,cy:206},ge=24,_e=Math.PI*(3-Math.sqrt(5));function ve({type:e}){return(0,k.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:j[e]}})}var j={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},ye={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function M(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function N(e,t){let n=e.slice(0,ge);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:A.cx,y:A.cy,twinkle:0}];let r=M(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=M(e.id),a=t*_e+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:A.cx+Math.cos(a)*o*1.38,y:A.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function P(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function be({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,O.useState)(1),[f,p]=(0,O.useState)(``),m=(0,O.useRef)(null),h=(0,O.useRef)(0),{ref:ee,playing:g}=he(),te=(0,O.useCallback)(e=>{m.current=e,ee(e)},[ee]),ne=g?``:`[&:before]:[animation-play-state:paused]! [&:after]:[animation-play-state:paused]! [&_*]:[animation-play-state:paused]! [&_*:before]:[animation-play-state:paused]! [&_*:after]:[animation-play-state:paused]!`,_=e=>{if(!g)return;let t=m.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},v=()=>{cancelAnimationFrame(h.current),m.current?.style.setProperty(`--px`,`0`),m.current?.style.setProperty(`--py`,`0`)};(0,O.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,O.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,O.useMemo)(()=>N(e,n),[e,n]),b=(0,O.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),x=(0,O.useMemo)(()=>{let e=new Set(y.map(e=>e.node.id));return t.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[y,t]),S=f||i,ie=new Set(t.flatMap(e=>e.sourceId===S?[e.targetId]:e.targetId===S?[e.sourceId]:[]));return(0,k.jsxs)(me,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel ${ne}`,onPointerMove:_,onPointerLeave:v,children:[(0,k.jsxs)(`div`,{className:`graph-toolbar absolute top-2.5 left-2.5 z-[4] flex gap-0.5 rounded-sm border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] p-0.5 text-[var(--galaxy-toolbar-text)] [&_button]:grid [&_button]:size-7 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:transition-colors [&_button]:duration-(--d-fast) [&_button:hover]:bg-[var(--galaxy-toolbar-hover)] max-[650px]:[&_button]:size-11 [&_svg]:size-3.5`,children:[(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,k.jsx)(u,{})}),(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomIn`),"aria-label":c(`memory:memoryPage.zoomIn`),onClick:()=>d(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,k.jsx)(D,{})}),(0,k.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomOut`),"aria-label":c(`memory:memoryPage.zoomOut`),onClick:()=>d(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,k.jsx)(E,{})})]}),(0,k.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${S?`has-focus`:``}`,ref:te,style:{transform:`scale(${l})`},children:[(0,k.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,k.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,k.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,k.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,k.jsx)(`defs`,{children:x.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,k.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,k.jsx)(`stop`,{offset:`0`,stopColor:j[n.node.type]||`var(--galaxy-line-active)`}),(0,k.jsx)(`stop`,{offset:`1`,stopColor:j[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),x.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===S||e.targetId===S,a=P(n,r,M(e.id));return(0,k.jsxs)(`g`,{children:[(0,k.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,k.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,k.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,k.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),y.map(({node:e,x:t,y:n,twinkle:r},a)=>(0,k.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${i===e.id?`active`:``} ${S&&e.id!==S&&!ie.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,"aria-pressed":i===e.id,onClick:()=>o(e.id),onMouseEnter:()=>p(e.id),onMouseLeave:()=>p(``),style:{left:`${t/A.width*100}%`,top:`${n/A.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":M(e.id)%100/100,"--g-star-color":j[e.type],"--g-star-glow":ye[e.type]},title:e.content,children:[i===e.id&&(0,k.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),i===e.id&&(0,k.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,k.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,k.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,k.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,k.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,k.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!y.length&&(0,k.jsxs)(`span`,{className:`pointer-events-none absolute right-3 bottom-2.5 z-[3] rounded-xs border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] px-2 text-xs leading-5 text-[var(--galaxy-label)] tabular-nums`,children:[`✦`,` `,c(`memory:memoryPage.visibleTotalMemories`,{visible:y.length,total:e.length})]}),!a&&!y.length&&(0,k.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,k.jsx)(re,{size:44}),(0,k.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var xe=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],F=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,I=`modal grid max-h-[calc(100dvh_-_40px)] w-[min(430px,100%)] gap-0.5 overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,L=`key-value flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`;function Se(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function Ce(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function R(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function z(e){return e instanceof Error?e.message:String(e)}function we({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,re]=(0,O.useState)(``),{t:C,language:w}=r(),[T,me]=(0,O.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[E,D]=(0,O.useState)(``),[he,A]=(0,O.useState)(``),[ge,_e]=(0,O.useState)(``),[j,ye]=(0,O.useState)(`galaxy`),M=(0,O.useRef)(null),N=(0,O.useRef)(0),[P,F]=(0,O.useState)(!0),[I,we]=(0,O.useState)(!1),[De,B]=(0,O.useState)(``),[V,H]=(0,O.useState)(null),[Oe,U]=(0,O.useState)(null),[W,G]=(0,O.useState)(``),[K,ke]=(0,O.useState)(null),[Ae,q]=(0,O.useState)(``),[je,Me]=(0,O.useState)(`load`),[Ne,Pe]=(0,O.useState)(!0),J=(0,O.useRef)(null),Y=(0,O.useRef)(0),Fe=(0,O.useRef)(0),Ie=(0,O.useRef)(0),Le=(0,O.useRef)(null),X=(0,O.useRef)(null),Re=(0,O.useRef)(!1),Z=(0,O.useRef)(null),Q=(0,O.useRef)(!0),[ze,Be]=(0,O.useState)(!1),$=(0,O.useCallback)(async(e=``)=>{let t=++N.current;F(!0),B(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),x.trim()&&n.set(`query`,x.trim());let r=await i(`/api/memory?${n}`);if(t!==N.current)return;me(r),we(!0),D(r.selectedSpaceId||``),A(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===N.current&&B(z(e))}finally{t===N.current&&F(!1)}},[x]);(0,O.useEffect)(()=>($(E),()=>{N.current+=1}),[$,E]);let Ve=(0,O.useCallback)(async()=>{Le.current?.abort();let e=new AbortController;Le.current=e;let t=++Fe.current,n=Y.current,r=n===Ie.current;Pe(!0),q(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Q.current||t!==Fe.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(C(`memory:memoryPage.invalidAutoApproveThreshold`));r&&Y.current===n&&(J.current=o,ke(String(o)))}catch(n){!e.signal.aborted&&Q.current&&t===Fe.current&&(Me(`load`),q(z(n)))}finally{!e.signal.aborted&&Q.current&&t===Fe.current&&Pe(!1)}},[C]);(0,O.useEffect)(()=>(Q.current=!0,Ve(),()=>{Q.current=!1,Le.current?.abort(),X.current?.abort(),Z.current=null}),[Ve]);let He=async()=>{if(K===null||!K.trim()||J.current===null)return;let t=Number(K);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!X.current&&!Re.current&&n===J.current){Z.current=null,Ie.current=Y.current,ke(String(n)),q(``);return}if(Z.current={value:n,revision:Y.current},X.current)return;let r=new AbortController;X.current=r,Be(!0),q(``);try{for(;Z.current&&Q.current&&!r.signal.aborted;){let t=Z.current;if(Z.current=null,t.value!==J.current||Re.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Q.current||r.signal.aborted)return;Z.current||=t,Re.current=!0,Me(`save`),q(z(e));return}if(!Q.current||r.signal.aborted)return;J.current=t.value,Re.current=!1}Ie.current=t.revision,Y.current===t.revision&&(ke(String(t.value)),Z.current||e(C(`memory:memoryPage.autoApproveSaved`)))}}finally{X.current===r&&(X.current=null,Q.current&&Be(!1))}},Ue=T.nodes.find(e=>e.id===he)||null,We=e=>{let t=new Set(T.links.flatMap(t=>t.sourceId===e?[t.targetId]:t.targetId===e?[t.sourceId]:[]));return{count:t.size,files:T.nodes.filter(n=>n.type===`file`&&(t.has(n.id)||n.id===e))}},Ge=T.spaces.find(e=>e.id===E),Ke=async t=>{if(await n({title:C(`memory:memoryPage.deleteMemory`),message:C(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(C(`memory:memoryPage.memoryDeleted`)),await $(E)}catch(e){B(z(e))}},qe=async(t,n)=>{if(!W){G(t.id),B(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(C(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await $(E)}catch(e){B(z(e))}finally{G(``)}}},Je=async()=>{if(!(W||!T.candidates?.length)){G(`__all__`),B(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(C(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await $(E)}catch(e){B(z(e))}finally{G(``)}}},Ye=async()=>{if(Ge&&await n({title:C(`memory:memoryPage.deleteMemorySpace`),message:C(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:R(Ge,C)}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent(Ge.id)}`,{method:`DELETE`}),D(``),A(``),e(C(`memory:memoryPage.memorySpaceDeleted`))}catch(e){B(z(e))}},Xe=C(`navigation:navigation.memory`),Ze=R(Ge,C),Qe=e=>{A(e),requestAnimationFrame(()=>M.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=We(e.id);return(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,k.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,k.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,k.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,k.jsxs)(`dl`,{children:[(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.memoryType`)}),(0,k.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,k.jsx)(ve,{type:e.type}),Se(e.type,C)]})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.source`)}),(0,k.jsx)(`dd`,{children:e.sourceType===`conversation_confirmed`?C(`memory:memoryPage.userConfirmedConversationCandidate`):e.sourceType===`user_confirmed`?C(`memory:memoryPage.explicitUserRequest`):e.sourceType===`agent`?C(`memory:memoryPage.createdByAgent`):C(`memory:memoryPage.addedManually`)})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.authority`)}),(0,k.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.evidence`)}),(0,k.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.created`)}),(0,k.jsx)(`dd`,{className:`tabular-nums`,children:Ce(e.createdAt,w)})]}),(0,k.jsxs)(`div`,{className:L,children:[(0,k.jsx)(`dt`,{children:C(`memory:memoryPage.relatedMemories`)}),(0,k.jsx)(`dd`,{className:`tabular-nums`,children:C(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,k.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>void Ke(e),children:[(0,k.jsx)(p,{}),C(`memory:memoryPage.delete`)]}),(0,k.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>H(e),children:[(0,k.jsx)(l,{}),C(`memory:memoryPage.edit`)]})]}),(0,k.jsxs)(`section`,{className:`min-w-0`,"aria-label":C(`memory:memoryPage.relatedFiles`),children:[(0,k.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[C(`memory:memoryPage.relatedFiles`),` · `,n.files.length]}),n.files.length?(0,k.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,k.jsxs)(`li`,{className:`file-row grid min-h-11 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 py-1`,children:[(0,k.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,k.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,k.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||C(`memory:memoryPage.localMemory`)})]}),(0,k.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,k.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>j===`galaxy`?A(t.id):_e(t.id),children:C(`memory:memoryPage.view`)}),(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>H(t),children:(0,k.jsx)(l,{})}),(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.delete`)}: ${t.title}`,onClick:()=>void Ke(t),children:(0,k.jsx)(p,{})})]})]},t.id))}):(0,k.jsx)(`p`,{className:`text-xs text-content-muted`,children:C(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,k.jsxs)(le,{title:Xe,description:C(`memory:memoryPage.lede`),back:t&&{label:C(`navigation:sidebar.features`),ariaLabel:C(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,k.jsx)(ue,{search:(0,k.jsx)(ae,{id:h,value:x,onValueChange:re,placeholder:C(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:C(`navigation:more.clearSearch`)}),actions:(0,k.jsxs)(v,{type:`button`,className:`h-9`,disabled:!I,onClick:()=>H({spaceId:E||T.selectedSpaceId}),children:[(0,k.jsx)(u,{}),C(`memory:memoryPage.addMemory`)]}),filters:(0,k.jsx)(fe,{options:[C(`memory:memoryPage.galaxyView`),C(`memory:memoryPage.listView`)],value:C(j===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>ye(e===C(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!I&&P?(0,k.jsx)(S,{kind:`loading`,title:C(`common:pageTemplate.loading`)}):I?(0,k.jsxs)(k.Fragment,{children:[De&&(0,k.jsx)(de,{children:De}),(0,k.jsx)(ce,{title:C(`memory:memoryPage.memorySpaces`),count:T.spaces.length,actions:(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>U({}),children:[(0,k.jsx)(u,{}),C(`memory:memoryPage.newMemorySpace`)]}),children:(0,k.jsx)(se,{children:T.spaces.map(e=>{let t=e.id===E;return(0,k.jsx)(oe,{"data-memory-space":e.id,"aria-current":t||void 0,className:ne(`relative`,t&&`after:absolute after:top-3.5 after:bottom-3.5 after:-left-3 after:w-[3px] after:rounded-r-[3px] after:bg-star max-[650px]:after:-left-2.5`),icon:(0,k.jsx)(f,{}),onOpen:()=>{D(e.id),A(``),_e(``)},name:R(e,C),status:C(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,k.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>U(e),children:[(0,k.jsx)(l,{}),C(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,k.jsx)(p,{}),C(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,k.jsx)(ce,{"data-memory-stars":!0,title:Ze||C(`memory:memoryPage.memorySpaces`),count:T.nodes.length,actions:(0,k.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:P,disabled:P,"aria-label":C(`memory:memoryPage.refresh`),title:C(`memory:memoryPage.refresh`),onClick:()=>void $(E),children:(0,k.jsx)(d,{})}),children:j===`galaxy`?(0,k.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,k.jsx)(be,{nodes:T.nodes,links:T.links,spaceId:E,selectedId:he,loading:P,onSelect:Qe,onAdd:()=>H({spaceId:E})}),(0,k.jsx)(`div`,{role:`group`,"aria-label":C(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:xe.map(e=>(0,k.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,k.jsx)(ve,{type:e}),Se(e,C)]},e))}),(0,k.jsx)(`div`,{ref:M,role:`region`,"data-memory-detail":!0,"aria-label":C(`memory:memoryPage.selectedMemory`),className:`min-w-0 scroll-mb-4 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:Ue?$e(Ue,!0):(0,k.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:C(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):T.nodes.length?(0,k.jsx)(se,{children:T.nodes.map(e=>(0,k.jsx)(oe,{"data-memory-node":e.id,icon:(0,k.jsx)(ve,{type:e.type}),name:e.title,nameMeta:Se(e.type,C),description:e.content,expanded:ge===e.id,onExpandedChange:t=>_e(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,k.jsx)(ie,{title:x.trim()?C(`memory:memoryPage.noMatchingMemories`):C(`memory:memoryPage.noMemoriesInSpace`)})}),(0,k.jsxs)(ce,{title:C(`memory:memoryPage.memoryDrafts`),count:T.candidates?.length||0,actions:!!T.candidates?.length&&(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,k.jsx)(m,{}),C(`memory:memoryPage.ignoreAll`)]}),children:[Ne&&(0,k.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,k.jsx)(_,{className:`size-3.5`}),C(`memory:memoryPage.loadingAutoApproveThreshold`)]}),Ae&&(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,k.jsxs)(pe,{className:`my-0`,children:[C(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,Ae]}),(0,k.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Ne||ze,onClick:()=>void(je===`save`?He():Ve()),children:C(`memory:memoryPage.retryAutoApproveThreshold`)})]}),K!==null&&(0,k.jsxs)(`div`,{className:`memory-auto-approve-row flex min-h-12 items-center justify-between gap-3 border-t border-stroke py-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,k.jsx)(`span`,{children:C(`memory:memoryPage.autoApproveThreshold`)}),(0,k.jsxs)(te,{children:[(0,k.jsx)(ee,{asChild:!0,children:(0,k.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,k.jsx)(g,{align:`center`,side:`top`,children:C(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,k.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,k.jsx)(b,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:K,"aria-busy":ze,"aria-label":C(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{Y.current+=1,ke(e.target.value)},onBlur:()=>void He(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),He())}}),`%`,ze&&(0,k.jsx)(_,{className:`size-3.5`})]})]}),T.candidates?.length?(0,k.jsx)(se,{children:T.candidates.map(e=>(0,k.jsx)(oe,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,k.jsxs)(`span`,{className:`truncate tabular-nums`,children:[R(T.spaces.find(t=>t.id===e.spaceId),C),` · `,e.sourceType===`agent`?C(`memory:memoryPage.agentProposed`):C(`memory:memoryPage.conversationExtracted`),` · `,C(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),actions:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,k.jsx)(o,{}),C(`memory:memoryPage.confirm`)]}),(0,k.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,k.jsx)(m,{}),C(`memory:memoryPage.ignore`)]})]}),detail:(0,k.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,k.jsxs)(`span`,{children:[C(`memory:memoryPage.topic`),`:`,(0,k.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,k.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[C(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,k.jsxs)(`span`,{className:`tabular-nums`,children:[C(`memory:memoryPage.created`),`:`,Ce(e.createdAt,w),e.expiresAt?` · ${C(`memory:memoryPage.expires`)}:${Ce(e.expiresAt,w)}`:``]})]})},e.id))}):(0,k.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:C(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,k.jsx)(S,{kind:`error`,title:C(`memory:memoryPage.loadFailed`),description:De,action:(0,k.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void $(E),children:C(`common:pageTemplate.retry`)})}),V&&(0,k.jsx)(Te,{spaces:T.spaces,node:V.id?V:null,initialSpaceId:V.spaceId||E,onClose:()=>H(null),onSaved:async t=>{H(null),e(t),await $(E)}}),Oe&&(0,k.jsx)(Ee,{space:Oe.id?Oe:null,onClose:()=>U(null),onSaved:async(t,n)=>{U(null),D(t.id),e(n)}})]})}function Te({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,O.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[d,f]=(0,O.useState)(!1),[p,h]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:F,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,k.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:I,onSubmit:async e=>{if(e.preventDefault(),!d){f(!0),h(``);try{await i(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(c)}),await o(s(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){h(z(e))}finally{f(!1)}}},children:[(0,k.jsxs)(T,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,k.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":s(`memory:memoryPage.closeDialog`),disabled:d,onClick:a,children:(0,k.jsx)(m,{})})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,k.jsx)(w,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,k.jsx)(`option`,{value:e.id,children:R(e,s)},e.id))})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,k.jsx)(b,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,k.jsx)(x,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,k.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,k.jsx)(w,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:xe.map(e=>(0,k.jsx)(`option`,{value:e,children:Se(e,s)},e))})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,k.jsxs)(w,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,k.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,k.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,k.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,k.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,k.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,k.jsx)(b,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,k.jsx)(pe,{children:p}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,k.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,k.jsx)(_,{className:`text-current`}):(0,k.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function Ee({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,O.useState)(e?.name||``),[c,l]=(0,O.useState)(!1),[d,f]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:F,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,k.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:I,onSubmit:async t=>{if(t.preventDefault(),!c){l(!0),f(``);try{await n(await i(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),a(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){f(z(e))}finally{l(!1)}}},children:[(0,k.jsxs)(T,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,k.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":a(`memory:memoryPage.closeDialog`),disabled:c,onClick:t,children:(0,k.jsx)(m,{})})]}),(0,k.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,k.jsx)(b,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,k.jsx)(pe,{children:d}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,k.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,k.jsx)(_,{className:`text-current`}):(0,k.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{we as MemoryPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-DCxQRXLH.js";import{t as a}from"./api-BmSvZCuH.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-C7hhcfZV.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{n as f,t as p}from"./send-QxBfLFo-.js";import{t as m}from"./play-DNDjDNGn.js";import{t as h}from"./plus-fQbSqB1n.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-DnykOp5e.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-DFcH7POi.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-CQS5pqM-.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-DGauTCbU.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-BD6RAaJ5.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:p}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,date:e.date||``,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function ge(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[m,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===m),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===m).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,m]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(h,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=m===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:p,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(m,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:p,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[m,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:m,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:m,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,m,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(h,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-CypHOHdP.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-DCxQRXLH.js","assets/i18n-YQ8mc9k7.js","assets/vendor-router-CSN_DGvx.js","assets/index-DjSjahBi.js","assets/index-DJA4qaOu.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-C7sXXop4.js","assets/esm-DCV8yILT.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-DCxQRXLH.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-CTtXyNjK.js";import{a as s}from"./permission-rules-api-D1Tbe4E9.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./SessionBrowserPane-DMTNqq-e.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-CypHOHdP.js";import{B as C,I as w,R as T,b as E,v as D,y as O}from"./side-chat-context-C2SzUmd5.js";import{t as k}from"./link-2-mgasYn21.js";import{t as A}from"./message-square-SKjZyY3v.js";import{t as j}from"./plus-fQbSqB1n.js";import{t as M}from"./refresh-cw-TbWxTY4K.js";import{t as N}from"./square-terminal-BVG6cUT1.js";import{t as P}from"./x-07u4-129.js";import{n as F,t as I}from"./button-CCcCN8tE.js";import{s as L}from"./events-C7sXXop4.js";import{a as ee,n as te,o as ne,t as re}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{t as V}from"./web-preview-B9ooQu6f.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-CypHOHdP.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=x(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:C,snapshotRevision:T,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:k,notice:A,viewDiff:j,runAction:N,refresh:P}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,U.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,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:P,children:(0,U.jsx)(M,{className:_?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void N({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void N({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(w,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(I,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),A&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:A}),_&&!h?(0,U.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=p.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:_||!!v,"aria-busy":C===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,U.jsx)(F,{className:`size-3.5`}):(0,U.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void N({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void N({kind:`revert`,path:t.path}),children:(0,U.jsx)(w,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:T}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void j(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(a,window.location.href);c(!t),t&&n(t)},children:[(0,U.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(I,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(I,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:w,plansAvailable:M,requestConfirm:F,onTabChange:R,onClose:z,onBack:V}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:N,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:k,label:W(`chat:workbench.sources`)},{id:`files`,icon:C,label:W(`chat:workbench.taskSnapshots`)},...M?[{id:`plan`,icon:T,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:A,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>O(g),[g]),J=D(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:j,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!D.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(L));let t=E(J,e);D.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&z()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(j,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[V&&(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:V,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(P,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),D.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(v,{sessionId:l,cwd:u,streaming:w,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>D.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(p,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{page:t,onChange:e=>Z({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:w,requestConfirm:F}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,U.jsx)(m,{plan:x,running:w}):(0,U.jsx)(B,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(re,{open:!0,onOpenChange:e=>!e&&z(),children:(0,U.jsxs)(te,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(ee,{className:`sr-only`,children:(0,U.jsx)(ne,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
|
|
@@ -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-DCxQRXLH.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-CTtXyNjK.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{a as c,i as l}from"./permission-rules-api-D1Tbe4E9.js";import{t as u}from"./bot-B3TaBp_T.js";import{t as d}from"./check-2vYc6QaP.js";import{a as f,c as p,i as m,l as h,n as g,o as _,r as v,t as ee}from"./SessionBrowserPane-DMTNqq-e.js";import{c as y}from"./focus-session-composer-bits-D2XiGLcj.js";import{t as te}from"./earth-Ddy13fHh.js";import{t as b}from"./ellipsis-CfGKfbq6.js";import{o as ne}from"./GitDiffViewer-CypHOHdP.js";import{B as x,I as re,R as ie,c as S,g as C,s as ae,v as w}from"./side-chat-context-C2SzUmd5.js";import{t as oe}from"./git-branch-N7LGjtzt.js";import{t as se}from"./message-square-SKjZyY3v.js";import{t as ce}from"./plus-fQbSqB1n.js";import{t as T}from"./refresh-cw-TbWxTY4K.js";import{t as le}from"./square-terminal-BVG6cUT1.js";import{t as ue}from"./wrench-6pg6_bqI.js";import{t as de}from"./x-07u4-129.js";import{c as E,i as D,p as fe,r as pe,t as O}from"./dropdown-menu-Ds0gD8S8.js";import{i as me,n as he,t as ge}from"./popover-CXB2yzW6.js";import{t as _e}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 ve}from"./chat-api-DHqVwcpJ.js";import{a as j,r as M}from"./format-DMJQzoZ7.js";import{t as N}from"./StatusGlyph-1KgitlUg.js";import{s as ye}from"./run-activity-CwfO0cui.js";import{t as be}from"./session-change-summary-api-DENj-A9c.js";import{n as P,t as F}from"./PageState-Cz6vFMXv.js";import{i as xe,n as I,r as Se}from"./MarkdownMessage-CuaozZah.js";import{t as L}from"./route-context-DvWDul4T.js";import"./web-preview-B9ooQu6f.js";import{n as Ce,r as R}from"./terminal-context-aIsIJPn8.js";var z=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`}]]),we=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`}]]),B=e(t(),1),V=n(),H=new Set([`queued`,`starting`,`running`]),Te=new Set([`starting`,`running`,`stopping`]);function U(e){return typeof e==`string`?e.trim():``}function W(e,t,n){let r=new Map;for(let i of e){if(i?.type!==t)continue;let e=n(i);e&&r.set(String(e.id||r.size),e)}return[...r.values()]}function Ee({startedAt:e}){let[t,n]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let r=ye(e,null,t);return r?(0,V.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted tabular-nums`,children:y(r)}):null}function De(e,t){let n=t?W(e,`tool`,e=>e).filter(e=>e.status===`running`):[],r=W(e,`agent`,e=>e.agent&&typeof e.agent==`object`?e.agent:null).filter(e=>H.has(String(e.status)));return n.length+r.length}function Oe({sessionId:e,streaming:t,activity:n}){let{t:i}=r(),a=R(e),o=[...t?W(n,`tool`,e=>e).filter(e=>e.status===`running`).map(e=>{let t=e.args||{};return{key:`tool:${String(e.id)}`,icon:(0,V.jsx)(ue,{size:14,"aria-hidden":`true`}),name:U(e.name)||i(`board:inspector.runningTool`),detail:U(t.command)||U(t.path)||U(t.file_path),startedAt:U(e.startedAt),status:i(`board:inspector.runningStatus`)}}):[],...W(n,`agent`,e=>e.agent&&typeof e.agent==`object`?e.agent:null).filter(e=>H.has(String(e.status))).map(e=>({key:`agent:${String(e.id)}`,icon:(0,V.jsx)(u,{size:14,"aria-hidden":`true`}),name:U(e.title)||U(e.taskName)||i(`board:inspector.runningAgent`),detail:U(e.message),startedAt:U(e.startedAt),status:e.status===`queued`?i(`board:inspector.runningQueued`):i(`board:inspector.runningStatus`)})),...a.filter(e=>Te.has(e.status)).map(e=>({key:`terminal:${e.id}`,icon:(0,V.jsx)(le,{size:14,"aria-hidden":`true`}),name:e.profileId||i(`board:inspector.terminal`),detail:e.cwd||``,status:e.status===`stopping`?i(`terminal:workspace.stopping`):i(`board:inspector.runningStatus`)}))];return(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-3`,"data-inspector-running":!0,children:[o.length?(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:o.map(e=>(0,V.jsxs)(`li`,{className:`grid min-w-0 grid-cols-[14px_minmax(0,1fr)_auto] items-start gap-2 py-1.5 text-xs`,"data-running-item":e.key.split(`:`)[0],children:[(0,V.jsx)(`span`,{className:`mt-0.5 text-content-secondary`,children:e.icon}),(0,V.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,V.jsx)(`strong`,{className:`truncate text-[13px] font-medium text-content`,children:e.name}),e.detail&&(0,V.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,title:e.detail,children:e.detail})]}),(0,V.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-content-muted`,children:e.status}),(0,V.jsx)(Ee,{startedAt:e.startedAt})]})]},e.key))}):(0,V.jsx)(F,{compact:!0,title:i(`board:inspector.runningEmpty`)}),(0,V.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-content-faint`,children:i(`board:inspector.runningHint`)})]})}var G={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 K(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 ke(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 q({title:e,children:t}){return(0,V.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,V.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function J({status:e,name:t,detail:n,t:r}){let i=G[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,V.jsx)(N,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,V.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,V.jsx)(`span`,{className:`flex-none text-content-muted`,children:K(e,r)})]}),n&&(0,V.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function Ae(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 je({plan:e,streaming:t,goal:n,team:i,activity:a}){let{t:o}=r(),s=Array.isArray(i?.tasks)?i.tasks:[],c=Ae(a),l=!!(n?.id&&String(n.objective||``).trim()),u=!!e?.items?.length;if(!l&&!u&&!s.length&&!c.length)return(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,V.jsx)(F,{compact:!0,icon:ie,title:o(`chat:sessionContext.planEmpty`)})});let d=Number(n?.mode===`team`?n?.teamTokenBudget:n?.tokenBudget)||0;return(0,V.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[l&&n&&(0,V.jsx)(q,{title:o(`board:inspector.goal`),children:(0,V.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,V.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(n.objective)}),(0,V.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,V.jsx)(`span`,{children:ke(n,o)}),(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,V.jsx)(`span`,{children:d>0?o(`chat:focusSession.usedBudgetTokensUsed`,{used:M(n.tokensUsed),budget:M(d)}):o(`chat:focusSession.usedUnlimitedGoalTokens`,{used:M(n.tokensUsed)})})]})]})}),u&&(0,V.jsx)(q,{title:o(`board:inspector.plan`),children:(0,V.jsx)(h,{plan:e,running:t})}),s.length>0&&(0,V.jsx)(q,{title:o(`board:inspector.team`),children:(0,V.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,V.jsx)(J,{status:e.status,name:e.taskName||o(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:o},e.id||`${e.taskName}-${t}`))})}),c.length>0&&(0,V.jsx)(q,{title:o(`board:inspector.subAgents`),children:(0,V.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:c.map((e,t)=>(0,V.jsx)(J,{status:e.status,name:String(e.taskName||``).trim()||o(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:o},String(e.id||t)))})})]})}var Y=100;function X(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 Me={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Z={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function Ne(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 Pe(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function Q(e,t){window.dispatchEvent(new CustomEvent(L,{detail:{message:e,tone:t}}))}function $({added:e,removed:t}){return e===null||t===null?null:(0,V.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,V.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Fe({status:e,children:t}){let{t:n}=r();return(0,V.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,V.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,V.jsxs)(O,{children:[(0,V.jsx)(fe,{asChild:!0,children:(0,V.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,V.jsx)(b,{"aria-hidden":`true`})})}),(0,V.jsx)(pe,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Ie({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,V.jsxs)(`span`,{className:k(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Z[e]),title:n,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,children:Me[e]}),(0,V.jsx)(`span`,{className:`sr-only`,children:n})]})}function Le({files:e,selected:t,label:n,onSelect:r}){let i=(0,B.useRef)(null);return(0,V.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,Y).map(e=>{let n=e.path===t,{directory:i,name:a}=Ne(e.path);return(0,V.jsx)(`li`,{className:`px-1`,children:(0,V.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Me[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,V.jsx)(Ie,{status:e.status}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,V.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,V.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,V.jsx)($,{added:e.added,removed:e.removed})]})},e.path)}),e.length>Y&&(0,V.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,V.jsx)(Re,{count:e.length-Y})})]})}function Re({count:e}){let{t}=r();return(0,V.jsx)(V.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var ze=600;function Be({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:c}=r(),u=l(e=>e.diffMode),d=l(e=>e.setDiffMode),f=(0,B.useRef)(null),[m,h]=(0,B.useState)(0);(0,B.useLayoutEffect)(()=>{let e=f.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>=ze,_=g?u:`unified`,v=g?void 0:c(`board:changes.splitTooNarrow`);return(0,V.jsxs)(`section`,{ref:f,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,V.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,V.jsx)(Ie,{status:t.status}),(0,V.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,V.jsx)($,{added:t.added,removed:t.removed}),(0,V.jsx)(_e,{size:`sm`,"aria-label":c(`board:changes.diffView`),title:v,"aria-description":v,value:_,onValueChange:d,options:[{value:`unified`,label:c(`board:changes.unified`)},{value:`split`,label:c(`board:changes.split`),disabled:!g}]})]}),(0,V.jsx)(p,{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,V.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 Ve({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=Pe(e,t);return(0,V.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await Se(i,xe),Q(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){Q(e instanceof I&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof I&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,V.jsx)(z,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function He(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function Ue(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 We({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:l,loading:u,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:h,reversibleCount:g,displayedError:v,notice:ee,runAction:y,refresh:te}=_({sessionId:e,streaming:n,requestConfirm:o}),b=l?.files??[],ne=i?.expandedFiles?.[0],x=b.find(e=>e.path===ne)??b[0],ie=e=>a?.({expandedFiles:[e]}),S=(e,t)=>f?.kind===e&&f.path===t,C=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,V.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":u||!!f,"data-changes-scope":`session`,children:[(0,V.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,V.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:l?.summary.files??0})}),l&&l.summary.files>0&&(0,V.jsx)($,{added:l.summary.added,removed:l.summary.removed})]})}),v&&(0,V.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),ee&&!v&&(0,V.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:ee}),u&&!l?(0,V.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):b.length?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Le,{files:b.map(e=>({...He(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):Ue(e.formatChange,s)})),selected:x?.path??``,label:s(`board:changes.files`),onSelect:ie}),x&&(0,V.jsx)(Be,{sessionId:e,file:He(x),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:k(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,x.approved?`text-st-done`:`text-content-muted`),"data-change-state":x.reverted?`reverted`:x.approved?`approved`:`pending`,children:[x.approved&&!x.reverted&&(0,V.jsx)(d,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),x.reverted?s(`board:changes.revertedAt`,{time:j(x.changedAt,c)}):x.approved?s(`board:changes.approvedAt`,{time:j(x.changedAt,c)}):s(`board:changes.pendingAt`,{time:j(x.changedAt,c)})]}),x.pending&&!x.approved&&!x.reverted&&(0,V.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:C,onClick:()=>void y({kind:`approve`,path:x.path}),children:[S(`approve`,x.path)?(0,V.jsx)(T,{className:`animate-spin`}):(0,V.jsx)(d,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,V.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||x.reverted||!x.canRevert,title:C,onClick:()=>void y({kind:`revert`,path:x.path}),children:[S(`revert`,x.path)?(0,V.jsx)(T,{className:`animate-spin`}):(0,V.jsx)(re,{}),s(`board:changes.revertFile`)]}),(0,V.jsx)(Ve,{cwd:t,path:x.path})]})})]}):!v&&(0,V.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,V.jsxs)(Fe,{status:f?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):h>0?s(`board:changes.pending`,{count:h}):null,children:[h>0&&(0,V.jsxs)(D,{disabled:m,title:C,onSelect:()=>void y({kind:`approve`}),children:[(0,V.jsx)(d,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(l?.summary.files??0)>0&&(0,V.jsxs)(D,{disabled:m||g===0,title:C??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void y({kind:`revert`}),children:[(0,V.jsx)(re,{}),s(`board:changes.revertAll`)]}),(h>0||(l?.summary.files??0)>0)&&(0,V.jsx)(E,{}),(0,V.jsxs)(D,{disabled:u||!!f,onSelect:te,children:[(0,V.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function Ge({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})=>ve.getVcsChanges(e,{signal:t})}),l=(0,B.useMemo)(()=>C(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:X(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,V.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,V.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,V.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,V.jsx)($,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,V.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,V.jsx)(oe,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,V.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,V.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Le,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,V.jsx)(Be,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,V.jsx)(Ve,{cwd:t,path:p.path})]})})]}):(0,V.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,V.jsx)(F,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,V.jsx)(Fe,{status:c.isFetching?(0,V.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,V.jsxs)(D,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,V.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function Ke({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,V.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,V.jsx)(_e,{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,V.jsx)(Ge,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,V.jsx)(We,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,V.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var qe=[];function Je(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 Ye({panelId:e,sessionId:t,cwd:n,streaming:s,plan:u,goal:d,team:p,activity:h,planTab:_,sources:y,mode:b,requestConfirm:re,onClose:C,onOpenComponents:oe,componentTabs:T,autoFocus:ue=!1}){let{t:E}=r(),D=b===`sheet`,fe=Ce(),pe=o(e=>e.capabilities),O=!!fe&&a(pe,`terminal`),ve=a(pe,`vcs`),j=l(e=>e.tab),M=l(e=>e.setTab),N=l(e=>e.terminalView),ye=l(e=>e.setTerminalView),P=l(e=>e.changesView),xe=l(e=>e.setChangesView),I=w(e=>e.sessions[t]?.pages)??qe,Se=I.some(e=>e.kind===`side-chat`),L=j===`side-chat`&&!Se||j===`plan`&&!_?`changes`:j,R=Je(L,N,P),z=R?I.find(e=>e.kind===R):void 0,H=!D&&T?T.tabs(n):[],[Te,U]=(0,B.useState)(null),[W,Ee]=(0,B.useState)(!1),G=H.some(e=>e.id===Te)?Te:null;(0,B.useEffect)(()=>U(null),[j]);let K=(0,B.useRef)(null);(0,B.useEffect)(()=>{K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[L,G]);let ke=(0,B.useRef)(ue);(0,B.useEffect)(()=>{if(!ke.current)return;let e=requestAnimationFrame(()=>K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>{if(!R||z||(R===`terminal`||R===`processes`)&&!O)return;let e=w.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,R,{type:`add`,kind:R}),n||e.update(t,R,{type:`workspace`,contentOpen:!1})},[R,z,t,O]);let q=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>be(t),staleTime:1e4}),J=q.data?.status===`known`?q.data.changedFiles??0:0,Ae=De(h,s),Y=[{id:`changes`,icon:ne,label:J>0?E(`board:inspector.changesCount`,{count:J}):E(`board:inspector.changes`)},{id:`terminal`,icon:le,label:E(`board:inspector.terminal`)},{id:`running`,icon:c,label:Ae?E(`board:inspector.runningCount`,{count:Ae}):E(`board:inspector.running`)},{id:`files`,icon:x,label:E(`board:inspector.files`)},{id:`preview`,icon:te,label:E(`board:inspector.preview`)},..._?[{id:`plan`,icon:ie,label:E(`board:inspector.plan`)}]:[],...Se?[{id:`side-chat`,icon:se,label:E(`board:inspector.sideChat`)}]:[]],X=e=>{z&&w.getState().update(t,z.kind,{type:`view`,id:z.id,patch:e})},Me=()=>{let n=I.find(e=>e.kind===`side-chat`);if(n&&w.getState().update(t,`side-chat`,{type:`close`,id:n.id}),M(`changes`),D){C();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Z=t=>`${e}-component-${t}-tab`,Ne=e=>{U(null),M(e)},Pe=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===L),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?U(i.component):i.fixed&&Ne(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},Q=(0,V.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:E(`chat:focusSession.gitLoading`)}),$;if(G&&T)$=T.render(G,{sessionId:t,cwd:n});else if(L===`changes`)$=(0,V.jsx)(Ke,{sessionId:t,cwd:n,streaming:s,scope:P,onScopeChange:xe,vcsAvailable:ve,view:z?.view,onViewChange:z?X:void 0,requestConfirm:re});else if(L===`terminal`)$=O?(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,V.jsx)(_e,{size:`sm`,"aria-label":E(`board:inspector.terminalScope`),value:N,onValueChange:ye,options:[{value:`terminal`,label:E(`board:inspector.terminal`)},{value:`processes`,label:E(`board:inspector.processes`)}]})}),(0,V.jsx)(B.Suspense,{fallback:Q,children:z?N===`processes`?(0,V.jsx)(m,{sessionId:t,view:z.view,onViewChange:X,onOpenTerminal:e=>{let n=w.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}),ye(`terminal`)}}):(0,V.jsx)(f,{sessionId:t,cwd:n,terminalId:z.resourceId||void 0,onCreated:e=>w.getState().update(t,`terminal`,{type:`resource`,id:z.id,resourceId:e})},z.id):Q})]}):(0,V.jsx)(F,{compact:!0,icon:le,title:E(`board:inspector.terminalUnavailable`)});else if(L===`files`)$=z?(0,V.jsx)(v,{sources:y,view:z.view,onViewChange:X}):Q;else if(L===`preview`){let e=s?ae([...h]):null;$=z?(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:[e&&(0,V.jsx)(`div`,{className:`max-h-[50%] shrink-0 overflow-y-auto border-b border-stroke-soft p-2`,children:(0,V.jsx)(S,{target:e,fallbackImage:e.previewImage,streaming:s})}),(0,V.jsx)(ee,{page:z,onChange:e=>w.getState().update(t,`browser`,{type:`browser`,id:z.id,...e})})]}):Q}else $=L===`plan`?(0,V.jsx)(je,{plan:u,streaming:s,goal:d,team:p,activity:h}):L===`running`?(0,V.jsx)(Oe,{sessionId:t,streaming:s,activity:h}):(0,V.jsx)(g,{parentId:t,active:!0});return(0,V.jsxs)(`section`,{id:e,"aria-label":E(`board:inspector.label`),"data-session-inspector":b,"data-inspector-tab":L,"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,V.jsxs)(`header`,{className:k(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,D?`h-[52px]`:b===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,V.jsxs)(`div`,{ref:K,role:`tablist`,"aria-label":E(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Pe,children:[Y.map(({id:t,icon:n,label:r})=>{let i=!G&&t===L;return(0,V.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`,D?`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:()=>Ne(t),children:[!D&&(0,V.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!G&&L===`side-chat`&&(0,V.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:k(D&&`size-11`),"aria-label":E(`board:inspector.closeTab`,{tab:E(`board:inspector.sideChat`)}),onClick:Me,children:(0,V.jsx)(de,{"aria-hidden":`true`})}),!D&&(0,V.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,V.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:()=>U(t),children:(0,V.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!D&&(0,V.jsxs)(ge,{open:W,onOpenChange:Ee,children:[(0,V.jsx)(me,{asChild:!0,children:(0,V.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":E(`board:inspector.add`),title:E(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,V.jsx)(ce,{"aria-hidden":`true`})})}),(0,V.jsxs)(he,{align:`end`,className:`w-64 text-xs`,children:[T?.addMenu?T.addMenu({cwd:n,onAdded:e=>{U(e),Ee(!1)}}):(0,V.jsx)(`p`,{className:`text-content-secondary`,children:E(`board:inspector.addHint`)}),oe&&(0,V.jsx)(A,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:oe,children:E(`board:inspector.openComponents`)})]})]}),(0,V.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:k(`flex-none`,D&&`size-11`),"aria-label":E(`board:inspector.close`),title:E(`board:inspector.close`),"aria-controls":e,onClick:C,children:b===`aside`?(0,V.jsx)(we,{"aria-hidden":`true`}):(0,V.jsx)(de,{"aria-hidden":`true`})})]}),(0,V.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":G?Z(G):`${e}-${L}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:$})]})}export{Ye as SessionInspector};
|