pisper 0.6.14 → 0.6.15
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/bin/pisper.mjs +5 -1
- package/lib/executor-node.mjs +590 -0
- package/lib/npm-update.mjs +2 -0
- package/package.json +5 -5
- package/web/.vite/manifest.json +852 -856
- package/web/assets/{AppDialog-DrhCZm1r.js → AppDialog-CgJEhcYw.js} +1 -1
- package/web/assets/{AppOverlays-CxgReqGn.js → AppOverlays-BBlYyb_U.js} +1 -1
- package/web/assets/{AppSelect-BGVBQRP1.js → AppSelect-BD6RAaJ5.js} +1 -1
- package/web/assets/{AssetsPage-CKK-byQY.js → AssetsPage-D3F4T0_j.js} +1 -1
- package/web/assets/BoardPage-CO7nU2Mw.js +3 -0
- package/web/assets/BotAvatar-CNL-APwP.js +1 -0
- package/web/assets/ChannelsPage-CsRbj9St.js +1 -0
- package/web/assets/{ChatAppearancePage-BhqRLf-2.js → ChatAppearancePage-Sc1V75I3.js} +1 -1
- package/web/assets/{ChatHistoryPage-DBsNyGYj.js → ChatHistoryPage-BT0mIaDN.js} +1 -1
- package/web/assets/ChatPage-C-hswZf9.js +553 -0
- package/web/assets/ConfigPage-DH2d8YGn.js +5 -0
- package/web/assets/{DesktopWindowControls-DCtIkpTs.js → DesktopWindowControls-Bo5vvIFH.js} +1 -1
- package/web/assets/{FeaturePage-Bkt1wWVg.js → FeaturePage-B3wCvGpC.js} +1 -1
- package/web/assets/{FileAttachmentPreview-Cnmi_2U-.js → FileAttachmentPreview-D8YqjbeC.js} +1 -1
- package/web/assets/{FloatingWidgets-BIJSFz34.js → FloatingWidgets-Dz_T7XWC.js} +1 -1
- package/web/assets/FocusRuntimeControls-hYDoXwg7.js +1 -0
- package/web/assets/{GitDiffViewer-rjt5_KOt.js → GitDiffViewer-CBju_Sj4.js} +3 -3
- package/web/assets/ManageProjectsDialog-Dtb2K7BK.js +1 -0
- package/web/assets/{MarkdownMessage-yl-PSRAz.js → MarkdownMessage-BDztlYIy.js} +1 -1
- package/web/assets/{McpPage-D6GyZCpt.js → McpPage-DQ6AILOH.js} +1 -1
- package/web/assets/MemoryPage-CK4evs_P.js +1 -0
- package/web/assets/{MobileNavigation-DcBH2I9Y.js → MobileNavigation-BICCops3.js} +1 -1
- package/web/assets/MobileViewportStabilizer-uKI4Zp7f.js +1 -0
- package/web/assets/{MorePage-BBfiQbiP.js → MorePage-DuML7bhr.js} +1 -1
- package/web/assets/NewBotDialog--2DSe9Sy.js +1 -0
- package/web/assets/{NewFolderDialog-BinpbTs8.js → NewFolderDialog-S-Qzjzfu.js} +1 -1
- package/web/assets/{PageHeader-D_J-19ni.js → PageHeader-B78dHJed.js} +1 -1
- package/web/assets/{PhoneDrawer-CwxDkWZQ.js → PhoneDrawer-DHRBi4XA.js} +1 -1
- package/web/assets/PhoneMenuButton-BjDV-dPl.js +1 -0
- package/web/assets/PhoneTopBar-BuyzXL4Z.js +1 -0
- package/web/assets/PluginsPage-Cd9bu2AS.js +1 -0
- package/web/assets/{SafeModePrompt-CLyt-z14.js → SafeModePrompt-BnoccbWI.js} +1 -1
- package/web/assets/SchedulesPage-DUhUUQP5.js +1 -0
- package/web/assets/SessionBrowserPane-B3weAiaB.js +2 -0
- package/web/assets/SessionContextPanel-BtxUlk9m.js +2 -0
- package/web/assets/SessionHome-ByiFmH18.js +1 -0
- package/web/assets/SessionInspector-VKOz4Rxs.js +1 -0
- package/web/assets/SessionShell-BsDAwWHd.js +1 -0
- package/web/assets/{SettingsSidebar-IqsOv5h1.js → SettingsSidebar-B-COw6Uw.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-DKDAF94g.js → ShortcutHelpDialog-DquhK-Uh.js} +1 -1
- package/web/assets/{ShortcutKeys-DQFnMnX1.js → ShortcutKeys-BgwCWvNY.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-Cbwy5ii9.js → SidebarUpdateStatus-Ci0ugb91.js} +1 -1
- package/web/assets/{SkillsPage-DTOzYSaS.js → SkillsPage-B46uoO_g.js} +1 -1
- package/web/assets/{TaskProcessesPane-DRFmGkE3.js → TaskProcessesPane-CI_5lWbf.js} +1 -1
- package/web/assets/{TaskTerminalView-DWNACXyI.js → TaskTerminalView-C2acHnAH.js} +1 -1
- package/web/assets/{TerminalPanel-QEt-SRiM.js → TerminalPanel-BAQ2VwKg.js} +1 -1
- package/web/assets/{WebDesktopPet-4CDch3gC.js → WebDesktopPet-D3bdxKPz.js} +1 -1
- package/web/assets/{WorkflowsPage-AMKQBlPo.js → WorkflowsPage-Dp1PRKQb.js} +1 -1
- package/web/assets/WorkspacePicker-BJhBGRH0.js +1 -0
- package/web/assets/accordion-CiJMkjqX.js +1 -0
- package/web/assets/{api-BO7LAPSQ.js → api-CKJOip3Q.js} +1 -1
- package/web/assets/{app-update-DKWPHTUY.js → app-update-yPQVXuw5.js} +1 -1
- package/web/assets/{approval-confirm-ByiI22Wo.js → approval-confirm-Cv754IjO.js} +1 -1
- package/web/assets/board-messages-CIYKjAla.js +1 -0
- package/web/assets/board-projects-wd79Rqt5.js +2 -0
- package/web/assets/channels-messages-KabR1HOR.js +1 -0
- package/web/assets/chat-api-Bvirerdj.js +1 -0
- package/web/assets/{client-store-6GNC8uyK.js → client-store-BaTctJrB.js} +1 -1
- package/web/assets/collapsible-Dcoy-qnz.js +1 -0
- package/web/assets/config-search-KYVClDpx.js +1 -0
- package/web/assets/{dialog-CUhFgsVd.js → dialog-Cb_sjjQV.js} +1 -1
- package/web/assets/{collapsible-DMaUQRX4.js → dist-DUSSw9eQ.js} +1 -1
- package/web/assets/events-CZTn9wa-.js +1 -0
- package/web/assets/file-diff-GxOMJkLj.js +1 -0
- package/web/assets/folder-paths--euvEC5U.js +1 -0
- package/web/assets/{hosts-1yQREdMi.js → hosts-BRPznOHU.js} +1 -1
- package/web/assets/i18n-DEs6BBob.js +1 -0
- package/web/assets/{index-CsE52ydO.js → index-C5aKcTGw.js} +2 -2
- package/web/assets/index-DD2H2OOC.css +2 -0
- package/web/assets/message-circle-question-mark-D7ehy_mi.js +1 -0
- package/web/assets/{mobile-remote-fallback-NJCTBu85.js → mobile-remote-fallback-DG_urwIg.js} +1 -1
- package/web/assets/mount-app-BdXRP9D-.js +9 -0
- package/web/assets/navigation-DkcKi1_5.js +1 -0
- package/web/assets/new-task-uLEgjs2Z.js +1 -0
- package/web/assets/{palette-navigation-ByC1_QS5.js → palette-navigation-HbVGltCo.js} +1 -1
- package/web/assets/{permission-rules-api-BoJ_1W-m.js → permission-rules-api-C9oRUm6Z.js} +1 -1
- package/web/assets/{pick-system-directory-B_RJmP26.js → pick-system-directory-B__qKy-X.js} +1 -1
- package/web/assets/placements-Bn0vPyEI.js +2 -0
- package/web/assets/{popover--UmYQ9yB.js → popover-CiVxYUEU.js} +1 -1
- package/web/assets/public-9meoHs0K.js +4 -0
- package/web/assets/public-D6X148yH.js +2 -0
- package/web/assets/public-DenVz3gW.js +2 -0
- package/web/assets/{public-components-DYGekkA7.js → public-components-BfHcj0Pn.js} +1 -1
- package/web/assets/public-diff-BqcNo4lt.js +1 -0
- package/web/assets/public-events-DCyxz5zX.js +1 -0
- package/web/assets/public-flags-BOI2nkm4.js +1 -0
- package/web/assets/public-launch-D0t4Hqf5.js +1 -0
- package/web/assets/public-sidebar-CdxAohEH.js +1 -0
- package/web/assets/react-bits-BsPlLi8F.css +1 -0
- package/web/assets/routes-DIeaqWVc.js +1 -0
- package/web/assets/runtime-capabilities-CHYOF_hE.js +1 -0
- package/web/assets/{runtime-capabilities-store-C2Qv7uDP.js → runtime-capabilities-store-D2d_9z0D.js} +1 -1
- package/web/assets/{safe-mode-instance-BiAPYJ2-.js → safe-mode-instance-hnF1BJYr.js} +1 -1
- package/web/assets/safe-mode-sentinel-CPmhLLXT.js +1 -0
- package/web/assets/{session-change-summary-api-DgRT32uh.js → session-change-summary-api-DmmNGbP7.js} +1 -1
- package/web/assets/{session-home-BktP6sGF.js → session-home-BAFT2Fk1.js} +1 -1
- package/web/assets/{session-organization-api-DFu3Chto.js → session-organization-api-Bs8DdxU1.js} +1 -1
- package/web/assets/{session-scope-DQPNgQMm.js → session-scope-XRVRtwow.js} +1 -1
- package/web/assets/{session-tree-actions-DfO8QHBO.js → session-tree-actions-Dzj7hrvM.js} +1 -1
- package/web/assets/{session-tree-summary-BwYRdui2.js → session-tree-summary-BXVKYODc.js} +1 -1
- package/web/assets/settings-navigation-DiP_AM1C.js +1 -0
- package/web/assets/{shortcuts-Cvp9WD9O.js → shortcuts-IA6Uq_O6.js} +1 -1
- package/web/assets/side-chat-context-CZ4IqNxt.js +7 -0
- package/web/assets/sidebar-Do_8-Hyh.js +2 -0
- package/web/assets/sidebar-store-DuRlD5qg.js +1 -0
- package/web/assets/{speech-session-DK_09Wky.js → speech-session-D_W5Ulli.js} +1 -1
- package/web/assets/{startup-queries-6Oztqpto.js → startup-queries-DeNu46nT.js} +1 -1
- package/web/assets/storage-DH3bQdy6.js +1 -0
- package/web/assets/tool-labels-ghvpPFmc.js +1 -0
- package/web/assets/{use-i18n-B5p-Kzvz.js → use-i18n-CUS2_EGy.js} +1 -1
- package/web/assets/use-mobile-C2tPBAza.js +1 -0
- package/web/assets/use-studio-actions-CYnwfaOn.js +3 -0
- package/web/assets/useNewProjectPicker-CacWA0IS.js +1 -0
- package/web/assets/usePhoneShell-cYrS53S8.js +1 -0
- package/web/assets/useSessionRowActions-DtunSg_Q.js +1 -0
- package/web/assets/useSidebarModel-6sqN4VA5.js +1 -0
- package/web/assets/web-preview-Dgng80ZD.js +1 -0
- package/web/assets/{web-preview-events-DQchQHt3.js → web-preview-events-JGegs4uF.js} +1 -1
- package/web/assets/workflow-messages-Cj35aJZc.js +1 -0
- package/web/assets/workspace-order-store-BuPmheRT.js +1 -0
- package/web/index.html +2 -2
- package/web/assets/BoardPage-vwv5vTDm.js +0 -3
- package/web/assets/ChannelsPage-L-wcVDSN.js +0 -1
- package/web/assets/ChatPage-DS0euFxR.js +0 -553
- package/web/assets/ConfigPage-pOzONr8e.js +0 -5
- package/web/assets/DispatchOverlay-n-qbkOP-.js +0 -1
- package/web/assets/FocusRuntimeControls-C7NIdpV4.js +0 -1
- package/web/assets/LaunchConsole-DtxzpXJo.js +0 -3
- package/web/assets/ManageProjectsDialog-RiFg3h1p.js +0 -1
- package/web/assets/MemoryPage-Dsx_6JpI.js +0 -1
- package/web/assets/MobileViewportStabilizer-OtwVmIPm.js +0 -1
- package/web/assets/PhoneMenuButton-B0AwvqEo.js +0 -1
- package/web/assets/PhoneTopBar-Dw0mIaWC.js +0 -1
- package/web/assets/PluginsPage-BzxPAX26.js +0 -1
- package/web/assets/QuickPromptIdeas-Cd3SwBqS.js +0 -1
- package/web/assets/SchedulesPage-Cbgl5v_8.js +0 -1
- package/web/assets/SessionBrowserPane-CB7jn-MS.js +0 -2
- package/web/assets/SessionContextPanel-CNmAp0ed.js +0 -2
- package/web/assets/SessionHome-Ck_daJT0.js +0 -1
- package/web/assets/SessionInspector-cSzwsc4b.js +0 -1
- package/web/assets/SessionShell-BOZ7h0yz.js +0 -1
- package/web/assets/WorkspacePicker-B9vYtfab.js +0 -1
- package/web/assets/board-launch-BmmPYZe8.js +0 -1
- package/web/assets/board-messages-BOWWyhz_.js +0 -1
- package/web/assets/board-projects-BU9fZB1q.js +0 -1
- package/web/assets/channels-messages-DazltGVm.js +0 -1
- package/web/assets/chat-api-DkdyVQY9.js +0 -1
- package/web/assets/config-search-HBKDuym0.js +0 -1
- package/web/assets/events-DrAPv0se.js +0 -1
- package/web/assets/file-text-N9JICX6E.js +0 -1
- package/web/assets/folder-paths-DQTpuGh9.js +0 -1
- package/web/assets/i18n-CHmr7GzM.js +0 -1
- package/web/assets/index-CfTBR7Rs.css +0 -2
- package/web/assets/list-checks-B5Jl4aiO.js +0 -1
- package/web/assets/mount-app-DfSFF0xv.js +0 -9
- package/web/assets/navigation-EoDz3gT8.js +0 -1
- package/web/assets/new-task-C3wuHTor.js +0 -1
- package/web/assets/placements-CqwqXPTp.js +0 -2
- package/web/assets/public-diff-DK-VNIar.js +0 -1
- package/web/assets/public-fqyTjQ0F.js +0 -2
- package/web/assets/public-jQjEc6OO.js +0 -1
- package/web/assets/public-launch-CT_m9KWo.js +0 -1
- package/web/assets/react-bits-DQli9s7O.css +0 -1
- package/web/assets/routes-Da0OHSy6.js +0 -1
- package/web/assets/runtime-capabilities-4_ZwLBqF.js +0 -1
- package/web/assets/safe-mode-sentinel-Ccu3Vmta.js +0 -1
- package/web/assets/session-workspaces-BWTBYaGT.js +0 -1
- package/web/assets/settings-navigation-_yUm71Uk.js +0 -1
- package/web/assets/shield-B1ruzHd0.js +0 -1
- package/web/assets/side-chat-context-BfOm4dFp.js +0 -7
- package/web/assets/sidebar-BLeRyb55.js +0 -2
- package/web/assets/sidebar-commands-ZA1UOA_F.js +0 -1
- package/web/assets/sidebar-store-1-aNPlDu.js +0 -1
- package/web/assets/storage-BY6wEHPw.js +0 -1
- package/web/assets/tool-labels-BUEvdohv.js +0 -1
- package/web/assets/use-mobile-DauOEda6.js +0 -1
- package/web/assets/use-studio-actions-D6c_pSJK.js +0 -3
- package/web/assets/useBoardItems-CzEbgTLJ.js +0 -1
- package/web/assets/useFleetSystemInfo-Bd8zJIFa.js +0 -1
- package/web/assets/useNewProjectPicker-DQY1X_ua.js +0 -1
- package/web/assets/useNow-Bxn4_OW9.js +0 -1
- package/web/assets/usePagePrimaryAction-CWPC0C_f.js +0 -1
- package/web/assets/usePhoneShell-Bvb7m-m4.js +0 -1
- package/web/assets/useSessionListQuery-D44XZfGr.js +0 -2
- package/web/assets/useSessionRowActions-Cr6SUAeE.js +0 -1
- package/web/assets/useSidebarModel-CWED0rsw.js +0 -1
- package/web/assets/wand-sparkles-CvEBNUFz.js +0 -1
- package/web/assets/web-preview-CqwSe9Zn.js +0 -1
- package/web/assets/workflow-messages-CMCQrs5q.js +0 -1
- package/web/assets/workspace-order-store-RYWvGOeR.js +0 -1
- /package/web/assets/{AnimatedList-D8fxDNGr.js → AnimatedList-DB5vqafO.js} +0 -0
- /package/web/assets/{ClickSpark-DmnEAJNI.js → ClickSpark-B1Rn7ZwL.js} +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-CHmr7GzM.js";import{t as o}from"./use-i18n-B5p-Kzvz.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{t as f}from"./file-text-N9JICX6E.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--UmYQ9yB.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"./dialog-CUhFgsVd.js";import{n as M,t as N}from"./input-group-h8z63MzW.js";import{t as P}from"./model-display-kDwvtxrW.js";import{i as F}from"./run-activity-CwfO0cui.js";var ee=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`}]]),I=e(t(),1);function te(e){let t=e.match(/^\/btw(?:\s+([\s\S]*))?$/);return t?(t[1]||``).trim():null}function L(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 ne({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[...L(`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),...L(`effort`,e(`chat:commands.builtin.effort`),i.map(e=>({value:e,label:o(e),current:e===a})),s),...L(`approval`,e(`chat:commands.builtin.approval`),c.map(e=>({value:e,label:u(e),current:e===l})),d),...f.length>1?L(`run`,e(`chat:commands.builtin.run`),f.map(e=>({value:e,label:m(e),current:e===p})),h):[]]}function re(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 ie=10485760,ae=20971520,oe=new Set([`txt`,`md`,`json`,`js`,`jsx`,`ts`,`tsx`,`css`,`html`,`xml`,`yaml`,`yml`,`csv`,`log`,`py`,`java`,`go`,`rs`,`sh`,`ps1`,`toml`,`sql`]),se=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`svg`]),ce=new Set([`pdf`,`docx`,`pptx`,`xlsx`,`odt`,`odp`,`ods`,`rtf`,`epub`]),le=[`image/*`,`text/*`,`application/json`,...[...se,...oe,...ce].map(e=>`.${e}`)].join(`,`);function ue(e){let t=[...e?.files||[]];return t.length?t:[...e?.items||[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>!!e)}function de(e){return[...e?.types||[]].includes(`Files`)}function fe(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 pe(e){return e.toLowerCase().split(`.`).at(-1)||``}async function me(e,t){let n=[...e].slice(0,8),r=[];for(let e of n){if(e.size>ie)throw Error(t(`chat:attachments.nameExceedsThe10MBLimit`,{name:e.name}));let n=pe(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/`)||se.has(n))r.push({...i,kind:`image`,data:await fe(e,t)});else if(e.type.startsWith(`text/`)||e.type===`application/json`||oe.has(n))r.push({...i,kind:`text`,text:await e.text()});else if(ce.has(n))r.push({...i,kind:`document`,extension:n,data:await fe(e,t)});else throw Error(t(`chat:attachments.nameIsNotSupportedChooseAnImageOrTextCodeFile`,{name:e.name}))}return r}function he(e){return e.split(/[\\/]/).filter(Boolean).at(-1)||e}function ge(e){return[...e].map(e=>String(e||``).trim()).filter(Boolean).slice(0,8).map(e=>({id:`path:${e}`,kind:`path`,name:he(e),path:e}))}function _e(e=[],t,n){let r=(0,I.useCallback)((e,t)=>i(e,a(),t),[]),[o,s]=(0,I.useState)(()=>[...e]),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)([]),f=(0,I.useRef)(new Map),p=(0,I.useRef)(0),m=(0,I.useRef)(n);m.current=n,(0,I.useEffect)(()=>{let e=f.current;return d([]),l(``),()=>{for(let t of e.values())t.cancelled=!0;e.clear()}},[n]);let h=(0,I.useRef)([...e]),g=(0,I.useCallback)(e=>{h.current=e,s(e),t?.(e)},[t]),_=(0,I.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 me([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)>ae)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,I.useCallback)(e=>{let t=ue(e.clipboardData);t.length&&(e.preventDefault(),_(t))},[_]),dropFiles:(0,I.useCallback)(e=>{if(!de(e.dataTransfer))return;e.preventDefault();let t=ue(e.dataTransfer);t.length&&_(t)},[_]),removeAttachment:(0,I.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,I.useCallback)(()=>{for(let e of f.current.values())e.cancelled=!0;f.current.clear(),d([]),g([])},[g]),addAttachments:(0,I.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,I.useCallback)(e=>{l(e instanceof Error?e.message:String(e||``))},[])}}var R=new Map,z=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 B(e){return ye(R.get(e))}function V(e,t){if(!e)return;let n={...B(e),...t};n.attachments=[...n.attachments];let r=B(e);r.text===n.text&&r.attachments.length===n.attachments.length&&r.attachments.every((e,t)=>e===n.attachments[t])||(r.text!==n.text&&z.set(e,(z.get(e)||0)+1),R.delete(e),!(!n.text&&!n.attachments.length)&&R.set(e,n))}function be(e){z.set(e,(z.get(e)||0)+1),R.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,I.useRef)(e);t.current=e;let n=(0,I.useRef)(!0);(0,I.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,I.useRef)(B(e)),[i,a]=(0,I.useState)(r.current.text),o=(0,I.useCallback)(t=>V(e,{attachments:t}),[e]),s=_e(r.current.attachments,o,e),c=s.replaceAttachments,l=s.clearAttachments;return(0,I.useEffect)(()=>{let t=B(e);a(t.text),c(t.attachments)},[c,e]),{value:i,updateValue:(0,I.useCallback)(t=>{a(t),V(e,{text:t})},[e]),selection:s,clearDraft:(0,I.useCallback)(()=>{let r=B(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,I.useCallback)(r=>{let i=xe(B(e),r);return V(e,i),!n.current||t.current!==e?!1:(a(i.text),c(i.attachments),!0)},[c,e]),captureSubmission:(0,I.useCallback)(()=>{let r=B(e),i=z.get(e)||0,o=!1;return{accept(){if(o)return;o=!0;let s=B(e),l={text:(z.get(e)||0)===i?``:s.text,attachments:s.attachments.filter(e=>!r.attachments.includes(e))};V(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 H=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,I.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,I.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,H.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(),p=(0,I.useId)(),m=(0,I.useRef)(null),h=r.match(/^\/([^\n]{0,120})$/),[g,_]=(0,I.useState)(``),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(!1),[S,C]=(0,I.useState)(!1),[w,T]=(0,I.useState)(0),E=h?.[1]||``,D=/\s/.test(E),O=(0,I.useRef)(t);O.current=t;let k=(0,I.useMemo)(()=>re(n,E,d),[n,d,E]),A=!!(h&&g!==r&&(!D||k.length));(0,I.useEffect)(()=>{_(``),y(null),C(!1)},[e]),(0,I.useEffect)(()=>{if(!A||v)return;let e=!0;return x(!0),C(!1),O.current().then(t=>{e&&y(t.commands||[])}).catch(()=>{e&&(y([]),C(!0))}).finally(()=>e&&x(!1)),()=>{e=!1}},[v,A,e]);let j=(0,I.useMemo)(()=>{let e=k.map(e=>({kind:`builtin`,command:e}));if(D)return e;let t=E.toLocaleLowerCase(d),n=(v||[]).filter(e=>!t||`${e.invocation} ${e.name} ${e.description}`.toLocaleLowerCase(d).includes(t));return[...e,...n.map(e=>({kind:`resource`,command:e}))]},[D,k,v,d,E]);(0,I.useEffect)(()=>{T(0)},[E,v]);let M=()=>{_(r)},N=e=>{if(e.kind===`builtin`){let t=e.command.run?``:`${e.command.invocation} `;i(t),_(``),T(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),_(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,I.useEffect)(()=>{if(!A)return;let e=e=>{if(document.activeElement===a.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),M();return}j.length&&(e.key===`ArrowDown`?(e.preventDefault(),e.stopPropagation(),T(e=>(e+1)%j.length)):e.key===`ArrowUp`?(e.preventDefault(),e.stopPropagation(),T(e=>(e-1+j.length)%j.length)):(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),N(j[Math.min(w,j.length-1)])))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}),(0,I.useEffect)(()=>{let e=a.current;if(!A||!e)return;let t={role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":p,"aria-activedescendant":j.length?`${p}-${Math.min(w,j.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))}},[w,a,p,A,j.length]);let P={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,H.jsx)(Te,{open:A,anchorRef:a,menuRef:m,placement:s,matchAnchorWidth:!0,maxHeight:330,id:p,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,H.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:[j.map((e,t)=>{let{command:n}=e,r=e.kind===`builtin`?e.command.current?l:ee:e.command.source===`prompt`?f:c,i=e.kind===`resource`?e.command:null;return(0,H.jsxs)(`button`,{type:`button`,role:`option`,id:`${p}-${t}`,"aria-selected":t===w,className:t===w?`active`:``,onMouseEnter:()=>T(t),onMouseDown:e=>e.preventDefault(),onClick:()=>N(e),children:[(0,H.jsx)(`span`,{className:`list-icon grid size-7 place-items-center rounded-sm bg-surface-muted text-content-secondary`,children:(0,H.jsx)(r,{size:15})}),(0,H.jsxs)(`span`,{className:`composer-command-copy`,children:[(0,H.jsxs)(`strong`,{children:[n.invocation,i?.argumentHint&&(0,H.jsxs)(`small`,{children:[` `,i.argumentHint]})]}),(0,H.jsx)(`small`,{children:n.description||u(`chat:commands.noDescription`)})]}),(0,H.jsx)(`em`,{children:i?(0,H.jsxs)(H.Fragment,{children:[i.source===`prompt`?u(`chat:commands.prompt`):u(`chat:commands.skill`),` · `,P[i.scope]]}):e.kind===`builtin`&&e.command.current?u(`chat:commands.builtin.current`):u(`chat:commands.builtin.label`)})]},`${e.kind}:${n.invocation}`)}),!j.length&&(0,H.jsx)(`p`,{children:u(b?`chat:commands.loading`:S?`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,I.useState)(null),[d,f]=(0,I.useState)(!1),p=(0,I.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,I.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,H.jsxs)(`div`,{className:E(`min-w-0`,c),children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 px-0.5 pb-1`,children:[o&&(0,H.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:o}),(0,H.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-[13px] leading-5 font-medium text-accent-fg`,"aria-live":`polite`,children:g}),s]})]}),(0,H.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,H.jsxs)(`div`,{className:`flex justify-between px-0.5 pt-0.5 text-xs text-content-faint`,"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{children:n(e[0])}),(0,H.jsx)(`span`,{children:n(e.at(-1)||``)})]})]})}var Oe=96,ke=.6,Ae=`10%`;function je({onDismiss:e,className:t}){let n=(0,I.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,H.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,H.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,I.useState)(!1),p=i??d,m=e=>{i===void 0&&f(e),a?.(e)};return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(h,{"aria-haspopup":`dialog`,"aria-expanded":p,onClick:()=>m(!0),children:n}),(0,H.jsx)(A,{open:p,onOpenChange:m,children:(0,H.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,H.jsx)(je,{onDismiss:()=>m(!1)}),(0,H.jsx)(O,{className:`px-2 pt-1 pb-1 text-base font-semibold`,children:t}),(0,H.jsx)(k,{className:`sr-only`,children:t}),r]})})]}):(0,H.jsxs)(w,{open:p,onOpenChange:m,children:[(0,H.jsx)(S,{asChild:!0,children:n}),(0,H.jsx)(C,{align:o,side:s,sideOffset:c,className:l,children:r})]})}var Ne=1,Pe=.9,Fe=.8,Ie=.17,U=.1,Le=.999,Re=.9999,ze=.99,Be=/[\\\/_+.#"@\[\(\{&]/,Ve=/[\\\/_+.#"@\[\(\{&]/g,He=/[\s-]/,Ue=/[\s-]/g;function We(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Ne:ze;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=We(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Ne:Be.test(e.charAt(l-1))?(d*=Fe,p=e.slice(i,l-1).match(Ve),p&&i>0&&(d*=Le**+p.length)):He.test(e.charAt(l-1))?(d*=Pe,m=e.slice(i,l-1).match(Ue),m&&i>0&&(d*=Le**+m.length)):(d*=Ie,i>0&&(d*=Le**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Re)),(d<U&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=We(e,t,n,r,l+1,a+2,o),f*U>d&&(d=f*U)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ge(e){return e.toLowerCase().replace(Ue,` `)}function Ke(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,We(e,t,Ge(e),Ge(t),0,0,{})}var W=`[cmdk-group=""]`,qe=`[cmdk-group-items=""]`,Je=`[cmdk-group-heading=""]`,Ye=`[cmdk-item=""]`,Xe=`${Ye}:not([aria-disabled="true"])`,Ze=`cmdk-item-select`,G=`data-value`,Qe=(e,t,n)=>Ke(e,t,n),$e=I.createContext(void 0),K=()=>I.useContext($e),et=I.createContext(void 0),q=()=>I.useContext(et),tt=I.createContext(void 0),nt=I.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=pt(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=I.useRef(null),w=ht();Y(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,T.emit()}},[u]),Y(()=>{w(6,j)},[]);let T=I.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=I.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??Qe;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(qe);t?t.appendChild(e.parentElement===t?e:e.closest(`${qe} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qe} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${W}[${G}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function k(){let e=N().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(G);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(W)?.querySelector(Je))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function M(){return C.current?.querySelector(`${Ye}[aria-selected="true"]`)}function N(){return Array.from(C.current?.querySelectorAll(Xe)||[])}function P(e){let t=N()[e];t&&T.setState(`value`,t.getAttribute(G))}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(G))}function ee(e){let t=M()?.closest(W),n;for(;t&&!n;)t=e>0?dt(t,W):ft(t,W),n=t?.querySelector(Xe);n?T.setState(`value`,n.getAttribute(G)):F(e)}let te=()=>P(N().length-1),L=e=>{e.preventDefault(),e.metaKey?te():e.altKey?ee(1):F(1)},ne=e=>{e.preventDefault(),e.metaKey?P(0):e.altKey?ee(-1):F(-1)};return I.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&&L(e);break;case`ArrowDown`:L(e);break;case`p`:case`k`:v&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),P(0);break;case`End`:e.preventDefault(),te();break;case`Enter`:{e.preventDefault();let t=M();if(t){let e=new Event(Ze);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:E.inputId,id:E.labelId,style:_t},c),Q(e,e=>I.createElement(et.Provider,{value:T},I.createElement($e.Provider,{value:E},e))))}),rt=I.forwardRef((e,t)=>{let n=_(),r=I.useRef(null),i=I.useContext(tt),a=K(),o=pt(e),s=o.current?.forceMount??i?.forceMount;Y(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=mt(n,r,[e.value,e.children,r],e.keywords),l=q(),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);I.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ze,f),()=>t.removeEventListener(Ze,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 I.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)}),it=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=_(),s=I.useRef(null),c=I.useRef(null),l=_(),u=K(),d=Z(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));Y(()=>u.group(o),[]),mt(o,s,[e.value,e.heading,c]);let f=I.useMemo(()=>({id:o,forceMount:i}),[i]);return I.createElement(g.div,{ref:m(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&I.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},I.createElement(tt.Provider,{value:f},e))))}),at=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),a=Z(e=>!e.search);return!n&&!a?null:I.createElement(g.div,{ref:m(i,t),...r,"cmdk-separator":``,role:`separator`})}),ot=I.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=q(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=K();return I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.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)}})}),st=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=I.useRef(null),o=I.useRef(null),s=Z(e=>e.selectedItemId),c=K();return I.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)}}},[]),I.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=>I.createElement(`div`,{ref:m(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ct=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(x,{open:n,onOpenChange:r},I.createElement(y,{container:o},I.createElement(v,{"cmdk-overlay":``,className:i}),I.createElement(b,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(nt,{ref:t,...s}))))}),lt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(g.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ut=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.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=>I.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(nt,{List:st,Item:rt,Input:ot,Group:it,Separator:at,Dialog:ct,Empty:lt,Loading:ut});function dt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ft(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function pt(e){let t=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function mt(e,t,n,r=[]){let i=I.useRef(),a=K();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(G,s),i.current=s}),i}var ht=()=>{let[e,t]=I.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 gt(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&&I.isValidElement(t)?I.cloneElement(gt(t),{ref:t.ref},n(t.props.children)):n(t)}var _t={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function vt({className:e,...t}){return(0,H.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 yt({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,H.jsxs)(N,{className:`h-8! rounded-sm! border-stroke bg-surface-subtle shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,H.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,H.jsx)(M,{children:(0,H.jsx)(p,{className:`size-4 shrink-0 opacity-50`})})]})})}function bt({className:e,...t}){return(0,H.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 xt({className:e,...t}){return(0,H.jsx)(J.Empty,{"data-slot":`command-empty`,className:E(`py-6 text-center text-sm`,e),...t})}function St({className:e,...t}){return(0,H.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 Ct({className:e,children:t,...n}){return(0,H.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,H.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 wt(e,t){let n=t.find(t=>t.key===e);return n?`${n.providerName} · ${n.label}`:e.split(`/`).at(-1)||e}function Tt({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?wt(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?`—`:F(u,a)],[i(`chat:focusSession.statAvgDuration`),d==null?`—`:F(d,a)]];return(0,H.jsxs)(`div`,{className:`session-stats-panel grid gap-[3px]`,"aria-label":i(`chat:focusSession.sessionStats`),children:[m.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-[10px] text-[length:var(--app-small-size)]`,children:[(0,H.jsx)(`span`,{className:`min-w-0 shrink-0 text-[var(--text-muted)]`,children:e}),(0,H.jsx)(`strong`,{className:`min-w-0 truncate text-right font-[500] text-[var(--text)] [font-variant-numeric:tabular-nums]`,children:t})]},e)),(0,H.jsx)(`small`,{className:`text-[var(--text-secondary)] text-[length:var(--app-small-size)] leading-normal`,children:i(`chat:focusSession.sessionStatsHint`)})]})}function Et({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,I.useState)(l),[p,m]=(0,I.useState)(!1),[h,g]=(0,I.useState)(``),_=(0,I.useRef)(l),v=(0,I.useRef)(void 0);(0,I.useEffect)(()=>{window.clearTimeout(v.current),f(l),_.current=l},[l]),(0,I.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,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-usage-row":n,title:r,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:e}),(0,H.jsx)(`strong`,{className:`min-w-0 truncate text-right font-medium text-content tabular-nums`,children:t})]});return(0,H.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,H.jsxs)(`div`,{className:`grid gap-1`,children:[k(a(`board:composer.contextUsage`),C,`context`),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`block h-[3px] overflow-hidden rounded-full bg-surface-active`,children:(0,H.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,H.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,H.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,H.jsx)(u,{size:13,"aria-hidden":`true`,className:`transition-transform duration-(--d-fast) group-open/usage:rotate-90`}),a(`chat:focusSession.sessionStats`)]}),(0,H.jsxs)(`div`,{className:`grid gap-2 pt-1.5`,children:[(0,H.jsx)(Tt,{model:n,availableModels:r,sessionUsage:t,contextUsage:e}),w&&(0,H.jsx)(`small`,{className:`text-content-muted`,children:w}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between font-medium text-content`,children:[(0,H.jsx)(`span`,{children:a(`chat:focusSession.autoCompactionThreshold`)}),(0,H.jsxs)(`output`,{className:`tabular-nums`,children:[d,`%`]})]}),(0,H.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,H.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 Dt({model:e,models:t,onModelChange:n,thinkingLevel:r,levels:i,status:a,message:s,onThinkingChange:c,modelDisabled:l,thinkingDisabled:u,deferred:f=!1,pendingModel:p=!1,usage:m,sheet:h=!1,side:g=`top`,thinkingIsDefault:_=!1,onThinkingReset:v,triggerClassName:y}){let{t:b}=o(),[x,S]=(0,I.useState)(!1),C=t.find(t=>t.key===e),w=t.map(e=>e.label),T=C?.label||e.split(`/`).at(-1)||``,D=T?P(T,w):b(`chat:focusSession.toolbarModel`),O=[...t.reduce((e,t)=>{let n=e.get(t.providerName)||[];return n.push(t),e.set(t.providerName,n)},new Map)],k=a!==`unsupported`&&i.length>0,A=k?$(b,r||i[0]):`—`,j=p?b(`chat:focusSession.thinkingAfterModelSwitch`):k?A:s||b(a===`unsupported`?`chat:focusSession.thinkingLevelUnsupported`:`chat:focusSession.loadingThinkingLevels`),M=u||x||!k||i.length<2,N=`${b(`chat:focusSession.modelAndThinking`)} · ${wt(e,t)} · ${j}`;return(0,H.jsxs)(Me,{sheet:h,title:b(`chat:focusSession.modelAndThinking`),align:`end`,side:g,sideOffset:8,className:`model-effort-popover w-[272px] max-w-[calc(100vw_-_24px)] gap-0 p-1`,trigger:(0,H.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-11 max-[650px]:gap-1 max-[650px]:rounded-md max-[650px]:border-stroke max-[650px]:pr-2 max-[650px]:pl-2.5 max-[650px]:text-sm pointer-coarse:h-11`,y),"aria-label":N,title:N,children:[(0,H.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:D}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-content-faint`,children:`·`}),(0,H.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:k?$(b,r||i[0]):`—`}),(0,H.jsx)(d,{size:14,className:`shrink-0 text-content-muted`,"aria-hidden":`true`})]}),children:[(0,H.jsxs)(`div`,{className:`model-effort-model flex flex-col gap-1 p-1.5 pb-2`,children:[(0,H.jsx)(`span`,{className:`px-0.5 text-xs font-medium text-content-muted`,children:b(`chat:focusSession.toolbarModel`)}),(0,H.jsxs)(vt,{defaultValue:e,filter:(e,t,n)=>+!![e,...n||[]].join(` `).toLowerCase().includes(t.trim().toLowerCase()),className:`rounded-sm! border border-stroke-soft bg-transparent p-0`,"aria-label":b(`chat:focusSession.currentChatModel`),children:[t.length>6&&(0,H.jsx)(yt,{placeholder:b(`chat:focusSession.searchModels`)}),(0,H.jsxs)(bt,{className:`max-h-56`,children:[(0,H.jsx)(xt,{className:`py-4 text-xs text-content-muted`,children:t.length?b(`chat:focusSession.noMatchingModels`):b(`chat:focusSession.noModelsAvailable`)}),!C&&e&&(0,H.jsx)(St,{children:(0,H.jsx)(Ct,{value:e,"data-checked":!0,disabled:!0,children:(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:D})})}),O.map(([t,r])=>(0,H.jsx)(St,{heading:t,children:r.map(t=>{let r=P(t.label,w);return(0,H.jsx)(Ct,{value:t.key,keywords:[t.label,t.providerName],"data-checked":t.key===e,disabled:l||x,onSelect:()=>{t.key!==e&&n(t.key)},children:(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-col`,title:t.label,children:[(0,H.jsx)(`span`,{className:`wrap-anywhere`,children:r}),r!==t.label&&(0,H.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:t.label})]})},t.key)})},t))]})]})]}),k&&(0,H.jsx)(De,{className:`border-t border-stroke-soft p-1.5 pt-2`,title:b(`chat:focusSession.thinkingLevelTitle`),levels:i,value:r,labelFor:e=>$(b,e),onCommit:async e=>{S(!0);try{await c(e)}finally{S(!1)}},disabled:M,ariaLabel:b(`chat:focusSession.currentThinkingLevel`),trailing:_?(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-content-faint`,children:b(`chat:focusSession.thinkingModelDefault`)}):v?(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 cursor-pointer rounded-sm text-xs text-content-muted underline-offset-2 hover:text-content hover:underline focus-visible:outline-2 focus-visible:outline-focus`,onClick:v,children:b(`chat:focusSession.thinkingReset`)}):void 0}),f&&(0,H.jsx)(`p`,{className:`px-2 pt-1 pb-2 text-xs leading-4 text-content-muted`,role:`status`,children:b(`chat:focusSession.runtimeSelectionDeferred`)}),(!k||i.length===1)&&(0,H.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:k?b(`chat:focusSession.thinkingLevelFixed`,{level:A}):j}),m]})}export{je as a,ve as c,Se as d,le as f,te as g,ne as h,Me as i,B as l,ge as m,Dt as n,Ee as o,de as p,$ as r,be as s,Et as t,V as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePicker-B9vYtfab.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-B5p-Kzvz.js","assets/i18n-CHmr7GzM.js","assets/vendor-router-CSN_DGvx.js","assets/index-CsE52ydO.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/check-2vYc6QaP.js","assets/triangle-alert-CE1q54ci.js","assets/button-CCcCN8tE.js","assets/vendor-ui-DvrYggeS.js","assets/dist-41X0pdUs.js","assets/utils-C8uzG5AZ.js","assets/dialog-CUhFgsVd.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/alert-firawb0H.js","assets/NewFolderDialog-BinpbTs8.js","assets/api-BO7LAPSQ.js","assets/abort-signal-f4JsiYKX.js","assets/folder-open-FIShC5Qk.js","assets/folder-plus-OPHZsJho.js","assets/input-group-h8z63MzW.js","assets/textarea-DmATpOqT.js","assets/pick-system-directory-B_RJmP26.js","assets/folder-paths-DQTpuGh9.js","assets/startup-queries-6Oztqpto.js","assets/query-Bj-DUNYq.js","assets/mutation-CEbxdVYy.js","assets/events-DrAPv0se.js","assets/session-workspaces-BWTBYaGT.js","assets/workspace-order-store-RYWvGOeR.js","assets/field-DoLEb0np.js","assets/label-CVWjEcfV.js","assets/separator-BPh_qxvc.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-B5p-Kzvz.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{o}from"./startup-queries-6Oztqpto.js";import{t as s}from"./runtime-capabilities-store-C2Qv7uDP.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./arrow-right-DqLOhpA2.js";import{t as u}from"./arrow-up-DST6-qVQ.js";import{t as d}from"./chevron-down-CxtxIjiP.js";import{t as f}from"./folder-open-FIShC5Qk.js";import{t as p}from"./folder-plus-OPHZsJho.js";import{i as ee,n as te,r as ne,t as re}from"./useNewProjectPicker-DQY1X_ua.js";import{t as ie}from"./shield-alert-oZqX6MNu.js";import{t as ae}from"./shield-B1ruzHd0.js";import{h as oe,l as se,n as ce,o as le,s as ue,u as de}from"./FocusRuntimeControls-C7NIdpV4.js";import{a as m,c as fe,i as pe,o as h,p as me,r as he,s as g,t as ge}from"./dropdown-menu-CFIFNaKO.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as _e}from"./button-CCcCN8tE.js";import{c as ve,r as ye,t as be}from"./shortcuts-Cvp9WD9O.js";import{t as xe}from"./useSessionListQuery-D44XZfGr.js";import{t as Se}from"./useBoardItems-CzEbgTLJ.js";import{a as Ce}from"./card-presentation-1oph2b8P.js";import{i as we,n as Te,t as Ee}from"./board-launch-BmmPYZe8.js";import{t as De}from"./public-launch-CT_m9KWo.js";import{t as Oe}from"./shortcut-aria-jHRmld9z.js";import{t as ke}from"./touch-target-BsyCgjR5.js";import{n as Ae,t as v}from"./workspace-order-store-RYWvGOeR.js";import{r as y,t as b}from"./board-projects-BU9fZB1q.js";var je=c(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),x=c(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),S=e(n(),1),Me=`data-[fade=both]:[mask-image:linear-gradient(to_right,transparent,var(--foreground)_1.25rem,var(--foreground)_calc(100%-1.25rem),transparent)] data-[fade=end]:[mask-image:linear-gradient(to_right,var(--foreground)_calc(100%-1.25rem),transparent)] data-[fade=start]:[mask-image:linear-gradient(to_left,var(--foreground)_calc(100%-1.25rem),transparent)]`;function Ne(e,t=``){let[n,r]=(0,S.useState)();return(0,S.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver!=`function`)return;let n=()=>{let e=t.scrollWidth-t.clientWidth,n=Math.abs(t.scrollLeft),i=e>1&&n>1,a=e>1&&n<e-1;r(i&&a?`both`:i?`start`:a?`end`:void 0)};n();let i=new ResizeObserver(n);i.observe(t);for(let e of Array.from(t.children))i.observe(e);return t.addEventListener(`scroll`,n,{passive:!0}),()=>{i.disconnect(),t.removeEventListener(`scroll`,n)}},[e,t]),n}var C=r();function Pe({value:e,onChange:t,size:n,compact:r=!1,className:a}){let{t:o}=i(),{items:s,capabilities:c}=Se(`today`);if(!c.sessionQueue)return null;let l=s.filter(e=>e.lane===`running`||e.lane===`queued`),u=s.find(t=>t.id===e);if(!l.length&&!e)return null;let f=u?.title??o(`board:launch.startAfterGone`),p=e?o(`board:launch.startAfterChip`,{title:f}):o(`board:launch.startNowChip`),ee=e?o(`board:launch.startAfterShort`,{title:f}):p;return(0,C.jsxs)(ge,{children:[(0,C.jsx)(me,{asChild:!0,children:(0,C.jsxs)(we,{size:n,className:_(`min-w-0 max-w-[24ch] shrink`,e?`min-w-[14ch]`:`border-transparent bg-transparent`,a),title:p,"aria-label":`${o(`board:launch.startAfterLabel`)} · ${p}`,"data-launch-start-after":e||`now`,children:[(0,C.jsx)(x,{"aria-hidden":`true`}),(!r||e)&&(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:ee}),(0,C.jsx)(d,{"aria-hidden":`true`})]})}),(0,C.jsxs)(he,{align:`start`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-72 overflow-y-auto`,children:[(0,C.jsx)(m,{children:o(`board:launch.startAfterLabel`)}),(0,C.jsxs)(h,{value:e,onValueChange:t,children:[(0,C.jsx)(g,{value:``,children:o(`board:launch.startNowChip`)}),l.map(e=>(0,C.jsx)(g,{value:e.id,"data-start-after-option":e.id,children:(0,C.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,C.jsx)(`span`,{className:`truncate`,children:e.title}),(0,C.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.lane===`running`?o(`board:launch.startAfterRunning`):o(`board:launch.startAfterQueued`)})]})},e.id))]}),(0,C.jsx)(`p`,{className:`px-2 py-1.5 text-xs leading-relaxed text-content-muted`,children:o(`board:launch.startAfterHint`)})]})]})}function w(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function T(e){return typeof e==`string`?e:``}function E(e){return(Array.isArray(w(e).providers)?w(e).providers:[]).flatMap(e=>{let t=w(e),n=T(t.id);return!n||t.configured!==!0||t.enabled===!1?[]:(Array.isArray(t.models)?t.models:[]).flatMap(e=>{let r=w(e),i=T(r.id);return!i||r.kind!==`chat`?[]:[{key:`${n}/${i}`,label:T(r.name)||i,providerName:T(t.name)||n,thinkingLevels:Array.isArray(r.thinkingLevels)?r.thinkingLevels.filter(e=>typeof e==`string`):[]}]})})}function Fe(){let e=a(o(`config`)),t=xe(),n=v(e=>e.names),r=Ae(e=>e.projects),i=s(e=>e.capabilities.features),c=(0,S.useMemo)(()=>E(e.data),[e.data]),l=e.data?.provider&&e.data?.model?`${e.data.provider}/${e.data.model}`:``,u=t.data?.sessions,d=(0,S.useMemo)(()=>y(u??[],r,n),[u,n,r]),f=(0,S.useMemo)(()=>b(u??[],d),[u,d]);return{models:c,defaultModel:l,defaultThinkingLevel:T(e.data?.thinkingLevel)||`medium`,projects:d,defaultCwd:f,goalsAvailable:i.goals!==!1,teamAvailable:i.goals!==!1&&i.multiAgent!==!1,loading:e.isPending,error:e.error??null}}var Ie=(0,S.lazy)(()=>t(()=>import(`./WorkspacePicker-B9vYtfab.js`).then(e=>({default:e.WorkspacePicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),Le=(0,S.lazy)(()=>t(()=>import(`./NewFolderDialog-BinpbTs8.js`).then(e=>({default:e.NewFolderDialog})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,25,26,27,10,28,12,13,14,15,16,17,18,19,20,21,22,29,30,31,32,33,34,35,36,37,38,23,39,40,41]))),Re=`board:launch`,ze=`home:new`,Be=`\0no-project`,Ve=new Set;function He(e,t){let n=se(e).text,r=n.trim()?`${t}\n${n}`:t;de(e,{text:r});for(let t of Ve)t.key===e&&t.apply(r)}function Ue(){let{t:e}=i();return(0,S.useMemo)(()=>({thinking:t=>({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,execution:{"approval-required":e(`chat:focusSession.approvalRequired`),"workspace-write":e(`chat:focusSession.workspaceWrite`),"full-access":e(`chat:focusSession.fullAccess`)},runMode:{plan:e(`chat:focusSession.planMode`),goal:e(`chat:focusSession.goalMode`),team:e(`chat:focusSession.teamMode`)}}),[e])}function We(e){return!e.value||e.selectionStart===0&&e.selectionEnd===0}var D=(0,S.forwardRef)(function({variant:e,autoFocus:t,compactChips:n,touch:r,onDispatched:a,onDetachedFailure:o,onConfigureModels:c,className:xe},Ae){let{t:v}=i(),y=Ue(),b=Fe(),x=ne(),w=ve(e=>e.bindings.sendMessage),T=(0,S.useRef)(null),E=(0,S.useRef)(null),D=e===`composer`?ze:Re,Ge=e=>He(D,e),[O,Ke]=(0,S.useState)(()=>se(D).text),[k,A]=(0,S.useState)(null),[j,qe]=(0,S.useState)(0),[M,Je]=(0,S.useState)(!1),[N,Ye]=(0,S.useState)(``),{items:Xe}=Se(`today`),Ze=N?Xe.find(e=>e.id===N)?.title??v(`board:launch.startAfterGone`):``,P=(0,S.useRef)(!0),F=(0,S.useRef)(null),I=re({onProjectChosen:()=>{if(r||e===`sheet`)return;let t=T.current;t&&(t.focus(),t.setSelectionRange(t.value.length,t.value.length))},onError:e=>{P.current&&A({message:e,noModel:!1})}}),{mounted:Qe,...$e}=I.picker,{mounted:et,...tt}=I.folderDialog,nt=s(e=>e.capabilities.features.workspaceFolders),L=`launch-input-${e}`,rt=`launch-error-${e}`;(0,S.useEffect)(()=>{P.current=!0;let e={key:D,apply:e=>Ke(e)};return Ve.add(e),()=>{P.current=!1,Ve.delete(e)}},[D]);let R=(0,S.useCallback)(e=>{Ke(e),de(D,{text:e})},[D]);(0,S.useImperativeHandle)(Ae,()=>({focus:()=>T.current?.focus(),focusEnd:()=>{let e=T.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)},fill:e=>{R(e),T.current?.focus()}}),[R]);let it=b.models.some(e=>e.key===x.model),z=it?x.model:b.defaultModel,B=b.models.find(e=>e.key===z)?.thinkingLevels??[],V=B.includes(x.thinkingLevel)?x.thinkingLevel:``,at=V||(B.includes(b.defaultThinkingLevel)?b.defaultThinkingLevel:``),H=M?`full-access`:x.executionMode||`approval-required`,U=x.runMode===`team`&&!b.teamAvailable||x.runMode===`goal`&&!b.goalsAvailable?`plan`:x.runMode,W=(0,S.useMemo)(()=>{if(!x.cwd||b.projects.some(e=>e.cwd===x.cwd))return b.projects;let e=x.cwd.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||x.cwd;return[{key:x.cwd,cwd:x.cwd,label:e},...b.projects]},[x.cwd,b.projects]),G=(0,S.useMemo)(()=>Ce(W),[W]),K=x.projectless,q=K?``:x.cwd||b.defaultCwd||W[0]?.cwd||``,J=K?void 0:W.find(e=>e.cwd===q),ot=J?.label||v(K?`board:launch.noProject`:`board:launch.defaultProject`),st=!b.loading&&!b.error&&b.models.length===0,ct=e=>{if(W.length<2)return!1;let t=Math.max(0,W.findIndex(e=>e.cwd===q)),n=W[(t+e+W.length)%W.length];return x.rememberLaunch({cwd:n.cwd}),!0},lt=e=>{Je(e===`full-access`),e!==`full-access`&&x.rememberLaunch({executionMode:e})},ut=(0,S.useCallback)(()=>De(q),[q]),dt=oe({t:v,models:b.models,model:z,onModel:e=>x.rememberLaunch({model:e,thinkingLevel:``}),thinkingLevels:B,thinkingLevel:at,thinkingLabel:y.thinking,onThinking:e=>x.rememberLaunch({thinkingLevel:e}),executionModes:te,executionMode:H,executionLabel:e=>y.execution[e]||e,onExecutionMode:e=>lt(e),runModes:[`plan`,...b.goalsAvailable?[`goal`]:[],...b.teamAvailable?[`team`]:[]],runMode:U,runModeLabel:e=>y.runMode[e]||e,onRunMode:e=>x.rememberLaunch({runMode:e})}),ft=(0,C.jsx)(le,{placement:e===`composer`?`top`:`bottom`,resourceKey:q,loadCommands:ut,builtinCommands:dt,value:O,onChange:R,inputRef:T}),Y=e===`composer`,pt=Ne(E,Y?`${q}|${z}|${H}|${U}`:``),X=async e=>{let t=O.trim();if(!t){T.current?.focus();return}if(Y&&j>0)return;if(st){A({message:v(`board:launch.noModel`),noModel:!0});return}A(null),R(``),ue(D),T.current?.focus(),qe(e=>e+1),Je(!1),x.rememberLaunch({...K?{projectless:K}:{cwd:q},model:it?z:``,thinkingLevel:V,executionMode:H,runMode:U});let n=N;Ye(``);try{let r=await Te({prompt:t,cwd:q,projectless:K,model:it?z:``,thinkingLevel:V,executionMode:M?`full-access`:x.executionMode,runMode:U,...n?{startAfter:n}:{}});a?.(r,{open:e})}catch(e){Ge(t),P.current&&n&&Ye(n);let r=e instanceof Ee||e instanceof Error?e.message:``,i=r?v(`board:launch.failedWithReason`,{reason:r}):v(`board:launch.failed`);P.current?A({message:i,noModel:!1}):o?.(i)}finally{P.current&&qe(e=>Math.max(0,e-1))}},mt=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(Y){if(ye(e.nativeEvent,w)){e.preventDefault(),X(!0);return}}else if(e.key===`Enter`&&!e.shiftKey&&!e.altKey){e.preventDefault(),X(e.metaKey||e.ctrlKey);return}e.key===`Tab`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&We(e.currentTarget)&&ct(1)&&e.preventDefault()}},ht=O.split(`
|
|
3
|
-
`).length,Z=e===`sheet`,gt=n||Z,Q=Z||Y?`default`:`sm`,_t=Z?`min-h-11`:Q===`sm`?`pointer-coarse:min-h-11`:void 0,vt=(0,C.jsxs)(ge,{children:[(0,C.jsx)(me,{asChild:!0,children:(0,C.jsxs)(we,{size:Q,className:_(Z?`max-w-[13ch] min-w-0 shrink`:Y&&r?`max-w-[14ch]`:`max-w-[24ch] min-w-0 shrink`,Z?`min-h-11`:Q===`sm`?ke:void 0),title:J?.cwd||void 0,"aria-label":v(`board:launch.projectLabel`,{project:J?G.get(J.key)?`${J.label} (${G.get(J.key)})`:J.label:ot}),children:[(0,C.jsx)(ee,{"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:_(`truncate`,J?.label&&!Z?`min-w-[8ch] font-mono`:`min-w-0`,J?.label&&Z&&`font-mono`),children:ot}),(0,C.jsx)(d,{"aria-hidden":`true`})]})}),(0,C.jsxs)(he,{align:`start`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-64 overflow-y-auto`,onCloseAutoFocus:e=>{let t=F.current;t&&(F.current=null,e.preventDefault(),t())},children:[(0,C.jsxs)(h,{value:K?Be:q,onValueChange:e=>x.rememberLaunch(e===Be?{projectless:!0}:{cwd:e}),children:[(0,C.jsx)(g,{value:Be,children:(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:v(`board:launch.noProject`)})}),(0,C.jsx)(fe,{}),(0,C.jsx)(m,{children:v(`board:launch.projects`)}),W.length===0&&(0,C.jsx)(g,{value:``,children:v(`board:launch.defaultProject`)}),W.map(e=>(0,C.jsxs)(g,{value:e.cwd,title:e.cwd,children:[(0,C.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.label}),G.get(e.key)&&(0,C.jsx)(`span`,{className:`ml-auto min-w-0 truncate pl-2 font-mono text-xs text-content-muted`,children:G.get(e.key)})]},e.key))]}),(0,C.jsx)(fe,{}),(0,C.jsxs)(pe,{disabled:I.picking,"data-launch-new-project":!0,onSelect:()=>F.current=()=>void I.newProject(),children:[(0,C.jsx)(f,{"aria-hidden":`true`}),v(`board:launch.chooseFolder`)]}),nt&&(0,C.jsxs)(pe,{"data-launch-new-folder":!0,onSelect:()=>F.current=()=>I.newFolder(q||b.defaultCwd),children:[(0,C.jsx)(p,{"aria-hidden":`true`}),v(`board:launch.newFolder`)]})]})]}),yt=(Qe||et)&&(0,C.jsxs)(S.Suspense,{fallback:null,children:[Qe&&(0,C.jsx)(Ie,{...$e}),et&&(0,C.jsx)(Le,{...tt})]}),bt=(0,C.jsx)(ce,{sheet:Z,side:Y?`top`:`bottom`,model:z,models:b.models,onModelChange:e=>x.rememberLaunch({model:e,thinkingLevel:``}),thinkingLevel:at,levels:B,status:b.loading?``:`supported`,onThinkingChange:e=>x.rememberLaunch({thinkingLevel:e}),thinkingIsDefault:!V,onThinkingReset:()=>x.rememberLaunch({thinkingLevel:``}),modelDisabled:!b.models.length,triggerClassName:_(Z?`max-w-[13ch]`:`max-w-[24ch]`,_t)}),xt=H===`full-access`?ie:ae,St=U===`plan`?y.execution[H]:`${y.runMode[U]} · ${y.execution[H]}`,Ct=(0,C.jsxs)(ge,{children:[(0,C.jsx)(me,{asChild:!0,children:(0,C.jsxs)(we,{size:Q,className:_(`min-w-0 max-w-[26ch] border-transparent bg-transparent`,Z&&`flex-none`,_t),title:`${v(`chat:focusSession.approvalMode`)} · ${St}${M?` · ${v(`board:launch.fullAccessOnce`)}`:``}`,"aria-label":`${v(`chat:focusSession.approvalMode`)} · ${St}${M?` · ${v(`board:launch.fullAccessOnce`)}`:``}`,"data-launch-mode":`${U}:${H}`,children:[(0,C.jsx)(xt,{"aria-hidden":`true`}),(0,C.jsx)(`span`,{className:`truncate`,children:gt&&U===`plan`&&H!==`full-access`?``:St}),(0,C.jsx)(d,{"aria-hidden":`true`})]})}),(0,C.jsxs)(he,{align:`start`,className:`w-64`,children:[(0,C.jsx)(m,{children:v(`chat:focusSession.approvalMode`)}),(0,C.jsx)(h,{value:H,onValueChange:e=>lt(e),children:te.map(e=>(0,C.jsx)(g,{value:e,children:e===`full-access`?(0,C.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,C.jsx)(`span`,{children:y.execution[e]}),(0,C.jsx)(`span`,{className:`text-xs text-content-muted`,children:v(`board:launch.fullAccessOnce`)})]}):y.execution[e]},e))}),(b.goalsAvailable||b.teamAvailable)&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(fe,{}),(0,C.jsx)(m,{children:v(`chat:focusSession.executionMode`)}),(0,C.jsxs)(h,{value:U,onValueChange:e=>x.rememberLaunch({runMode:e}),children:[(0,C.jsx)(g,{value:`plan`,children:y.runMode.plan}),b.goalsAvailable&&(0,C.jsx)(g,{value:`goal`,children:y.runMode.goal}),b.teamAvailable&&(0,C.jsx)(g,{value:`team`,children:y.runMode.team})]})]})]})]}),wt=(0,C.jsx)(Pe,{value:N,onChange:Ye,size:Q,compact:gt,className:_(_t,Z&&`flex-none`)}),Tt=(0,C.jsxs)(`div`,{ref:E,"data-fade":pt,"data-launch-chips":!0,className:_(`flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto [scrollbar-width:none]`,Me),children:[vt,Ct,wt]}),Et=Y?(0,C.jsx)(_e,{type:`button`,size:`icon`,className:_(`flex-none rounded-full`,r?`size-11`:`size-8 pointer-coarse:size-11`),disabled:j>0,"aria-label":v(`board:home.send`),"aria-keyshortcuts":Oe(w),title:w?`${v(`board:home.send`)} (${be(w)})`:void 0,"data-launch-send":!0,onClick:()=>void X(!1),children:(0,C.jsx)(u,{"aria-hidden":`true`})}):(0,C.jsxs)(_e,{type:`button`,size:`sm`,className:_(`flex-none`,Z&&`min-h-11 px-4`),onClick:()=>void X(!1),"aria-keyshortcuts":`Enter`,children:[v(`board:launch.dispatch`),!Z&&(0,C.jsx)(je,{"aria-hidden":`true`,className:`opacity-70`})]}),$=k&&(0,C.jsxs)(`p`,{id:rt,role:`alert`,className:`flex min-w-0 items-center gap-2 text-xs text-st-fail`,children:[(0,C.jsx)(`span`,{className:`min-w-0 truncate`,children:k.message}),k.noModel&&(0,C.jsxs)(_e,{variant:`link`,size:`xs`,className:`h-auto px-0`,onClick:c,children:[v(`board:launch.configureModels`),(0,C.jsx)(l,{"aria-hidden":`true`})]})]}),Dt=j>0&&(0,C.jsx)(`span`,{role:`status`,className:`flex-none text-xs text-content-muted`,children:Y?v(`board:home.sending`):v(`board:launch.sending`,{count:j})});return Y?(0,C.jsxs)(`section`,{"aria-label":v(`board:home.composerLabel`),"data-launch-console":e,className:_(`flex min-w-0 flex-col rounded-[var(--composer-radius,22px)] border border-control bg-panel shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) has-[textarea:focus-visible]:border-focus has-[textarea:focus-visible]:ring-3 has-[textarea:focus-visible]:ring-focus-ring max-[650px]:rounded-2xl`,xe),children:[(0,C.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:v(`board:launch.inputLabel`)}),ft,(0,C.jsx)(`textarea`,{ref:T,id:L,"data-launch-input":!0,autoFocus:t,rows:Math.min(6,Math.max(2,ht)),value:O,placeholder:r?v(`board:home.placeholderTouch`):w?v(`board:home.placeholder`,{send:be(w)}):v(`board:home.placeholderUnbound`),"aria-invalid":k?!0:void 0,"aria-describedby":k?rt:void 0,"aria-keyshortcuts":Oe(w),onChange:e=>{R(e.target.value),k&&!k.noModel&&A(null)},onKeyDown:mt,className:_(`max-h-[220px] min-h-11 w-full min-w-0 resize-none bg-transparent px-4 pt-3 pb-1 text-[length:calc(var(--app-message-font-size)*.9375)] leading-5 text-content outline-none placeholder:text-content-muted max-[650px]:px-3.5`,r&&`text-[length:var(--app-message-font-size)]`)}),$&&(0,C.jsx)(`div`,{className:`px-4 max-[650px]:px-3.5`,children:$}),(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-2 pt-1 pb-2`,"data-launch-toolbar":!0,children:[Tt,Dt,(0,C.jsx)(`span`,{className:`flex min-w-0 shrink items-center`,children:bt}),Et]}),yt]}):(0,C.jsxs)(`section`,{"aria-label":v(`board:launch.title`),"data-launch-console":e,className:_(`flex min-w-0 flex-col`,xe),children:[(0,C.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:v(`board:launch.inputLabel`)}),ft,(0,C.jsx)(`textarea`,{ref:T,id:L,"data-launch-input":!0,autoFocus:t,rows:Math.min(8,Math.max(3,ht)),value:O,placeholder:v(Z?`board:launch.placeholderTouch`:`board:launch.placeholder`),"aria-invalid":k?!0:void 0,"aria-describedby":k?rt:void 0,"aria-keyshortcuts":`Enter Meta+Enter Control+Enter Shift+Enter`,onChange:e=>{R(e.target.value),k&&!k.noModel&&A(null)},onKeyDown:mt,className:_(`w-full min-w-0 resize-none bg-transparent text-content caret-st-attn-fill outline-none placeholder:text-content-muted`,Z?`max-h-[40dvh] min-h-[88px] rounded-[var(--r-md)] border border-control bg-panel px-3 py-2.5 text-[16px] leading-6 transition-[border-color,box-shadow] duration-(--d-fast) focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring`:`max-h-[240px] min-h-[72px] px-5 pt-1 pb-2 text-[15px] leading-6`)}),$&&(0,C.jsx)(`div`,{className:Z?`pt-1.5`:`px-5 pb-1`,children:$}),Ze&&(0,C.jsx)(`p`,{"data-launch-start-after-note":!0,className:_(`text-xs text-content-muted`,Z?`pt-1.5`:`px-5 pb-1`),children:v(`board:launch.startAfterNote`,{title:Ze})}),(0,C.jsxs)(`div`,{className:_(`flex min-w-0 items-center gap-1.5`,Z?`pt-2`:`px-3 pb-3`),"data-launch-toolbar":!0,children:[(0,C.jsxs)(`div`,{ref:E,"data-launch-chips":!0,className:`flex min-w-0 flex-[1_1_auto] items-center gap-1.5 overflow-hidden`,children:[vt,Ct,wt]}),Dt,(0,C.jsx)(`span`,{className:`flex min-w-0 shrink items-center`,children:bt}),Et]}),yt]})});export{D as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B5p-Kzvz.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./arrow-down-CDGua-ue.js";import{t as o}from"./arrow-up-DST6-qVQ.js";import{t as s}from"./folder-plus-OPHZsJho.js";import{t as c}from"./pencil-U08v_vV9.js";import{t as l}from"./rotate-ccw-C0v8V77_.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./utils-C8uzG5AZ.js";import{n as f,t as p}from"./button-CCcCN8tE.js";import{t as m}from"./useSessionListQuery-D44XZfGr.js";import{s as h}from"./card-presentation-1oph2b8P.js";import{a as g,i as _,l as v,n as y,o as b,s as x,t as S}from"./dialog-CUhFgsVd.js";import{n as C,t as w}from"./workspace-order-store-RYWvGOeR.js";import{n as T}from"./board-projects-BU9fZB1q.js";var E=i(`folder-minus`,[[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),D=e(t(),1),O=n(),k=`flex-none pointer-coarse:size-11 in-data-[phone-shell]:size-11`;function A({open:e,onOpenChange:t,commands:n}){let{t:i}=r(),A=m(),j=w(e=>e.order),M=w(e=>e.names),N=C(e=>e.projects),P=w(e=>e.rememberWorkspaces),F=w(e=>e.moveWorkspace),I=(0,D.useRef)(null),L=(0,D.useRef)(null),[R,z]=(0,D.useState)(null),[B,V]=(0,D.useState)(null),H=(0,D.useMemo)(()=>T(A.data?.sessions??[],N,M,j,i(`board:filter.noProject`)),[A.data,M,j,N,i]),U=(0,D.useMemo)(()=>H.map(e=>e.key),[H]);(0,D.useEffect)(()=>{e&&U.length&&P(U)},[U,e,P]),(0,D.useEffect)(()=>{if(!R)return;let e=I.current,t=t=>e?.querySelector(`[data-project-move="${t}"][data-project-key="${CSS.escape(R.key)}"]`),n=t(R.offset);(n&&!n.disabled?n:t(R.offset===-1?1:-1))?.focus(),z(null)},[R,H]),(0,D.useEffect)(()=>{B&&(V(null),!H.some(e=>e.key===B.key)&&((B.next?I.current?.querySelector(`[data-project-remove][data-project-key="${CSS.escape(B.next)}"]`):null)??L.current)?.focus())},[H,B]);let W=(e,t)=>{F(e.key,t,U),z({key:e.key,offset:t})},G=async(e,t)=>{let r=H[t+1]?.key??H[t-1]?.key??``;e.count===0?n.unregister(e):await n.remove(e),V({key:e.key,next:r})},K=!!n.busyKey,q;return q=A.isPending?(0,O.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-6 text-sm text-content-muted`,children:[(0,O.jsx)(f,{className:`size-4`}),i(`board:project.loading`)]}):A.error&&!A.data?(0,O.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 py-6 text-sm`,children:[(0,O.jsx)(`p`,{className:`text-content`,children:i(`board:project.error`)}),(0,O.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>void A.refetch(),children:i(`board:page.retry`)})]}):H.length===0?(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 py-6 text-sm`,children:[(0,O.jsx)(`p`,{className:`font-medium text-content`,children:i(`board:project.empty`)}),(0,O.jsx)(`p`,{className:`text-content-muted`,children:i(`board:project.emptyHint`)})]}):(0,O.jsx)(`ul`,{ref:I,"aria-label":i(`board:project.listLabel`),className:`flex flex-col divide-y divide-stroke-soft`,"data-manage-projects":!0,children:H.map((e,t)=>{let r=n.busyKey===e.key,s=e.cwd&&e.key!==`\0`,m=e.count===0,g=i(m?`board:project.removeNamed`:`board:project.deleteWithChatsNamed`,{project:e.label});return(0,O.jsxs)(`li`,{"data-project-row":e.key,"data-project-registered-only":m||void 0,"aria-busy":r||void 0,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 py-2`,children:[(0,O.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 flex-none place-items-center rounded-sm border border-stroke-strong bg-solid font-mono text-xs font-semibold text-content uppercase`,children:Array.from(e.label)[0]||`·`}),(0,O.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,O.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-content`,children:e.label}),(0,O.jsx)(`span`,{className:`truncate font-mono text-xs text-content-muted`,title:e.cwd||void 0,children:e.custom?`${i(`board:project.folderName`,{name:e.folderLabel})} · ${h(e.cwd)}`:e.cwd?h(e.cwd):``})]}),(0,O.jsx)(`span`,{className:`flex-none text-xs text-content-muted tabular-nums max-[480px]:hidden`,children:r?i(`board:project.deleting`):i(`board:project.sessions`,{count:e.count})}),(0,O.jsxs)(`span`,{className:`flex flex-none items-center max-[480px]:w-full max-[480px]:justify-end`,children:[(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"data-project-move":`-1`,"data-project-key":e.key,disabled:t===0,"aria-label":i(`board:project.moveUp`,{project:e.label}),title:i(`board:project.moveUp`,{project:e.label}),onClick:()=>W(e,-1),children:(0,O.jsx)(o,{"aria-hidden":`true`})}),(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"data-project-move":`1`,"data-project-key":e.key,disabled:t===H.length-1,"aria-label":i(`board:project.moveDown`,{project:e.label}),title:i(`board:project.moveDown`,{project:e.label}),onClick:()=>W(e,1),children:(0,O.jsx)(a,{"aria-hidden":`true`})}),s&&(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"aria-label":i(`board:project.renameNamed`,{project:e.label}),title:i(`board:project.renameNamed`,{project:e.label}),onClick:()=>void n.rename(e),children:(0,O.jsx)(c,{"aria-hidden":`true`})}),s&&e.custom&&(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:k,"aria-label":i(`board:project.resetNamed`,{project:e.label}),title:i(`board:project.resetNamed`,{project:e.label}),onClick:()=>n.resetName(e),children:(0,O.jsx)(l,{"aria-hidden":`true`})}),(0,O.jsx)(p,{variant:`ghost`,size:`icon-sm`,className:d(k,!m&&`text-danger hover:text-danger`),disabled:K,"data-project-remove":m?`unregister`:`delete`,"data-project-key":e.key,"aria-label":g,title:g,onClick:()=>void G(e,t),children:r?(0,O.jsx)(f,{className:`size-4`}):m?(0,O.jsx)(E,{"aria-hidden":`true`}):(0,O.jsx)(u,{"aria-hidden":`true`})})]})]},e.key)})}),(0,O.jsx)(S,{open:e,onOpenChange:t,children:(0,O.jsxs)(_,{size:`wide`,scrollMode:`body`,"aria-describedby":`board-manage-projects`,onOpenAutoFocus:e=>{e.preventDefault(),L.current?.focus()},children:[(0,O.jsxs)(x,{children:[(0,O.jsx)(v,{children:i(`board:project.manageTitle`)}),(0,O.jsx)(g,{id:`board-manage-projects`,children:i(`board:project.manageDescription`)})]}),(0,O.jsx)(y,{className:`-mx-1 px-1`,children:q}),(0,O.jsxs)(b,{children:[(0,O.jsxs)(p,{variant:`outline`,size:`dialogAction`,disabled:n.picking,onClick:()=>{t(!1),n.newProject()},children:[(0,O.jsx)(s,{"aria-hidden":`true`}),i(`board:project.new`)]}),(0,O.jsx)(p,{ref:L,size:`dialogAction`,onClick:()=>t(!1),children:i(`board:project.done`)})]})]})})}export{A as ManageProjectsDialog};
|
|
@@ -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-B5p-Kzvz.js";import{t as i}from"./api-BO7LAPSQ.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-Cvp9WD9O.js";import{n as b,r as x,t as re}from"./PageState-Cz6vFMXv.js";import{t as S}from"./input-CPw-zkYh.js";import{t as ie}from"./textarea-DmATpOqT.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-Bkt1wWVg.js";import{n as C}from"./field-DoLEb0np.js";import{c as fe,i as pe,n as w,t as T}from"./app-primitives-Drz_SjnR.js";import{t as E}from"./AppSelect-BGVBQRP1.js";var D=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`}]]),O=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`}]]),k=e(t(),1);function me(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,k.useState)(null),[a,o]=(0,k.useState)(()=>!document.hidden),[s,c]=(0,k.useState)(!0),l=(0,k.useCallback)(e=>{i(e)},[]);return(0,k.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,k.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 A=n(),j={width:600,height:420,cx:300,cy:206},he=24,M=Math.PI*(3-Math.sqrt(5));function ge({type:e}){return(0,A.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:N[e]}})}var N={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)`},_e={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 P(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function F(e,t){let n=e.slice(0,he);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:j.cx,y:j.cy,twinkle:0}];let r=P(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=P(e.id),a=t*M+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:j.cx+Math.cos(a)*o*1.38,y:j.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function I(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 ve({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,k.useState)(1),[f,p]=(0,k.useState)(``),m=(0,k.useRef)(null),h=(0,k.useRef)(0),{ref:ee,playing:g}=me(),te=(0,k.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,k.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,k.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,k.useMemo)(()=>F(e,n),[e,n]),b=(0,k.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),re=(0,k.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,A.jsxs)(T,{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,A.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,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,A.jsx)(u,{})}),(0,A.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,A.jsx)(O,{})}),(0,A.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,A.jsx)(D,{})})]}),(0,A.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,A.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,A.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,A.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,A.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,A.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,A.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,A.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,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,A.jsx)(`defs`,{children:re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,A.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,A.jsx)(`stop`,{offset:`0`,stopColor:N[n.node.type]||`var(--galaxy-line-active)`}),(0,A.jsx)(`stop`,{offset:`1`,stopColor:N[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),re.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=I(n,r,P(e.id));return(0,A.jsxs)(`g`,{children:[(0,A.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,A.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,A.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,A.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,A.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,A.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,A.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/j.width*100}%`,top:`${n/j.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":P(e.id)%100/100,"--g-star-color":N[e.type],"--g-star-glow":_e[e.type]},title:e.content,children:[i===e.id&&(0,A.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,A.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,A.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,A.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,A.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,A.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,A.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,A.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,A.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,A.jsx)(x,{size:44}),(0,A.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],L=`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`,R=`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)]`,z=`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 be(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 xe(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 B(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function V(e){return e instanceof Error?e.message:String(e)}function Se({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,ie]=(0,k.useState)(``),{t:C,language:w}=r(),[T,E]=(0,k.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[D,O]=(0,k.useState)(``),[me,j]=(0,k.useState)(``),[he,M]=(0,k.useState)(``),[N,_e]=(0,k.useState)(`galaxy`),P=(0,k.useRef)(null),F=(0,k.useRef)(0),[I,L]=(0,k.useState)(!0),[R,Se]=(0,k.useState)(!1),[Te,H]=(0,k.useState)(``),[Ee,U]=(0,k.useState)(null),[De,Oe]=(0,k.useState)(null),[W,ke]=(0,k.useState)(``),[G,Ae]=(0,k.useState)(null),[je,K]=(0,k.useState)(``),[Me,Ne]=(0,k.useState)(`load`),[Pe,Fe]=(0,k.useState)(!0),q=(0,k.useRef)(null),J=(0,k.useRef)(0),Ie=(0,k.useRef)(0),Le=(0,k.useRef)(0),Re=(0,k.useRef)(null),Y=(0,k.useRef)(null),ze=(0,k.useRef)(!1),X=(0,k.useRef)(null),Z=(0,k.useRef)(!0),[Be,Ve]=(0,k.useState)(!1),Q=(0,k.useCallback)(async(e=``)=>{let t=++F.current;L(!0),H(``);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!==F.current)return;E(r),Se(!0),O(r.selectedSpaceId||``),j(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===F.current&&H(V(e))}finally{t===F.current&&L(!1)}},[x]);(0,k.useEffect)(()=>(Q(D),()=>{F.current+=1}),[Q,D]);let He=(0,k.useCallback)(async()=>{Re.current?.abort();let e=new AbortController;Re.current=e;let t=++Ie.current,n=J.current,r=n===Le.current;Fe(!0),K(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Z.current||t!==Ie.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(C(`memory:memoryPage.invalidAutoApproveThreshold`));r&&J.current===n&&(q.current=o,Ae(String(o)))}catch(n){!e.signal.aborted&&Z.current&&t===Ie.current&&(Ne(`load`),K(V(n)))}finally{!e.signal.aborted&&Z.current&&t===Ie.current&&Fe(!1)}},[C]);(0,k.useEffect)(()=>(Z.current=!0,He(),()=>{Z.current=!1,Re.current?.abort(),Y.current?.abort(),X.current=null}),[He]);let Ue=async()=>{if(G===null||!G.trim()||q.current===null)return;let t=Number(G);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!Y.current&&!ze.current&&n===q.current){X.current=null,Le.current=J.current,Ae(String(n)),K(``);return}if(X.current={value:n,revision:J.current},Y.current)return;let r=new AbortController;Y.current=r,Ve(!0),K(``);try{for(;X.current&&Z.current&&!r.signal.aborted;){let t=X.current;if(X.current=null,t.value!==q.current||ze.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Z.current||r.signal.aborted)return;X.current||=t,ze.current=!0,Ne(`save`),K(V(e));return}if(!Z.current||r.signal.aborted)return;q.current=t.value,ze.current=!1}Le.current=t.revision,J.current===t.revision&&(Ae(String(t.value)),X.current||e(C(`memory:memoryPage.autoApproveSaved`)))}}finally{Y.current===r&&(Y.current=null,Z.current&&Ve(!1))}},We=T.nodes.find(e=>e.id===me)||null,Ge=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))}},$=T.spaces.find(e=>e.id===D),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 Q(D)}catch(e){H(V(e))}},qe=async(t,n)=>{if(!W){ke(t.id),H(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(C(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Je=async()=>{if(!(W||!T.candidates?.length)){ke(`__all__`),H(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(C(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Ye=async()=>{if($&&await n({title:C(`memory:memoryPage.deleteMemorySpace`),message:C(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:B($,C)}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent($.id)}`,{method:`DELETE`}),O(``),j(``),e(C(`memory:memoryPage.memorySpaceDeleted`))}catch(e){H(V(e))}},Xe=C(`navigation:navigation.memory`),Ze=B($,C),Qe=e=>{j(e),requestAnimationFrame(()=>P.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=Ge(e.id);return(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,A.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,A.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,A.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,A.jsxs)(`dl`,{children:[(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.memoryType`)}),(0,A.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,A.jsx)(ge,{type:e.type}),be(e.type,C)]})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.source`)}),(0,A.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,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.authority`)}),(0,A.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.evidence`)}),(0,A.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.created`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:xe(e.createdAt,w)})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.relatedMemories`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:C(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,A.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,A.jsx)(p,{}),C(`memory:memoryPage.delete`)]}),(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>U(e),children:[(0,A.jsx)(l,{}),C(`memory:memoryPage.edit`)]})]}),(0,A.jsxs)(`section`,{className:`min-w-0`,"aria-label":C(`memory:memoryPage.relatedFiles`),children:[(0,A.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,A.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,A.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,A.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,A.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,A.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||C(`memory:memoryPage.localMemory`)})]}),(0,A.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,A.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>N===`galaxy`?j(t.id):M(t.id),children:C(`memory:memoryPage.view`)}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>U(t),children:(0,A.jsx)(l,{})}),(0,A.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,A.jsx)(p,{})})]})]},t.id))}):(0,A.jsx)(`p`,{className:`text-xs text-content-muted`,children:C(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,A.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,A.jsx)(ue,{search:(0,A.jsx)(ae,{id:h,value:x,onValueChange:ie,placeholder:C(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:C(`navigation:more.clearSearch`)}),actions:(0,A.jsxs)(v,{type:`button`,className:`h-9`,disabled:!R,onClick:()=>U({spaceId:D||T.selectedSpaceId}),children:[(0,A.jsx)(u,{}),C(`memory:memoryPage.addMemory`)]}),filters:(0,A.jsx)(fe,{options:[C(`memory:memoryPage.galaxyView`),C(`memory:memoryPage.listView`)],value:C(N===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>_e(e===C(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!R&&I?(0,A.jsx)(b,{kind:`loading`,title:C(`common:pageTemplate.loading`)}):R?(0,A.jsxs)(A.Fragment,{children:[Te&&(0,A.jsx)(de,{children:Te}),(0,A.jsx)(ce,{title:C(`memory:memoryPage.memorySpaces`),count:T.spaces.length,actions:(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe({}),children:[(0,A.jsx)(u,{}),C(`memory:memoryPage.newMemorySpace`)]}),children:(0,A.jsx)(se,{children:T.spaces.map(e=>{let t=e.id===D;return(0,A.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,A.jsx)(f,{}),onOpen:()=>{O(e.id),j(``),M(``)},name:B(e,C),status:C(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,A.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe(e),children:[(0,A.jsx)(l,{}),C(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,A.jsx)(p,{}),C(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,A.jsx)(ce,{"data-memory-stars":!0,title:Ze||C(`memory:memoryPage.memorySpaces`),count:T.nodes.length,actions:(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:I,disabled:I,"aria-label":C(`memory:memoryPage.refresh`),title:C(`memory:memoryPage.refresh`),onClick:()=>void Q(D),children:(0,A.jsx)(d,{})}),children:N===`galaxy`?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,A.jsx)(ve,{nodes:T.nodes,links:T.links,spaceId:D,selectedId:me,loading:I,onSelect:Qe,onAdd:()=>U({spaceId:D})}),(0,A.jsx)(`div`,{role:`group`,"aria-label":C(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:ye.map(e=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,A.jsx)(ge,{type:e}),be(e,C)]},e))}),(0,A.jsx)(`div`,{ref:P,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:We?$e(We,!0):(0,A.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:C(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):T.nodes.length?(0,A.jsx)(se,{children:T.nodes.map(e=>(0,A.jsx)(oe,{"data-memory-node":e.id,icon:(0,A.jsx)(ge,{type:e.type}),name:e.title,nameMeta:be(e.type,C),description:e.content,expanded:he===e.id,onExpandedChange:t=>M(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,A.jsx)(re,{title:x.trim()?C(`memory:memoryPage.noMatchingMemories`):C(`memory:memoryPage.noMemoriesInSpace`)})}),(0,A.jsxs)(ce,{title:C(`memory:memoryPage.memoryDrafts`),count:T.candidates?.length||0,actions:!!T.candidates?.length&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,A.jsx)(m,{}),C(`memory:memoryPage.ignoreAll`)]}),children:[Pe&&(0,A.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,A.jsx)(_,{className:`size-3.5`}),C(`memory:memoryPage.loadingAutoApproveThreshold`)]}),je&&(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,A.jsxs)(pe,{className:`my-0`,children:[C(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,je]}),(0,A.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Pe||Be,onClick:()=>void(Me===`save`?Ue():He()),children:C(`memory:memoryPage.retryAutoApproveThreshold`)})]}),G!==null&&(0,A.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,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,A.jsx)(`span`,{children:C(`memory:memoryPage.autoApproveThreshold`)}),(0,A.jsxs)(te,{children:[(0,A.jsx)(ee,{asChild:!0,children:(0,A.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,A.jsx)(g,{align:`center`,side:`top`,children:C(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,A.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,A.jsx)(S,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:G,"aria-busy":Be,"aria-label":C(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{J.current+=1,Ae(e.target.value)},onBlur:()=>void Ue(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Ue())}}),`%`,Be&&(0,A.jsx)(_,{className:`size-3.5`})]})]}),T.candidates?.length?(0,A.jsx)(se,{children:T.candidates.map(e=>(0,A.jsx)(oe,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,A.jsxs)(`span`,{className:`truncate tabular-nums`,children:[B(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,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,A.jsx)(o,{}),C(`memory:memoryPage.confirm`)]}),(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,A.jsx)(m,{}),C(`memory:memoryPage.ignore`)]})]}),detail:(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,A.jsxs)(`span`,{children:[C(`memory:memoryPage.topic`),`:`,(0,A.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,A.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[C(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,A.jsxs)(`span`,{className:`tabular-nums`,children:[C(`memory:memoryPage.created`),`:`,xe(e.createdAt,w),e.expiresAt?` · ${C(`memory:memoryPage.expires`)}:${xe(e.expiresAt,w)}`:``]})]})},e.id))}):(0,A.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:C(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,A.jsx)(b,{kind:`error`,title:C(`memory:memoryPage.loadFailed`),description:Te,action:(0,A.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void Q(D),children:C(`common:pageTemplate.retry`)})}),Ee&&(0,A.jsx)(Ce,{spaces:T.spaces,node:Ee.id?Ee:null,initialSpaceId:Ee.spaceId||D,onClose:()=>U(null),onSaved:async t=>{U(null),e(t),await Q(D)}}),De&&(0,A.jsx)(we,{space:De.id?De:null,onClose:()=>Oe(null),onSaved:async(t,n)=>{Oe(null),O(t.id),e(n)}})]})}function Ce({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,k.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,k.useState)(!1),[p,h]=(0,k.useState)(``);return(0,A.jsx)(`div`,{className:L,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:R,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(V(e))}finally{f(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,A.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,A.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,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,A.jsx)(E,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,A.jsx)(`option`,{value:e.id,children:B(e,s)},e.id))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,A.jsx)(S,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,A.jsx)(ie,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,A.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,A.jsx)(E,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:ye.map(e=>(0,A.jsx)(`option`,{value:e,children:be(e,s)},e))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,A.jsxs)(E,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,A.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,A.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,A.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,A.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,A.jsx)(S,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,A.jsx)(pe,{children:p}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function we({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,k.useState)(e?.name||``),[c,l]=(0,k.useState)(!1),[d,f]=(0,k.useState)(``);return(0,A.jsx)(`div`,{className:L,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:R,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(V(e))}finally{l(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,A.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,A.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,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,A.jsx)(S,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,A.jsx)(pe,{children:d}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{Se as MemoryPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t}from"./vendor-react-DwNgTV1j.js";var n=e(t(),1);function r({enabled:e,shellRef:t}){return(0,n.useEffect)(()=>{if(!e)return;let n=t.current;if(!n)return;let r=window.visualViewport,i=0,a=0,o=0,s=Math.max(window.innerHeight,r?.height??0),c=`[data-mobile-composer-input]`,l=()=>{o&&window.clearTimeout(o),o=0},u=e=>{l(),n.dataset.mobileKeyboardTransition=e,e===`opening`&&(o=window.setTimeout(()=>{n.dataset.mobileKeyboard||delete n.dataset.mobileKeyboardTransition,o=0},500))},d=e=>{!(e instanceof Element)||!e.closest(c)||u(`opening`)},f=e=>d(e.target),p=e=>d(e.target),m=e=>{let t=e.target;!(t instanceof Element)||!t.closest(c)||window.requestAnimationFrame(()=>{let e=document.activeElement;e instanceof Element&&e.closest(c)||(u(`closing`),o=window.setTimeout(()=>{delete n.dataset.mobileKeyboardTransition,o=0},240))})},h=e=>{if(!n.dataset.mobileKeyboard&&!n.dataset.mobileKeyboardTransition)return;let t=e.target;!(t instanceof Element)||!t.closest(`.agent-welcome button`)||(e.preventDefault(),e.stopPropagation())},g=()=>{i=0;let e=Math.max(1,Math.round(r?.height??window.innerHeight)),t=Math.max(0,Math.round(r?.offsetTop??0));s=Math.max(s,window.innerHeight,e+t),Math.max(0,s-e-t)>=s*.2?(n.style.height=`${e}px`,n.style.transform=t?`translate3d(0, ${t}px, 0)`:``,n.dataset.mobileKeyboard=`open`,l()):(n.style.height=``,n.style.transform=``,delete n.dataset.mobileKeyboard,n.dataset.mobileKeyboardTransition===`opening`&&u(`closing`))},_=()=>{i&&window.cancelAnimationFrame(i),i=window.requestAnimationFrame(g)},v=()=>{window.clearTimeout(a),a=window.setTimeout(()=>{s=0,_()},150)};return g(),r?.addEventListener(`resize`,_),r?.addEventListener(`scroll`,_),window.addEventListener(`resize`,_),window.addEventListener(`orientationchange`,v),document.addEventListener(`touchstart`,f,!0),document.addEventListener(`pointerdown`,f,!0),document.addEventListener(`focusin`,p,!0),document.addEventListener(`focusout`,m,!0),document.addEventListener(`click`,h,!0),()=>{i&&window.cancelAnimationFrame(i),window.clearTimeout(a),l(),r?.removeEventListener(`resize`,_),r?.removeEventListener(`scroll`,_),window.removeEventListener(`resize`,_),window.removeEventListener(`orientationchange`,v),document.removeEventListener(`touchstart`,f,!0),document.removeEventListener(`pointerdown`,f,!0),document.removeEventListener(`focusin`,p,!0),document.removeEventListener(`focusout`,m,!0),document.removeEventListener(`click`,h,!0),delete n.dataset.mobileKeyboard,delete n.dataset.mobileKeyboardTransition}},[e,t]),null}export{r as MobileViewportStabilizer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-B5p-Kzvz.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-1-aNPlDu.js";import{t as a}from"./useSidebarModel-CWED0rsw.js";import"./public-jQjEc6OO.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center gap-1.5 rounded-[var(--r-md)] px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-B5p-Kzvz.js";import{t as n}from"./PhoneMenuButton-B0AwvqEo.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-1`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
|
|
@@ -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-B5p-Kzvz.js";import{t as i}from"./api-BO7LAPSQ.js";import{i as a}from"./runtime-capabilities-4_ZwLBqF.js";import{t as o}from"./runtime-capabilities-store-C2Qv7uDP.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as b}from"./shield-alert-oZqX6MNu.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as x}from"./triangle-alert-CE1q54ci.js";import{t as S}from"./more-pages-D_PnxLN0.js";import{a as C}from"./dist-41X0pdUs.js";import{o as w,s as T}from"./dist-BsRXXcSL.js";import{a as E,c as D,i as O,l as k,n as A,o as te,r as ne,s as re,t as ie}from"./dist-BHkR6BLP.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as ae,t as M}from"./button-CCcCN8tE.js";import{s as oe}from"./shortcuts-Cvp9WD9O.js";import{n as se,t as ce}from"./PageState-Cz6vFMXv.js";import{a as le,i as N,l as P,o as F,s as I,t as L}from"./dialog-CUhFgsVd.js";import{t as R}from"./input-CPw-zkYh.js";import{t as z}from"./pick-system-directory-B_RJmP26.js";import{a as ue,i as B,n as V,o as H,r as de,s as fe,t as U}from"./FeaturePage-Bkt1wWVg.js";import{c as pe,i as me,s as he}from"./app-primitives-Drz_SjnR.js";import{t as W}from"./AppSelect-BGVBQRP1.js";import{a as G,i as ge,n as _e,o as ve,r as K,s as ye,t as be}from"./tool-labels-BUEvdohv.js";var q=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),J=e(t(),1),Y=n(),X=Object.defineProperty,Z=(e,t)=>X(e,`name`,{value:t,configurable:!0}),[xe,Se]=T(`AlertDialog`,[k]),Q=k(),Ce=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ie,{...r,...n,modal:!0})},`AlertDialog`);J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(D,{...i,...r,ref:t})},`AlertDialogTrigger`));var we=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(te,{...r,...n})},`AlertDialogPortal`),Te=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(E,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=xe(`AlertDialogContent`),De=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=J.useRef(null),s=C(t,o),c=J.useRef(null);return(0,Y.jsx)(Ee,{scope:n,cancelRef:c,children:(0,Y.jsx)(ne,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:w(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(re,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(O,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(A,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Q(n),o=C(t,i);return(0,Y.jsx)(A,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=Ce,Pe=we,Fe=Te,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,Y.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,Y.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,Y.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:j(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,Y.jsxs)(He,{children:[(0,Y.jsx)(Ue,{}),(0,Y.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:j(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:j(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ke({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:j(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qe({className:e,...t}){return(0,Y.jsx)(ze,{"data-slot":`alert-dialog-title`,className:j(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Je({className:e,...t}){return(0,Y.jsx)(Be,{"data-slot":`alert-dialog-description`,className:j(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Y.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Le,{"data-slot":`alert-dialog-action`,className:j(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Y.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:j(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``);return(0,J.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,Y.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,Y.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,Y.jsxs)(I,{children:[(0,Y.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,Y.jsx)(le,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,Y.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await z(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,Y.jsx)(p,{})})]})]}),l&&(0,Y.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,Y.jsx)(c,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,Y.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,Y.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,Y.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,Y.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,Y.jsx)(x,{className:`mt-0.5 shrink-0`,size:15}),(0,Y.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,Y.jsxs)(me,{className:`m-0`,children:[(0,Y.jsx)(x,{size:14}),(0,Y.jsx)(`span`,{children:m})]})]}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,Y.jsxs)(M,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,Y.jsx)(ae,{className:`text-current`}):l?(0,Y.jsx)(q,{}):(0,Y.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return G({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:K(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,Y.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,Y.jsxs)(W,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,Y.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,Y.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,Y.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,Y.jsxs)(W,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,Y.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,Y.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,Y.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,Y.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,Y.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(null),[f,p]=(0,J.useState)([]),[m,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),S=(0,J.useCallback)(async(e=``)=>{g(!0),x(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){x(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,J.useEffect)(()=>{S(``)},[S]);let C=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),w=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},T=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await w(e.trim())},E=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await S(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},D=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,Y.jsxs)(Y.Fragment,{children:[D.map(e=>(0,Y.jsx)(H,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,Y.jsx)(V,{children:e.items.map(t=>(0,Y.jsx)(B,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,Y.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void E(t),children:[(0,Y.jsx)(ee,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,Y.jsxs)(H,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(M,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Y.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,size:`sm`,onClick:T,disabled:!!_,children:[(0,Y.jsx)(q,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,Y.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),S(s)},children:[(0,Y.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,Y.jsxs)(M,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,Y.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),b&&(0,Y.jsx)(U,{className:`mt-0 mb-3`,children:b}),C.length>0&&(0,Y.jsx)(V,{children:C.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,Y.jsx)(B,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void w(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=oe(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,J.useState)(``),[h,v]=(0,J.useState)(null),[y,C]=(0,J.useState)([]),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(`all`),[O,k]=(0,J.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[A,te]=(0,J.useState)(!1),[ne,re]=(0,J.useState)(!1),[ie,le]=(0,J.useState)(!1),[N,P]=(0,J.useState)(null),[F,I]=(0,J.useState)(!1),[L,R]=(0,J.useState)(``),[z,U]=(0,J.useState)(!1),W=(0,J.useCallback)(e=>{v(e),C(e.plugins),k(e.webSearch)},[]),G=(0,J.useCallback)(async()=>{R(``);try{W(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[W]);(0,J.useEffect)(()=>{G()},[G]);let K=(0,J.useMemo)(()=>ot(y),[y]),X=(0,J.useMemo)(()=>at(y),[y]),Z=h?!lt(X,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(O)!==JSON.stringify(h.webSearch):!1,xe=(0,J.useCallback)(async()=>{if(!A){if(!h||!Z){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}te(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:X,webSearch:O,computerUseEnabled:st(y),piExtensions:ct(y)})});W(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[W,h,Z,y,X,e,A,c,O]),Se=async()=>{re(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(O)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{re(!1)}},Q=(e,t,n)=>{C(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},Ce=()=>!Z||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),we=async()=>{if(!(!N||F)){I(!0),R(``);try{W(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),T(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Te=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=K.filter(e=>E!==`all`&&e.pluginSource!==E?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,Y.jsxs)(de,{title:Te,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Y.jsx)(fe,{search:(0,Y.jsx)(ue,{id:S,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Te}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Y.jsxs)(Y.Fragment,{children:[d&&(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Ce()&&le(!0),children:[(0,Y.jsx)(q,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,Y.jsxs)(M,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:A,disabled:!h||A,onClick:()=>void xe(),children:[(0,Y.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,Y.jsx)(pe,{options:f.map(e=>it(e,c)),value:it(E,c),onChange:e=>D(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(H,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,Y.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[K.filter(e=>e.enabled).length,`/`,K.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:Z&&(0,Y.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,Y.jsx)(V,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,Y.jsx)(B,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,Y.jsx)(t,{}),name:(0,Y.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ve(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,Y.jsx)(he,{value:e.enabled,onChange:t=>Q(e.pluginId,e.name,t),ariaLabel:n}),expanded:w===e.name,onExpandedChange:t=>T(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,Y.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:ge({id:e.name,description:e.description},c)}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,Y.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,Y.jsx)(`dd`,{className:j((be(e.risk)||_e(e.risk))&&`font-medium text-content!`),children:ve(e.risk,c)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,Y.jsx)(`dd`,{children:ye({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,Y.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,Y.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,Y.jsx)(ft,{value:O,testing:ne,onChange:k,onTest:Se}),!e.pluginBuiltIn&&(0,Y.jsxs)(M,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Ce()&&P(e),children:[(0,Y.jsx)(ee,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,Y.jsx)(ce,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,Y.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,Y.jsx)(se,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,Y.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,loading:z,disabled:z,onClick:()=>{U(!0),G().finally(()=>U(!1))},children:c(`common:pageTemplate.retry`)})}):(0,Y.jsx)(se,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,Y.jsx)(Qe,{open:ie,onOpenChange:le,onInstalled:G}),(0,Y.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,Y.jsxs)(We,{className:`z-[220]`,children:[(0,Y.jsxs)(Ge,{children:[(0,Y.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,Y.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,Y.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:we,children:[F&&(0,Y.jsx)(ae,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,Y.jsxs)(me,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,Y.jsx)(x,{size:13}),L]})]})}export{mt as PluginsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-B5p-Kzvz.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./chevron-left-BAtyp3_6.js";import{t as s}from"./chevron-right-C3t2Rckj.js";import{t as c}from"./code-xml-BrUXrBax.js";import{t as l}from"./file-text-N9JICX6E.js";import{n as u,t as d}from"./wand-sparkles-CvEBNUFz.js";import{t as f}from"./list-checks-B5Jl4aiO.js";import{t as p}from"./button-CCcCN8tE.js";var m=a(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),h=a(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),g=a(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),_=t({default:()=>x}),v=e(n(),1),y=r();function b(e,t){return[{icon:c,label:e(`chat:focusSession.explainCode`),prompt:e(`chat:focusSession.explainHowThisCodeWorks`)},{icon:u,label:e(`chat:focusSession.writeTests`),prompt:e(`chat:focusSession.writeUnitTestsForTheFollowingCode`)},{icon:d,label:e(`chat:focusSession.refactor`),prompt:e(`chat:focusSession.refactorThisCodeAndExplainTheImprovements`)},{icon:m,label:e(`chat:focusSession.findABug`),prompt:e(`chat:focusSession.helpMeLocateAndFixThisBug`)},{icon:l,label:e(`chat:focusSession.summarize`),prompt:e(`chat:focusSession.summarizeContentAndExtractKeyPoints`)},...t?[{icon:f,label:e(`chat:focusSession.makeAPlan`),prompt:e(`chat:focusSession.makeAClearActionablePlanForThisGoal`)}]:[],{icon:h,label:e(`chat:focusSession.organizeInformation`),prompt:e(`chat:focusSession.organizeThisInformationIntoAClearStructure`)},{icon:g,label:e(`chat:focusSession.findIssues`),prompt:e(`chat:focusSession.reviewThisContentAndSuggestImprovements`)}]}function x({plansAvailable:e,onPromptSelect:t}){let{t:n}=i(),[r,a]=(0,v.useState)(0),c=b(n,e),l=Math.ceil(c.length/3)-1,u=Math.min(r,l);return(0,y.jsxs)(`section`,{"aria-label":n(`chat:focusSession.promptIdeas`),className:`pt-6 text-left text-sm`,children:[(0,y.jsxs)(`div`,{className:`mb-2 flex min-h-7 items-center justify-between gap-2`,children:[(0,y.jsx)(`h2`,{className:`text-[12px] font-medium tracking-[.02em] text-content-muted`,children:n(`chat:focusSession.promptIdeas`)}),(0,y.jsxs)(`div`,{className:`flex gap-1 @max-[600px]:hidden`,children:[(0,y.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`chat:workbench.previousIdeas`),disabled:u===0,onClick:()=>a(u-1),children:(0,y.jsx)(o,{})}),(0,y.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`chat:workbench.nextIdeas`),disabled:u===l,onClick:()=>a(u+1),children:(0,y.jsx)(s,{})})]})]}),(0,y.jsx)(`div`,{className:`welcome-chips grid grid-cols-3 gap-2 @max-[600px]:flex @max-[600px]:snap-x @max-[600px]:overflow-x-auto @max-[600px]:pb-2`,children:c.map((e,r)=>(0,y.jsxs)(`button`,{type:`button`,"aria-label":e.label,"data-off-page":Math.floor(r/3)!==u||void 0,"data-target-cursor":!0,onClick:()=>t(e.prompt),className:`group/idea flex min-h-[112px] min-w-0 cursor-pointer flex-col gap-2 rounded-md border border-stroke bg-panel p-3 text-left font-normal transition-colors duration-(--d-fast) ease-precise hover:border-stroke-strong hover:bg-surface-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus @max-[600px]:w-[min(240px,80cqw)] @max-[600px]:shrink-0 @max-[600px]:snap-start @min-[600px]:data-off-page:hidden`,children:[(0,y.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`grid size-7 place-items-center rounded-sm border border-key-border bg-key text-content-secondary shadow-key`,children:(0,y.jsx)(e.icon,{size:15,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`rounded-xs border border-stroke px-1.5 text-[12px] leading-[18px] text-content-muted opacity-0 transition-opacity duration-(--d-fast) group-hover/idea:opacity-100 group-focus-visible/idea:opacity-100 pointer-coarse:opacity-100`,children:n(`chat:workbench.tryPrompt`)})]}),(0,y.jsx)(`span`,{className:`mt-1 text-[13px] font-medium text-foreground`,children:e.label}),(0,y.jsx)(`span`,{className:`text-[12px] leading-[1.5] text-content-muted`,children:e.prompt.replace(/[::]$/,``)})]},e.label))})]})}export{_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-B5p-Kzvz.js";import{t as i}from"./api-BO7LAPSQ.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./calendar-clock-VIxTaqqy.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./folder-open-FIShC5Qk.js";import{n as u,t as d}from"./send-QxBfLFo-.js";import{t as f}from"./play-DNDjDNGn.js";import{t as p}from"./plus-fQbSqB1n.js";import{t as m}from"./trash-2-CNrPOoPR.js";import{t as h}from"./triangle-alert-CE1q54ci.js";import{t as g}from"./more-pages-D_PnxLN0.js";import{t as _}from"./switch-D_G8wFhs.js";import{t as v}from"./utils-C8uzG5AZ.js";import{n as y,t as b}from"./button-CCcCN8tE.js";import{s as x}from"./shortcuts-Cvp9WD9O.js";import{a as S}from"./format-DMJQzoZ7.js";import{n as C,t as w}from"./PageState-Cz6vFMXv.js";import{a as T,i as E,l as D,s as O,t as k}from"./dialog-CUhFgsVd.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-B_RJmP26.js";import{WorkspacePicker as N}from"./WorkspacePicker-B9vYtfab.js";import{a as P,i as F,n as ee,o as I,r as L,s as R,t as z}from"./FeaturePage-Bkt1wWVg.js";import{n as B}from"./field-DoLEb0np.js";import{t as te}from"./StatusGlyph-1KgitlUg.js";import{i as V,n as H,s as U,t as W}from"./app-primitives-Drz_SjnR.js";import{t as G}from"./AppSelect-BGVBQRP1.js";var K=e(t(),1),q=n(),ne={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:u},qq:{name:`QQ`,Icon:u},telegram:{name:`Telegram`,Icon:d}},J={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},Y={minutes:`分钟`,hours:`小时`,days:`天`},X=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],re=[`full-access`],Z=`mt-4 border-t border-stroke-soft pt-1`,Q=`form-grid grid gap-x-3 sm:grid-cols-3`,ie=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,ae=`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`,oe=`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 se({status:e}){return(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,q.jsx)(te,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ce(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function le(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function $(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function ue(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 de({value:e,onChange:t}){let{t:n}=r();return(0,q.jsxs)(B,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,q.jsx)(G,{value:e,onChange:e=>t(e.target.value),children:re.map(e=>(0,q.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,q.jsx)(`small`,{children:ce(n)})]})}function fe(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function pe(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 me({targetType:e,prompt:t,workflowId:n,workflowInputs:i,workflows:a,onChange:o}){let{t:s}=r(),c=a.find(e=>e.id===n);return(0,q.jsxs)(`div`,{className:`grid`,children:[(0,q.jsxs)(B,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,q.jsxs)(G,{value:e,onChange:e=>{let t=e.target.value,r=a[0];o(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?i:fe(r)}:{targetType:t})},children:[(0,q.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,q.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,q.jsxs)(B,{variant:`control`,children:[`Prompt`,(0,q.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(B,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,q.jsxs)(G,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:fe(t)})},children:[(0,q.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,q.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,q.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,q.jsxs)(`div`,{className:`grid`,children:[(0,q.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,q.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,q.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,q.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,q.jsxs)(B,{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,q.jsx)(_,{checked:!!i[e.name],onCheckedChange:t=>o({workflowInputs:{...i,[e.name]:t}})}):(0,q.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(i[e.name]??``),onChange:t=>o({workflowInputs:{...i,[e.name]:t.target.value}})}),e.description&&(0,q.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function he({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,K.useState)(``),[o,s]=(0,K.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,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(B,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,q.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,q.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,q.jsxs)(b,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,q.jsx)(l,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,q.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,q.jsxs)(V,{children:[(0,q.jsx)(h,{size:13}),i]}),(0,q.jsx)(N,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function ge(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,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 _e(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 ve({notify:e,onBack:t,openNotificationSettings:n,requestConfirm:a}){let{t:o,language:c}=r(),l=x(`focusSearch`),[u,d]=(0,K.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[f,m]=(0,K.useState)(``),[h,_]=(0,K.useState)({}),[v,y]=(0,K.useState)(!0),[S,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(!1),[A,j]=(0,K.useState)(``),[M,N]=(0,K.useState)(!1),[B,V]=(0,K.useState)(``),H=(0,K.useCallback)(async()=>{try{let e=await i(`/api/schedules`);d(e),T(!0),D(``),m(t=>e.tasks.some(e=>e.id===t)?t:``),_(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){D(e instanceof Error?e.message:String(e))}finally{y(!1)}},[]);(0,K.useEffect)(()=>{H()},[H]),(0,K.useEffect)(()=>{let e=window.setInterval(H,u.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[u.tasks,H]);let U=u.tasks.find(e=>e.id===f),W=u.workflows||[],G=U?h[U.id]??ge(U):null,ne=(0,K.useMemo)(()=>u.runs.filter(e=>e.taskId===f).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[u.runs,f]),J=e=>W.find(t=>t.id===e.workflowId)?.name||o(`schedules:schedulesPage.workflowUnavailable`),Y=B.trim().toLocaleLowerCase(),X=Y?u.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?J(e):e.prompt}`.toLocaleLowerCase().includes(Y)):u.tasks,re=u.tasks.filter(e=>e.enabled).length,Z=e=>{if(!U)return;let t=ge(U);_(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},Q=e=>{G&&Z({notifications:G.notifications.includes(e)?G.notifications.filter(t=>t!==e):[...G.notifications,e]})},ie=async()=>{if(!(!U||!G)){k(!0),j(``);try{let t=await i(`/api/schedules/${encodeURIComponent(U.id)}`,{method:`PATCH`,body:JSON.stringify(G)});d(t.state),_(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(o(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ae=async()=>{if(U){k(!0),j(``);try{await i(`/api/schedules/${encodeURIComponent(U.id)}/run`,{method:`POST`,body:`{}`}),await H(),e(o(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},oe=async()=>{if(U&&await a({title:o(`schedules:schedulesPage.deleteScheduledTask`),message:o(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:U.name}),confirmLabel:o(`schedules:schedulesPage.delete`)}))try{await i(`/api/schedules/${encodeURIComponent(U.id)}`,{method:`DELETE`}),await H(),e(o(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},se=t=>{d(t.state),m(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))},ce=e=>(0,q.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,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,q.jsx)(te,{status:`run`,className:`size-3.5`}),o(`schedules:schedulesPage.running`)]}):(0,q.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?o(`schedules:schedulesPage.nextRunTime`,{time:_e(e,c)}):o(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,q.jsx)(te,{status:`failed`,className:`size-3.5`}),o(`schedules:schedulesPage.lastRunFailed`)]})]}),ue=o(`navigation:navigation.schedules`);return(0,q.jsxs)(L,{title:ue,description:o(`schedules:schedulesPage.lede`),back:t&&{label:o(`navigation:sidebar.features`),ariaLabel:o(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,q.jsx)(R,{search:(0,q.jsx)(P,{id:g,value:B,onValueChange:V,placeholder:o(`navigation:pageHeader.searchPage`,{page:ue}),shortcut:l,clearLabel:o(`navigation:more.clearSearch`)}),actions:(0,q.jsxs)(b,{type:`button`,className:`h-9`,disabled:!S,onClick:()=>N(!0),children:[(0,q.jsx)(p,{}),o(`schedules:schedulesPage.newTask`)]})}),children:[v?(0,q.jsx)(C,{kind:`loading`,title:o(`schedules:schedulesPage.loadingScheduledTasks`)}):E&&!S?(0,q.jsx)(C,{kind:`error`,title:o(`schedules:schedulesPage.loadFailed`),description:E,action:(0,q.jsx)(b,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{y(!0),H()},children:o(`common:pageTemplate.retry`)})}):(0,q.jsxs)(q.Fragment,{children:[(A||E)&&(0,q.jsx)(z,{children:A||E}),(0,q.jsx)(I,{title:o(`schedules:schedulesPage.tasks`),count:u.tasks.length,meta:u.tasks.length?o(`schedules:schedulesPage.enabledCount`,{count:re}):void 0,children:X.length?(0,q.jsx)(ee,{children:X.map(e=>{let t=f===e.id;return(0,q.jsx)(F,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,q.jsx)(s,{}),name:e.name,description:e.targetType===`workflow`?(0,q.jsx)(`span`,{className:`font-mono`,children:J(e)}):e.prompt,meta:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:le(e.frequency,o)}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,q.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${$(e.intervalUnit,o)}`:e.time}),(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,q.jsx)(`span`,{className:`truncate`,children:e.timezone})]}),status:ce(e),expanded:t,onExpandedChange:t=>m(t?e.id:``),toggleLabel:o(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&G&&U?(0,q.jsx)(ye,{task:U,draft:G,runs:ne,saving:O,workflows:W,notificationTargets:u.notificationTargets,language:c,onUpdate:Z,onToggleNotification:Q,onRun:ae,onRemove:oe,onSave:ie,onEditTemplates:n}):null},e.id)})}):(0,q.jsx)(w,{title:u.tasks.length?o(`schedules:schedulesPage.noMatchingTasks`):o(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:u.tasks.length?void 0:o(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})}),!u.tasks.length&&(0,q.jsx)(`div`,{className:`mt-7`,"data-schedule-create":!0,children:(0,q.jsx)(be,{notificationTargets:u.notificationTargets,workflows:W,defaultCwd:u.defaultCwd,onCreated:se})})]}),M&&(0,q.jsx)(xe,{notificationTargets:u.notificationTargets,workflows:W,defaultCwd:u.defaultCwd,onClose:()=>N(!1),onCreated:e=>{N(!1),se(e)}})]})}function ye({task:e,draft:t,runs:n,saving:i,workflows:a,notificationTargets:o,language:s,onUpdate:l,onToggleNotification:u,onRun:d,onRemove:p,onSave:h,onEditTemplates:g}){let{t:_}=r(),x=e.lastStatus===`running`;return(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,q.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,q.jsx)(U,{value:t.enabled,onChange:e=>l({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,q.jsxs)(b,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:i||x,onClick:d,children:[x?(0,q.jsx)(y,{}):(0,q.jsx)(f,{}),_(x?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,q.jsx)(b,{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:p,children:(0,q.jsx)(m,{})})]}),(0,q.jsx)(me,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:l}),t.targetType===`prompt`&&(0,q.jsx)(he,{value:t.cwd,onChange:e=>l({cwd:e})}),(0,q.jsx)(`div`,{className:Z,children:(0,q.jsxs)(`div`,{className:Q,children:[(0,q.jsxs)(B,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,q.jsx)(G,{value:t.frequency,onChange:e=>l({frequency:e.target.value}),children:Object.keys(J).map(e=>(0,q.jsx)(`option`,{value:e,children:le(e,_)},e))})]}),t.frequency===`interval`?(0,q.jsxs)(B,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,q.jsxs)(`span`,{className:ie,children:[(0,q.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>l({intervalValue:Number(e.target.value)})}),(0,q.jsx)(G,{value:t.intervalUnit,onChange:e=>l({intervalUnit:e.target.value}),children:Object.keys(Y).map(e=>(0,q.jsx)(`option`,{value:e,children:$(e,_)},e))})]})]}):(0,q.jsxs)(B,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,q.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>l({time:e.target.value})})]}),(0,q.jsxs)(B,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,q.jsx)(G,{value:t.timezone,onChange:e=>l({timezone:e.target.value}),children:X.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,q.jsx)(de,{value:t.executionMode,onChange:e=>l({executionMode:e})})]})}),(0,q.jsxs)(`div`,{className:v(`schedule-notification-section pt-3`,Z),children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,q.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:g,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,q.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(ne).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:v(`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,q.jsx)(r,{className:`size-4`}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,q.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:ue(e,_)}),(0,q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,q.jsx)(c,{className:v(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,q.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,q.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:v(`schedule-notification-chip`,ae),children:[`always`,`failure`].map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:oe,onClick:()=>l({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,q.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,q.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:S(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:_e(e,s)})}),(0,q.jsxs)(b,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:i||!pe(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:h,children:[i?(0,q.jsx)(y,{className:`text-current`}):null,_(i?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,q.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,q.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,q.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,q.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,q.jsx)(se,{status:e.status}),(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,q.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,q.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[S(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,q.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,q.jsx)(w,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function be({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(`prompt`),[d,f]=(0,K.useState)(``),[m,g]=(0,K.useState)(``),[_,x]=(0,K.useState)({}),[S,C]=(0,K.useState)(n||``),[w,T]=(0,K.useState)(`daily`),[E,D]=(0,K.useState)(`09:00`),[O,k]=(0,K.useState)(`Asia/Hong_Kong`),[j,M]=(0,K.useState)(1),[N,P]=(0,K.useState)(`hours`),[F,ee]=(0,K.useState)(`full-access`),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(``);return(0,q.jsxs)(W,{className:`p-4 py-4`,children:[(0,q.jsx)(H,{children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h2`,{className:`text-[15px]! font-medium`,children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,q.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,q.jsxs)(B,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,q.jsx)(A,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,q.jsx)(me,{targetType:l,prompt:d,workflowId:m,workflowInputs:_,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&f(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&x(e.workflowInputs)}}),l===`prompt`&&(0,q.jsx)(he,{value:S,onChange:C}),(0,q.jsxs)(`div`,{className:v(Z,Q),children:[(0,q.jsxs)(B,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,q.jsx)(G,{value:w,onChange:e=>T(e.target.value),children:Object.keys(J).map(e=>(0,q.jsx)(`option`,{value:e,children:le(e,o)},e))})]}),w===`interval`?(0,q.jsxs)(B,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,q.jsxs)(`span`,{className:ie,children:[(0,q.jsx)(A,{type:`number`,min:`1`,value:j,onChange:e=>M(Number(e.target.value))}),(0,q.jsx)(G,{value:N,onChange:e=>P(e.target.value),children:Object.keys(Y).map(e=>(0,q.jsx)(`option`,{value:e,children:$(e,o)},e))})]})]}):(0,q.jsxs)(B,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,q.jsx)(A,{type:`time`,className:`tabular-nums`,value:E,onChange:e=>D(e.target.value)})]}),(0,q.jsxs)(B,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,q.jsx)(G,{value:O,onChange:e=>k(e.target.value),children:X.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,q.jsx)(de,{value:F,onChange:ee})]}),R&&(0,q.jsxs)(V,{children:[(0,q.jsx)(h,{size:13}),R]}),(0,q.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,q.jsx)(`span`,{className:`text-xs text-content-muted`,children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,q.jsxs)(b,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:I||!s.trim()||!pe(l,d,m,_,t),onClick:async()=>{L(!0),z(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await i(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:d,workflowId:m,workflowInputs:_,cwd:S,enabled:!0,frequency:w,time:E,timezone:O,intervalValue:j,intervalUnit:N,executionMode:F,notifications:t,notifyOn:`always`})}))}catch(e){z(e instanceof Error?e.message:String(e))}finally{L(!1)}},children:[I?(0,q.jsx)(y,{className:`text-current`}):(0,q.jsx)(p,{}),o(I?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function xe({notificationTargets:e,workflows:t,defaultCwd:n,onClose:a,onCreated:o}){let{t:s}=r(),[c,l]=(0,K.useState)(``),[u,d]=(0,K.useState)(`prompt`),[f,m]=(0,K.useState)(``),[g,_]=(0,K.useState)(``),[v,x]=(0,K.useState)({}),[S,C]=(0,K.useState)(n||``),[w,j]=(0,K.useState)(`full-access`),[M,N]=(0,K.useState)(!1),[P,F]=(0,K.useState)(``);return(0,q.jsx)(k,{open:!0,onOpenChange:e=>!e&&a(),children:(0,q.jsx)(E,{size:`compact`,children:(0,q.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),N(!0),F(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await i(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:g,workflowInputs:v,cwd:S,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{N(!1)}},children:[(0,q.jsxs)(O,{children:[(0,q.jsx)(D,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,q.jsx)(T,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,q.jsxs)(B,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,q.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,q.jsx)(me,{targetType:u,prompt:f,workflowId:g,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&_(e.workflowId),e.workflowInputs!==void 0&&x(e.workflowInputs)}}),u===`prompt`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(he,{value:S,onChange:C}),(0,q.jsx)(de,{value:w,onChange:j})]}),P&&(0,q.jsxs)(V,{children:[(0,q.jsx)(h,{size:13}),P]}),(0,q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,q.jsx)(b,{type:`button`,variant:`secondary`,onClick:a,children:s(`schedules:schedulesPage.cancel`)}),(0,q.jsxs)(b,{type:`submit`,disabled:M||!c.trim()||!pe(u,f,g,v,t),children:[M?(0,q.jsx)(y,{className:`text-current`}):(0,q.jsx)(p,{}),s(M?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{ve as SchedulesPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-rjt5_KOt.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-B5p-Kzvz.js","assets/i18n-CHmr7GzM.js","assets/vendor-router-CSN_DGvx.js","assets/index-CsE52ydO.js","assets/index-CfTBR7Rs.css","assets/storage-BY6wEHPw.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-DrAPv0se.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-DWNACXyI.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-Cz6vFMXv.js","assets/AppSelect-BGVBQRP1.js","assets/use-mobile-DauOEda6.js","assets/select-DD_WO-gs.js","assets/check-2vYc6QaP.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/dist-V8chnW6-.js","assets/dist-BsRXXcSL.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-DRFmGkE3.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-Cnmi_2U-.js","assets/api-BO7LAPSQ.js","assets/abort-signal-f4JsiYKX.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-DsgBuvJv.js","assets/dist-BaBySQmo.js","assets/format-DMJQzoZ7.js","assets/dialog-CUhFgsVd.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-yl-PSRAz.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-B5p-Kzvz.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-up-DST6-qVQ.js";import{t as c}from"./check-2vYc6QaP.js";import{t as l}from"./chevron-down-CxtxIjiP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{t as d}from"./earth-Ddy13fHh.js";import{t as f}from"./external-link-CEQqPcqc.js";import{i as p}from"./GitDiffViewer-rjt5_KOt.js";import{t as m}from"./file-Bllajneu.js";import{a as h,i as g,k as _,l as v,m as y,o as b,p as x,r as S}from"./side-chat-context-BfOm4dFp.js";import{t as C}from"./git-branch-N7LGjtzt.js";import{t as w}from"./image-BY_c3FYU.js";import{t as T}from"./link-2-mgasYn21.js";import{t as E}from"./list-checks-B5Jl4aiO.js";import{t as D}from"./message-square-SKjZyY3v.js";import{t as O}from"./refresh-cw-TbWxTY4K.js";import{t as k}from"./square-bHHVTT3G.js";import"./collapsible-DMaUQRX4.js";import"./tooltip-D4MFbqcG.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as j,t as M}from"./button-CCcCN8tE.js";import{c as N,r as P}from"./shortcuts-Cvp9WD9O.js";import{t as F}from"./chat-api-DkdyVQY9.js";import{n as I,t as L}from"./PageState-Cz6vFMXv.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z}from"./session-change-summary-api-DgRT32uh.js";import{t as B}from"./AppSelect-BGVBQRP1.js";import{t as V}from"./web-preview-CqwSe9Zn.js";import{o as H}from"./session-tree-summary-BwYRdui2.js";var U=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),W=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),G=e(n(),1),K=r(),q={completed:`completed`,in_progress:`running`,blocked:`blocked`,pending:`pending`};function J(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function Y({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,K.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${q[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,K.jsx)(c,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,K.jsx)(j,{className:`size-3.5`}):e===`blocked`?(0,K.jsx)(W,{size:11,strokeWidth:2}):(0,K.jsx)(U,{size:11,strokeWidth:2}),(0,K.jsx)(`span`,{className:`sr-only`,children:n})]})}function X({item:e,current:t,t:n}){return(0,K.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,K.jsx)(Y,{status:e.blocked?`blocked`:e.status,t:n}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,K.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:n(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,K.jsx)(_,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,K.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:n(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,K.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,K.jsx)(W,{size:11,className:`flex-none`}),(0,K.jsx)(`span`,{className:`truncate`,children:n(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function ee({plan:e,header:t,collapsible:n=!1}){let{t:r}=i(),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(!0),c=e?.items||[],u=J(c),d=u.filter(e=>e.status===`completed`).length,f=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,p=u.filter(e=>e.blocked).length,m=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,G.useLayoutEffect)(()=>{if(n&&!o)return;let e=a.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top?e.scrollTop-=r.top-i.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[n,m,o,u.length]),!c.length)return null;let h=u.find(e=>e.id===m),g=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(E,{className:`flex-none text-content-muted`,size:15}),(0,K.jsx)(`strong`,{className:`tabular-nums`,children:r(`chat:planBoard.progress`,{completed:d,total:c.length})}),h?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:h.title,children:h.title}):null,(0,K.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[f>0&&(0,K.jsx)(`span`,{children:r(`chat:planBoard.countInProgress`,{count:f})}),p>0&&(0,K.jsx)(`span`,{className:`blocked text-danger`,children:r(`chat:planBoard.countBlocked`,{count:p})})]}),t,n?(0,K.jsx)(l,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),_=(0,K.jsx)(`ul`,{ref:a,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,K.jsx)(X,{item:e,current:e.id===m,t:r},e.id))});return n?(0,K.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:o,onToggle:e=>s(e.currentTarget.open),children:[(0,K.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":r(`chat:planBoard.toggleAriaLabel`),children:g}),_]}):(0,K.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":r(`chat:planBoard.ariaLabel`),children:[(0,K.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:g}),_]})}var te=(0,G.memo)(ee),ne=(0,G.lazy)(()=>t(()=>import(`./GitDiffViewer-rjt5_KOt.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function Z({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?F.getFileDiff(e,t,{signal:r}):F.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,K.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,K.jsx)(j,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,K.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,K.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(ne,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function re({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>F.getVcsChanges(e,{signal:t})}),l=p(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),d=(0,G.useMemo)(()=>x(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),f=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),m=c.error?.message||c.data?.error,h=c.data?.files||[];return(0,K.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.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,K.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!m&&(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,d.added]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.removed]})]}),(0,K.jsx)(M,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,K.jsx)(O,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,K.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,K.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,K.jsx)(C,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,K.jsxs)(`div`,{className:`flex gap-1`,children:[(0,K.jsx)(M,{variant:`ghost`,size:`sm`,disabled:!h.length||!!m,onClick:()=>o({expandedFiles:h.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,K.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!m&&f.map(e=>(0,K.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,K.jsx)(I,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):m?(0,K.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:m}):c.data?.isRepo?h.length?(0,K.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:h.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,K.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,K.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,K.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,K.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(d.files,t.path)&&(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,K.jsxs)(`span`,{className:`text-success`,children:[`+`,d.files[t.path].added]}),` `,(0,K.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.files[t.path].removed]})]})]}),n&&(0,K.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,K.jsx)(Z,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,K.jsx)(L,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,K.jsx)(L,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Q(e){return e instanceof Error?e.message:String(e)}function ie({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,G.useState)(0),[s,c]=(0,G.useState)(0),[l,u]=(0,G.useState)(null),[d,f]=(0,G.useState)(!0),[p,m]=(0,G.useState)(``),[h,g]=(0,G.useState)(``),[_,v]=(0,G.useState)(``),[y,b]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),T=(0,G.useRef)(!1),E=(0,G.useRef)(0),D=(0,G.useRef)(0),O=(0,G.useRef)(!0),k=(0,G.useRef)(!1),A=(0,G.useRef)(t);return(0,G.useLayoutEffect)(()=>{A.current=t},[t]),(0,G.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,G.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),F.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Q(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await F.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Q(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await F.approveSessionFileChanges(e,t.path):await F.revertSessionFileChanges(e,t.path);if(z(e),!T.current||i!==E.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){T.current&&i===E.current&&g(Q(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var ae=(0,G.lazy)(()=>t(()=>import(`./TaskTerminalView-DWNACXyI.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,19,10,20,14,13,15,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),oe=(0,G.lazy)(()=>t(()=>import(`./TaskProcessesPane-DRFmGkE3.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,38,10,19,20,39,25,15,29,34,12,13,14,21,22,23,24,26,27,28,30,31,32,33,35]))),se=(0,G.lazy)(()=>t(()=>import(`./FileAttachmentPreview-Cnmi_2U-.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,41,42,43,10,44,45,11,46,13,29,15,31,47,12,14,48,49,50,32,51,52,53,54,55,25,56,57])));function ce({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=p(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,G.useContext)(y),[s,c]=(0,G.useState)(``),l=(0,G.useRef)(null),d=e.find(e=>e.id===s),f=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,K.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,K.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,K.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,K.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,K.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,K.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,K.jsx)(R,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,K.jsxs)(B,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,K.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,K.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,K.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,K.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,K.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!f.length&&(0,K.jsx)(L,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),f.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?w:e.method===`path`?T:m;return(0,K.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,K.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,K.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,K.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,K.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,K.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,K.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,K.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,K.jsx)(M,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),d&&(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(se,{attachment:d.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof d.attachment.downloadUrl==`string`&&window.open(d.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function le({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:c}=S(e),l=r.session?.id??``,u=(0,G.useMemo)(()=>e=>a.subscribeSessionState(l,e),[a,l]),d=(0,G.useMemo)(()=>()=>a.getSessionState(l),[a,l]),f=(0,G.useSyncExternalStore)(u,d),[p,m]=(0,G.useState)(!1),[_,y]=(0,G.useState)(!1),[x,C]=(0,G.useState)(``),w=(0,G.useRef)(!1),T=(0,G.useRef)(!1),E=(0,G.useRef)(r.draft);E.current=r.draft;let O=(0,G.useRef)(null),A=N(e=>e.bindings),F=g(f,r.session);(0,G.useEffect)(()=>{t&&o(e)},[t,o,e]);let I=async t=>{t.preventDefault();let n=E.current.trim();if(!(!n||w.current||F||r.expired)){w.current=!0,m(!0),C(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;E.current.trim()===n&&c(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){C(H(e))}finally{w.current=!1,m(!1)}}},L=(0,G.useCallback)(async()=>{if(!(!l||a.getSessionState(l).streaming)){C(``);try{await a.retry(l),await o(e)}catch(e){C(H(e))}}},[o,e,a,l]),R=async()=>{if(!(!l||_)){y(!0);try{C(``),await a.abort(l)}catch(e){C(H(e))}finally{y(!1)}}},z=(0,K.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,K.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,K.jsx)(D,{className:`size-4`,"aria-hidden":`true`})}),(0,K.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,K.jsxs)(M,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&O.current?.focus()},children:[r.loading&&(0,K.jsx)(j,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),B=x||r.error||f.error;return(0,K.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,K.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),l?(0,K.jsx)(b,{sessionId:l,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:z,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:F,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(l),onRetryLastTurn:L}):(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z}),(0,K.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:I,children:[B&&(0,K.jsx)(v,{error:B,onRetry:r.error||!f.loaded?async()=>{await o(e)}:L}),(0,K.jsx)(h,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(l,e,t)}catch{}}}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,K.jsx)(`textarea`,{ref:O,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>c(e,t.target.value),onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:e=>{!T.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&P(e.nativeEvent,A.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,K.jsx)(M,{type:F?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(F?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:F?_:p||r.loading||r.expired||!r.draft.trim(),onClick:F?()=>void R():void 0,children:p||_?(0,K.jsx)(j,{className:`size-4 text-current`}):F?(0,K.jsx)(k,{size:13,fill:`currentColor`}):(0,K.jsx)(s,{size:17})})]})]})]})}var $=(0,G.createContext)(null),ue=()=>{let e=(0,G.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},de=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,G.useState)(n),[s,c]=(0,G.useState)(!1),l=(0,G.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,G.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,K.jsx)($.Provider,{value:u,children:(0,K.jsx)(`div`,{className:A(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},fe=({className:e,loading:t,src:n,...r})=>{let{url:i}=ue();return(0,K.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,K.jsx)(`iframe`,{className:A(`block size-full border-0 bg-background`,e),loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-presentation`,src:(n??i)||void 0,title:`Preview`,...r}),t]})};function pe({page:e,onChange:t}){let{t:n}=i(),{draft:r,url:a}=e,[o,s]=(0,G.useState)(!1);return(0,K.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,K.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=V(r,window.location.href);s(!n),n&&t({url:n})},children:[(0,K.jsx)(R,{"aria-label":n(`common:webPreview.url`),className:`flex-1 font-mono`,value:r,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,K.jsx)(M,{type:`submit`,variant:`secondary`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,K.jsx)(de,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:a,children:(0,K.jsx)(fe,{src:a,title:n(`common:webPreview.title`)})},a):(0,K.jsx)(L,{icon:d,className:`min-h-0 flex-1`,title:n(`chat:sessionContext.browserEmpty`)}),a&&(0,K.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,K.jsx)(f,{size:14}),n(`common:webPreview.openExternal`)]}),(0,K.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`common:webPreview.embedNotice`)})]})}export{ae as a,Z as c,oe as i,te as l,le as n,ie as o,ce as r,re as s,pe as t};
|