pisper 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/package.json +6 -6
  2. package/web/.vite/manifest.json +315 -377
  3. package/web/assets/{AppDialog-BOGrPFbo.js → AppDialog-DW5knado.js} +1 -1
  4. package/web/assets/{AppOverlays-D1vfPPIC.js → AppOverlays-Bp8RcUF5.js} +1 -1
  5. package/web/assets/AppSelect-D149YYg1.js +1 -0
  6. package/web/assets/{AppShortcuts-Dd4gu7qz.js → AppShortcuts-D1jjdZDS.js} +1 -1
  7. package/web/assets/{AssetsPage-BPhPo5eU.js → AssetsPage-C7AlHS3s.js} +1 -1
  8. package/web/assets/{ChannelsPage-Cu4v-GU2.js → ChannelsPage-BJltcbA8.js} +1 -1
  9. package/web/assets/ChatAppearancePage-BXvAK8yY.js +2 -0
  10. package/web/assets/{ChatHistoryPage-BYqJFbY5.js → ChatHistoryPage-D3fm9Tw9.js} +1 -1
  11. package/web/assets/ChatPage-BFJm1sNL.js +554 -0
  12. package/web/assets/{ConfigPage-Z-BQwP2X.js → ConfigPage-DLgNJdgQ.js} +1 -1
  13. package/web/assets/{DecisionsPage-Db6MIGD2.js → DecisionsPage-57a_ZuRk.js} +1 -1
  14. package/web/assets/{DesktopWindowControls-CBYGv94u.js → DesktopWindowControls-xHry1hUJ.js} +1 -1
  15. package/web/assets/{FloatingWidgets-dzsQIxAO.js → FloatingWidgets-CJQjpX-U.js} +1 -1
  16. package/web/assets/{GitDiffViewer-m5aLB7Li.js → GitDiffViewer-91SrTCWo.js} +1 -1
  17. package/web/assets/{MarkdownMessage-CA9ODRKk.js → MarkdownMessage-DeTzbwid.js} +1 -1
  18. package/web/assets/{McpPage-rerFxjYZ.js → McpPage-CTJ_aKOo.js} +1 -1
  19. package/web/assets/{MemoryPage-cukfU824.js → MemoryPage-DRTc4YT9.js} +1 -1
  20. package/web/assets/MobileContextScreen-CnaR6ssx.js +2 -0
  21. package/web/assets/{MobileNavigation-CEVgs1Ke.js → MobileNavigation-Cw7L9pSg.js} +1 -1
  22. package/web/assets/{PageHeader-DIs9bESb.js → PageHeader-B2qhKXvC.js} +1 -1
  23. package/web/assets/{PluginsPage-09Um3mY4.js → PluginsPage-DVCWLVRB.js} +1 -1
  24. package/web/assets/{QuickPromptIdeas-DGIL0nN7.js → QuickPromptIdeas-xQFMgSGF.js} +1 -1
  25. package/web/assets/{SchedulesPage-C75QUeB5.js → SchedulesPage-B_YjdfoV.js} +1 -1
  26. package/web/assets/SessionContextPanel-BwHEDkJE.js +1 -0
  27. package/web/assets/{SessionFilesPane-DPijesqH.js → SessionFilesPane-CUhqwp87.js} +2 -2
  28. package/web/assets/{SidebarMoreTools-D1nDS3i0.js → SidebarMoreTools-BHJuLoCs.js} +1 -1
  29. package/web/assets/SidebarRecentSessions-CVIFZ66b.js +2 -0
  30. package/web/assets/{SidebarSettingsButton-CRdV0Vft.js → SidebarSettingsButton-5N0RlmoI.js} +1 -1
  31. package/web/assets/{SidebarUpdateStatus-DgNJBwgT.js → SidebarUpdateStatus-CVxo4zaS.js} +1 -1
  32. package/web/assets/{SkillsPage-DLirgTyX.js → SkillsPage-KsP2YFgx.js} +1 -1
  33. package/web/assets/{TerminalPanel-CJPy4Qhs.js → TerminalPanel-PK0ubUYF.js} +1 -1
  34. package/web/assets/{ThemeToggleButton-C5QA5Kf2.js → ThemeToggleButton-BFby07PX.js} +1 -1
  35. package/web/assets/{WebDesktopPet-DgyHLE9y.js → WebDesktopPet-juirMq3L.js} +1 -1
  36. package/web/assets/{WorkbenchSidebarToggle-CcO1Al5A.js → WorkbenchSidebarToggle-B-YDZEZn.js} +1 -1
  37. package/web/assets/WorkflowsPage-Bsw_TnA6.js +1 -0
  38. package/web/assets/WorkspacePicker-CDJPgjpW.js +1 -0
  39. package/web/assets/{api-YI8_cHpR.js → api-DmuPqjXK.js} +1 -1
  40. package/web/assets/{app-primitives-SxfoFmHc.js → app-primitives-BBXY6U2S.js} +1 -1
  41. package/web/assets/catalog-Cs8cjmnr.js +1 -0
  42. package/web/assets/{chat-api-CqF-FICX.js → chat-api-cEcUMaNX.js} +1 -1
  43. package/web/assets/{client-store-BP_3-plw.js → client-store-CV7NgPf7.js} +1 -1
  44. package/web/assets/{component-api-CN9Tcn5p.js → component-api-guxJtKAP.js} +1 -1
  45. package/web/assets/{config-search-DOIJENN1.js → config-search-DzgcCirf.js} +1 -1
  46. package/web/assets/dist-DAs5KRGl.js +1 -0
  47. package/web/assets/dist-swnK7PHk.js +1 -0
  48. package/web/assets/{dropdown-menu-pKRdLJUe.js → dropdown-menu-DmL4pJTo.js} +1 -1
  49. package/web/assets/{events-KqdUtjsm.js → events-DjkpUZEu.js} +1 -1
  50. package/web/assets/{floating-widgets-store-Pjm1AdvO.js → floating-widgets-store-C3frcaki.js} +2 -2
  51. package/web/assets/{http-Be2GB6DH.js → http-C4bTWPzF.js} +1 -1
  52. package/web/assets/i18n-DKgrgj0w.js +1 -0
  53. package/web/assets/index-DJAtBVyc.css +2 -0
  54. package/web/assets/{index-AF29hfx9.js → index-Dm1UDg72.js} +2 -2
  55. package/web/assets/mount-app-Brtj-l-d.js +9 -0
  56. package/web/assets/panels-top-left-K8n2CefH.js +1 -0
  57. package/web/assets/{popover-CQqAaq-c.js → popover-BgmMy1PJ.js} +1 -1
  58. package/web/assets/public-BDXsCmtv.js +1 -0
  59. package/web/assets/{public-components-C4ndcOCF.js → public-components-w2PENGYg.js} +1 -1
  60. package/web/assets/{runtime-capabilities-store-CiL3ZPEo.js → runtime-capabilities-store-1N8axw9r.js} +1 -1
  61. package/web/assets/{session-change-summary-api--7cl4LDn.js → session-change-summary-api-BQILNzT4.js} +1 -1
  62. package/web/assets/{session-context-store-DJnHgWwb.js → session-context-store-DQHmNaRN.js} +1 -1
  63. package/web/assets/{session-list-DkNhT87s.js → session-list-JA31_Ff4.js} +1 -1
  64. package/web/assets/{settings-navigation-CI7Yt4Or.js → settings-navigation-dqR4yOPY.js} +1 -1
  65. package/web/assets/{shortcuts-C_Cph88H.js → shortcuts-CAX2SVZi.js} +1 -1
  66. package/web/assets/{side-chat-context-Dn8w9ut8.js → side-chat-context-B0oP2eS-.js} +2 -2
  67. package/web/assets/{speech-session-CoUr4n9Q.js → speech-session-C-vI4YXQ.js} +1 -1
  68. package/web/assets/{startup-queries-ByepQfGF.js → startup-queries-Ci3kCPI9.js} +1 -1
  69. package/web/assets/tabs-DQYVDdOp.js +1 -0
  70. package/web/assets/{ui-store-BGs-dEVz.js → ui-store-DLloh4Rv.js} +1 -1
  71. package/web/assets/{use-i18n-a84Zp9dV.js → use-i18n-C7st2Mx5.js} +1 -1
  72. package/web/assets/{useCustomUiComponents-BaQ_fwbr.js → useCustomUiComponents-B5fflBrn.js} +1 -1
  73. package/web/index.html +2 -2
  74. package/web/assets/AppSelect-BCexz4Ty.js +0 -1
  75. package/web/assets/ChatAppearancePage-BLRQ7aH6.js +0 -2
  76. package/web/assets/ChatPage-tqAIj2Go.js +0 -554
  77. package/web/assets/MobileContextScreen-W8V4H3Xv.js +0 -2
  78. package/web/assets/SessionContextPanel-oaKXyi7k.js +0 -1
  79. package/web/assets/SidebarRecentSessions-a7z2ZvDv.js +0 -2
  80. package/web/assets/WorkflowsPage-DrKHzJvb.js +0 -1
  81. package/web/assets/WorkspacePicker-B3liZkwe.js +0 -1
  82. package/web/assets/arrow-up-DST6-qVQ.js +0 -1
  83. package/web/assets/catalog-BPCnu3F8.js +0 -1
  84. package/web/assets/dist-B7rNRXig.js +0 -1
  85. package/web/assets/dist-C3P9WH0T.js +0 -1
  86. package/web/assets/dist-CXiO_DNx.js +0 -1
  87. package/web/assets/dist-D8Wfxh48.js +0 -1
  88. package/web/assets/folder-DPM8D8cf.js +0 -1
  89. package/web/assets/house-BNrzTkx9.js +0 -1
  90. package/web/assets/i18n-8nTnthu6.js +0 -1
  91. package/web/assets/index-BAmsg90v.css +0 -2
  92. package/web/assets/mount-app-WW5hteuX.js +0 -9
  93. package/web/assets/panels-top-left-BlZftvhg.js +0 -1
  94. package/web/assets/public-c36e4881.js +0 -1
  95. package/web/assets/tabs-B60r4YwO.js +0 -1
@@ -1 +1 @@
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-a84Zp9dV.js";import{t as i}from"./AppSelect-BCexz4Ty.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./circle-check-iEdCm3Pw.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./message-circle-D-XrK6Ft.js";import{t as u}from"./play-DNDjDNGn.js";import{t as d}from"./plus-fQbSqB1n.js";import{t as f}from"./refresh-cw-TbWxTY4K.js";import{t as p}from"./send-Cj-W03w_.js";import{t as m}from"./trash-2-CNrPOoPR.js";import{t as h}from"./triangle-alert-CE1q54ci.js";import{t as g}from"./x-07u4-129.js";import{t as _}from"./api-YI8_cHpR.js";import{t as v}from"./button-CQA36izu.js";import{WorkspacePicker as y}from"./WorkspacePicker-B3liZkwe.js";import{t as b}from"./field-3bN8nouy.js";import{r as x}from"./format-BRFKAYMT.js";import{i as S,l as C,n as w,o as T,r as E,s as D,t as O}from"./app-primitives-SxfoFmHc.js";import{t as k}from"./StarOrbit-BAAjh-hY.js";import{t as A}from"./usePagePrimaryAction-CWPC0C_f.js";import{n as j,t as M}from"./pick-system-directory-BnIFt85A.js";var N=e(t(),1),P=n(),F={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:l},qq:{name:`QQ`,Icon:l},telegram:{name:`Telegram`,Icon:p}},ee={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},te={minutes:`分钟`,hours:`小时`,days:`天`},ne=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],I=[`full-access`];function L(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function re(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function ie(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function R(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 z({value:e,onChange:t}){let{t:n}=r();return(0,P.jsxs)(b,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,P.jsx)(i,{value:e,onChange:e=>t(e.target.value),children:I.map(e=>(0,P.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,P.jsx)(`small`,{children:L(n)})]})}function B(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function V(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 H({targetType:e,prompt:t,workflowId:n,workflowInputs:a,workflows:o,onChange:s}){let{t:c}=r(),l=o.find(e=>e.id===n);return(0,P.jsxs)(`div`,{className:`grid gap-[10px]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[c(`schedules:schedulesPage.executionTarget`),(0,P.jsxs)(i,{value:e,onChange:e=>{let t=e.target.value,r=o[0];s(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?a:B(r)}:{targetType:t})},children:[(0,P.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,P.jsx)(`option`,{value:`workflow`,children:c(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,P.jsxs)(b,{variant:`control`,children:[`Prompt`,(0,P.jsx)(`textarea`,{value:t,onChange:e=>s({prompt:e.target.value}),placeholder:c(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{variant:`control`,children:[c(`schedules:schedulesPage.workflow`),(0,P.jsxs)(i,{value:n,onChange:e=>{let t=o.find(t=>t.id===e.target.value);s({workflowId:e.target.value,workflowInputs:B(t)})},children:[(0,P.jsx)(`option`,{value:``,children:c(`schedules:schedulesPage.selectPublishedWorkflow`)}),o.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,P.jsx)(`small`,{children:l?.description||(o.length?c(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):c(`schedules:schedulesPage.noPublishedWorkflows`))})]}),l?.inputs.length?(0,P.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,P.jsxs)(`div`,{className:`schedule-workflow-inputs-heading [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-right max-[650px]:items-start max-[650px]:flex-col max-[650px]:gap-[2px] max-[650px]:[&_small]:text-left flex [align-items:baseline] justify-between gap-[12px]`,children:[(0,P.jsx)(`strong`,{children:c(`schedules:schedulesPage.workflowInputs`)}),(0,P.jsx)(`small`,{children:c(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,P.jsx)(`div`,{className:`schedule-workflow-inputs [&_input[type='checkbox']]:w-[16px] [&_input[type='checkbox']]:h-[16px] [&_input[type='checkbox']]:[justify-self:end] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:l.inputs.map(e=>(0,P.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,P.jsx)(`input`,{type:`checkbox`,checked:!!a[e.name],onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.checked}})}):(0,P.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(a[e.name]??``),onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.value}})}),e.description&&(0,P.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function U({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),l=async()=>{if(a(``),!M()){s(!0);return}try{let n=await j(e);n&&t(n)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,P.jsxs)(`span`,{className:`schedule-workspace-input [&_input]:min-w-0 [&_input]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] grid grid-cols-[minmax(0,1fr)_auto] gap-[6px]`,children:[(0,P.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,P.jsxs)(v,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>void l(),children:[(0,P.jsx)(c,{size:13}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,P.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),i]}),(0,P.jsx)(y,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function W(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 G(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 K({notify:e,registerPrimaryAction:t,openNotificationSettings:n,requestConfirm:a}){let{t:o,language:c}=r(),[l,d]=(0,N.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[p,g]=(0,N.useState)(``),[y,j]=(0,N.useState)(null),[M,I]=(0,N.useState)(!0),[L,B]=(0,N.useState)(!1),[K,Y]=(0,N.useState)(``),[ae,oe]=(0,N.useState)(!1);A(t,()=>oe(!0));let X=(0,N.useCallback)(async()=>{try{let e=await _(`/api/schedules`);d(e),g(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id||``)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{I(!1)}},[]);(0,N.useEffect)(()=>{X()},[X]),(0,N.useEffect)(()=>{let e=window.setInterval(X,l.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[l.tasks,X]);let Z=l.tasks.find(e=>e.id===p),Q=l.workflows||[];(0,N.useEffect)(()=>{j(e=>Z?e?.id===Z.id?e:W(Z):null)},[Z]);let se=(0,N.useMemo)(()=>l.runs.filter(e=>e.taskId===p).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[l.runs,p]),$=e=>j(t=>t&&{...t,...e}),ce=e=>{y&&$({notifications:y.notifications.includes(e)?y.notifications.filter(t=>t!==e):[...y.notifications,e]})};return M?(0,P.jsxs)(E,{children:[(0,P.jsx)(f,{className:`animate-spin`,size:23}),(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.loadingScheduledTasks`)})]}):(0,P.jsxs)(P.Fragment,{children:[K&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),K]}),(0,P.jsxs)(`div`,{className:`split-list-detail grid min-h-[100%] min-w-0 grid-cols-[minmax(0,310px)_minmax(0,1fr)] gap-[12px] overflow-x-hidden max-[900px]:grid-cols-1 max-[650px]:gap-[8px]`,children:[(0,P.jsxs)(O,{className:`selection-list [.config-layout_>_&]:max-h-[calc(100dvh_-_280px)] [.config-layout_>_&]:overflow-y-auto max-[900px]:max-h-[300px] min-h-0 overflow-auto`,children:[(0,P.jsx)(T,{title:o(`schedules:schedulesPage.taskQueue`)}),l.tasks.length?l.tasks.map(e=>(0,P.jsx)(`div`,{className:`schedule-list-item hover:bg-[var(--accent-soft)] [&.active]:bg-[var(--accent-soft)] [&_>_button]:grid [&_>_button]:min-w-0 [&_>_button]:min-h-[68px] [&_>_button]:grid-cols-[minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[8px] [&_>_button]:border-0 [&_>_button]:bg-transparent [&_>_button]:p-[6px_2px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[5px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_em]:flex [&_em]:items-center [&_em]:gap-[4px] [&_em]:text-[var(--text-muted)] [&_em]:text-[13px] [&_em]:[font-style:normal] grid grid-cols-[minmax(0,1fr)_auto] items-center gap-[5px] [border-top:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] [padding:3px_5px] ${p===e.id?`active`:``}`,children:(0,P.jsxs)(`button`,{onClick:()=>g(e.id),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`div`,{className:`schedule-item-head [.schedule-list-item_&]:flex [.schedule-list-item_&]:min-w-0 [.schedule-list-item_&]:items-center [.schedule-list-item_&]:gap-[6px] [.schedule-list-item_&_strong]:flex-1 [.schedule-list-item_&_strong]:min-w-0`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(C,{tone:e.enabled?`green`:`gray`,children:e.enabled?o(`schedules:schedulesPage.enabled`):o(`schedules:schedulesPage.pause`)})]}),(0,P.jsx)(`small`,{children:e.targetType===`workflow`?Q.find(t=>t.id===e.workflowId)?.name||o(`schedules:schedulesPage.workflowUnavailable`):e.prompt})]}),(0,P.jsx)(`em`,{children:G(e,c)})]})},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center`,children:[(0,P.jsx)(k,{size:38}),(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.theTimelineIsStillUnlit`)}),(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})]})]}),Z&&y?(0,P.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(O,{children:[(0,P.jsxs)(w,{className:`max-[650px]:flex-wrap max-[650px]:items-start`,children:[(0,P.jsx)(`h2`,{className:`min-w-0 break-words`,children:y.name}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-[5px] max-[650px]:w-full`,children:[(0,P.jsx)(D,{value:y.enabled,onChange:e=>$({enabled:e}),ariaLabel:y.name}),(0,P.jsxs)(v,{size:`lg`,disabled:L||Z.lastStatus===`running`,onClick:async()=>{if(Z){B(!0),Y(``);try{await _(`/api/schedules/${encodeURIComponent(Z.id)}/run`,{method:`POST`,body:`{}`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{B(!1)}}},children:[Z.lastStatus===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(u,{size:14}),Z.lastStatus===`running`?o(`schedules:schedulesPage.running`):o(`schedules:schedulesPage.runNow`)]}),(0,P.jsx)(v,{variant:`destructive`,size:`icon`,title:o(`schedules:schedulesPage.deleteTask`),"aria-label":o(`schedules:schedulesPage.deleteTask`),onClick:async()=>{if(Z&&await a({title:o(`schedules:schedulesPage.deleteScheduledTask`),message:o(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:Z.name}),confirmLabel:o(`schedules:schedulesPage.delete`)}))try{await _(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`DELETE`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){Y(e instanceof Error?e.message:String(e))}},children:(0,P.jsx)(m,{size:14})})]})]}),(0,P.jsx)(H,{targetType:y.targetType,prompt:y.prompt,workflowId:y.workflowId,workflowInputs:y.workflowInputs,workflows:Q,onChange:$}),y.targetType===`prompt`&&(0,P.jsx)(U,{value:y.cwd,onChange:e=>$({cwd:e})}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:y.frequency,onChange:e=>$({frequency:e.target.value}),children:Object.keys(ee).map(e=>(0,P.jsx)(`option`,{value:e,children:re(e,o)},e))})]}),y.frequency===`interval`?(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:y.intervalValue,onChange:e=>$({intervalValue:Number(e.target.value)})}),(0,P.jsx)(i,{value:y.intervalUnit,onChange:e=>$({intervalUnit:e.target.value}),children:Object.keys(te).map(e=>(0,P.jsx)(`option`,{value:e,children:ie(e,o)},e))})]})]}):(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:y.time,onChange:e=>$({time:e.target.value})})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:y.timezone,onChange:e=>$({timezone:e.target.value}),children:ne.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),y.targetType===`prompt`&&(0,P.jsx)(z,{value:y.executionMode,onChange:e=>$({executionMode:e})})]}),(0,P.jsxs)(`div`,{className:`schedule-notification-section [&_>_div:first-child]:flex [&_>_div:first-child]:items-center [&_>_div:first-child]:justify-between [&_>_div:first-child]:gap-[8px] [&_>_div:first-child_strong]:text-[13px] [&_>_p]:mt-[4px] [&_>_p]:text-[var(--text-muted)] [&_>_p]:text-[13px] [margin-top:13px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.notificationChannels`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-button hover:text-[var(--text)] border-0 bg-transparent text-[var(--text-soft)] text-[12px] font-[600] [text-decoration:underline] [text-underline-offset:2px]`,onClick:n,children:o(`schedules:schedulesPage.editTemplates`)})]}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,P.jsx)(`div`,{className:`schedule-notification-targets [&_>_button]:grid [&_>_button]:min-h-[52px] [&_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[7px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--surface-subtle)] [&_>_button]:p-[7px_8px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_button_>_svg:last-child]:text-[var(--control-muted)] [&_>_button.selected]:border-[var(--focus)] [&_>_button.selected]:bg-[var(--accent-soft)] [&_>_button.selected]:text-[var(--star-strong)] [&_>_button.selected_>_svg:last-child]:text-[var(--success)] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(5,minmax(0,1fr))] gap-[7px] [margin-top:9px]`,children:Object.entries(F).map(([e,t])=>{let n=t.Icon,r=y.notifications.includes(e);return(0,P.jsxs)(`button`,{type:`button`,className:r?`selected`:``,onClick:()=>ce(e),children:[(0,P.jsx)(n,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:R(e,o)}),(0,P.jsx)(`small`,{children:l.notificationTargets[e].enabled?o(`schedules:schedulesPage.configured`):o(`schedules:schedulesPage.notConfigured`)})]}),(0,P.jsx)(s,{size:15})]},e)})}),(0,P.jsx)(`div`,{className:`flex items-center gap-[6px] [margin-top:9px]`,children:(0,P.jsx)(`button`,{type:`button`,className:`schedule-notification-chip [&.selected]:border-[var(--control-selected-border)] [&.selected]:bg-[var(--control-selected-bg)] [&.selected]:text-[var(--control-selected-text)] [&.selected]:shadow-[var(--sh-1)] dark:bg-[var(--surface-subtle)] inline-flex h-[32px] items-center gap-[4px] [border:1px_solid_var(--stroke)] rounded-[var(--r-pill)] bg-[var(--surface-subtle)] text-[var(--text-muted)] [padding:0_10px] text-[13px] font-[600] ${y.notifyOn===`failure`?`selected`:``}`,onClick:()=>$({notifyOn:y.notifyOn===`failure`?`always`:`failure`}),children:y.notifyOn===`failure`?o(`schedules:schedulesPage.failuresOnly`):o(`schedules:schedulesPage.completionAndFailure`)})})]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:Z.lastRunAt?o(`schedules:schedulesPage.lastRunTime`,{time:x(Z.lastRunAt,c)}):o(`schedules:schedulesPage.nextRunTime`,{time:G(Z,c)})}),(0,P.jsxs)(v,{size:`lg`,disabled:L||!V(y.targetType,y.prompt,y.workflowId,y.workflowInputs,Q),onClick:async()=>{if(!(!Z||!y)){B(!0),Y(``);try{let t=await _(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`PATCH`,body:JSON.stringify(y)});d(t.state),j(W(t.task)),e(o(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{B(!1)}}},children:[L?(0,P.jsx)(f,{className:`animate-spin`,size:14}):null,o(L?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,P.jsxs)(O,{children:[(0,P.jsx)(T,{title:o(`schedules:schedulesPage.recentRuns`)}),se.length?se.map(e=>(0,P.jsxs)(`div`,{className:`schedule-run-row [&_>_svg]:text-[var(--text-muted)] [&.completed_>_svg]:text-[var(--success)] [&.failed_>_svg]:text-[var(--danger)] [&.running_>_svg]:text-[var(--star-strong)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[4px] [&_strong]:[display:-webkit-box] [&_strong]:overflow-hidden [&_strong]:text-[12px] [&_strong]:leading-[1.4] [&_strong]:[-webkit-box-orient:vertical] [&_strong]:[-webkit-line-clamp:2] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_a]:text-[var(--text-soft)] [&_a]:text-[13px] [&_a]:[text-decoration:underline] [&_a]:[text-underline-offset:2px] [&_>_em]:text-[var(--text-secondary)] [&_>_em]:text-[12px] [&_>_em]:[font-style:normal] [&_>_em]:whitespace-nowrap grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:10px_2px] ${e.status}`,children:[e.status===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:15}):e.status===`completed`?(0,P.jsx)(s,{size:15}):(0,P.jsx)(h,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.status===`running`?o(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||o(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?o(`schedules:schedulesPage.taskInterrupted`):e.error||o(`schedules:schedulesPage.taskFailed`)}),(0,P.jsxs)(`small`,{children:[x(e.startedAt,c),` ·`,` `,e.trigger===`manual`?o(`schedules:schedulesPage.manualRun`):o(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${o(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,P.jsx)(`em`,{children:new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:[(0,P.jsx)(k,{size:32}),(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.noRunHistory`)})]})]})]}):(0,P.jsx)(q,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onCreated:t=>{d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]}),ae&&(0,P.jsx)(J,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onClose:()=>oe(!1),onCreated:t=>{oe(!1),d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]})}function q({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,m]=(0,N.useState)(``),[g,y]=(0,N.useState)(``),[x,C]=(0,N.useState)({}),[T,E]=(0,N.useState)(n||``),[D,k]=(0,N.useState)(`daily`),[A,j]=(0,N.useState)(`09:00`),[M,F]=(0,N.useState)(`Asia/Hong_Kong`),[I,L]=(0,N.useState)(1),[R,B]=(0,N.useState)(`hours`),[W,G]=(0,N.useState)(`full-access`),[K,q]=(0,N.useState)(!1),[J,Y]=(0,N.useState)(``);return(0,P.jsxs)(O,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(H,{targetType:l,prompt:p,workflowId:g,workflowInputs:x,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&y(e.workflowId),e.workflowInputs!==void 0&&C(e.workflowInputs)}}),l===`prompt`&&(0,P.jsx)(U,{value:T,onChange:E}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:D,onChange:e=>k(e.target.value),children:Object.keys(ee).map(e=>(0,P.jsx)(`option`,{value:e,children:re(e,o)},e))})]}),D===`interval`?(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:I,onChange:e=>L(Number(e.target.value))}),(0,P.jsx)(i,{value:R,onChange:e=>B(e.target.value),children:Object.keys(te).map(e=>(0,P.jsx)(`option`,{value:e,children:ie(e,o)},e))})]})]}):(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:A,onChange:e=>j(e.target.value)})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:M,onChange:e=>F(e.target.value),children:ne.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,P.jsx)(z,{value:W,onChange:G})]}),J&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),J]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,P.jsxs)(v,{size:`lg`,disabled:K||!s.trim()||!V(l,p,g,x,t),onClick:async()=>{q(!0),Y(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await _(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:g,workflowInputs:x,cwd:T,enabled:!0,frequency:D,time:A,timezone:M,intervalValue:I,intervalUnit:R,executionMode:W,notifications:t,notifyOn:`always`})}))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}},children:[K?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(K?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function J({notificationTargets:e,workflows:t,defaultCwd:n,onClose:i,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,m]=(0,N.useState)(``),[y,x]=(0,N.useState)(``),[C,T]=(0,N.useState)({}),[E,D]=(0,N.useState)(n||``),[O,k]=(0,N.useState)(`full-access`),[A,j]=(0,N.useState)(!1),[M,F]=(0,N.useState)(``);return(0,P.jsx)(`div`,{className:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [backdrop-filter:blur(3px)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`form`,{className:`modal !w-[min(430px,100%)] max-h-[calc(100dvh_-_40px)] overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async t=>{t.preventDefault(),j(!0),F(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await _(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:y,workflowInputs:C,cwd:E,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:O,notifications:t,notifyOn:`always`})}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{j(!1)}},children:[(0,P.jsxs)(w,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,P.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":o(`schedules:schedulesPage.closeDialog`),onClick:i,children:(0,P.jsx)(g,{size:17})})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(H,{targetType:l,prompt:p,workflowId:y,workflowInputs:C,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&x(e.workflowId),e.workflowInputs!==void 0&&T(e.workflowInputs)}}),l===`prompt`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(U,{value:E,onChange:D}),(0,P.jsx)(z,{value:O,onChange:k})]}),M&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),M]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,P.jsx)(v,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i,children:o(`schedules:schedulesPage.cancel`)}),(0,P.jsxs)(v,{size:`lg`,disabled:A||!s.trim()||!V(l,p,y,C,t),children:[A?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(A?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})}export{K as SchedulesPage};
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-C7st2Mx5.js";import{t as i}from"./AppSelect-D149YYg1.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./circle-check-iEdCm3Pw.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./message-circle-D-XrK6Ft.js";import{t as u}from"./play-DNDjDNGn.js";import{t as d}from"./plus-fQbSqB1n.js";import{t as f}from"./refresh-cw-TbWxTY4K.js";import{t as p}from"./send-Cj-W03w_.js";import{t as m}from"./trash-2-CNrPOoPR.js";import{t as h}from"./triangle-alert-CE1q54ci.js";import{t as g}from"./x-07u4-129.js";import{t as _}from"./api-DmuPqjXK.js";import{t as v}from"./button-CQA36izu.js";import{WorkspacePicker as y}from"./WorkspacePicker-CDJPgjpW.js";import{t as b}from"./field-3bN8nouy.js";import{r as x}from"./format-BRFKAYMT.js";import{i as S,l as C,n as w,o as T,r as E,s as D,t as O}from"./app-primitives-BBXY6U2S.js";import{n as k,t as A}from"./pick-system-directory-BnIFt85A.js";import{t as j}from"./StarOrbit-BAAjh-hY.js";import{t as M}from"./usePagePrimaryAction-CWPC0C_f.js";var N=e(t(),1),P=n(),F={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:l},qq:{name:`QQ`,Icon:l},telegram:{name:`Telegram`,Icon:p}},ee={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},te={minutes:`分钟`,hours:`小时`,days:`天`},ne=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],I=[`full-access`];function L(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function re(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function ie(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function R(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 z({value:e,onChange:t}){let{t:n}=r();return(0,P.jsxs)(b,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,P.jsx)(i,{value:e,onChange:e=>t(e.target.value),children:I.map(e=>(0,P.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,P.jsx)(`small`,{children:L(n)})]})}function B(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function V(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 H({targetType:e,prompt:t,workflowId:n,workflowInputs:a,workflows:o,onChange:s}){let{t:c}=r(),l=o.find(e=>e.id===n);return(0,P.jsxs)(`div`,{className:`grid gap-[10px]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[c(`schedules:schedulesPage.executionTarget`),(0,P.jsxs)(i,{value:e,onChange:e=>{let t=e.target.value,r=o[0];s(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?a:B(r)}:{targetType:t})},children:[(0,P.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,P.jsx)(`option`,{value:`workflow`,children:c(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,P.jsxs)(b,{variant:`control`,children:[`Prompt`,(0,P.jsx)(`textarea`,{value:t,onChange:e=>s({prompt:e.target.value}),placeholder:c(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{variant:`control`,children:[c(`schedules:schedulesPage.workflow`),(0,P.jsxs)(i,{value:n,onChange:e=>{let t=o.find(t=>t.id===e.target.value);s({workflowId:e.target.value,workflowInputs:B(t)})},children:[(0,P.jsx)(`option`,{value:``,children:c(`schedules:schedulesPage.selectPublishedWorkflow`)}),o.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,P.jsx)(`small`,{children:l?.description||(o.length?c(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):c(`schedules:schedulesPage.noPublishedWorkflows`))})]}),l?.inputs.length?(0,P.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,P.jsxs)(`div`,{className:`schedule-workflow-inputs-heading [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-right max-[650px]:items-start max-[650px]:flex-col max-[650px]:gap-[2px] max-[650px]:[&_small]:text-left flex [align-items:baseline] justify-between gap-[12px]`,children:[(0,P.jsx)(`strong`,{children:c(`schedules:schedulesPage.workflowInputs`)}),(0,P.jsx)(`small`,{children:c(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,P.jsx)(`div`,{className:`schedule-workflow-inputs [&_input[type='checkbox']]:w-[16px] [&_input[type='checkbox']]:h-[16px] [&_input[type='checkbox']]:[justify-self:end] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:l.inputs.map(e=>(0,P.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,P.jsx)(`input`,{type:`checkbox`,checked:!!a[e.name],onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.checked}})}):(0,P.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(a[e.name]??``),onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.value}})}),e.description&&(0,P.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function U({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),l=async()=>{if(a(``),!A()){s(!0);return}try{let n=await k(e);n&&t(n)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,P.jsxs)(`span`,{className:`schedule-workspace-input [&_input]:min-w-0 [&_input]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] grid grid-cols-[minmax(0,1fr)_auto] gap-[6px]`,children:[(0,P.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,P.jsxs)(v,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>void l(),children:[(0,P.jsx)(c,{size:13}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,P.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),i]}),(0,P.jsx)(y,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function W(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 G(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 K({notify:e,registerPrimaryAction:t,openNotificationSettings:n,requestConfirm:a}){let{t:o,language:c}=r(),[l,d]=(0,N.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[p,g]=(0,N.useState)(``),[y,k]=(0,N.useState)(null),[A,I]=(0,N.useState)(!0),[L,B]=(0,N.useState)(!1),[K,Y]=(0,N.useState)(``),[ae,oe]=(0,N.useState)(!1);M(t,()=>oe(!0));let X=(0,N.useCallback)(async()=>{try{let e=await _(`/api/schedules`);d(e),g(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id||``)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{I(!1)}},[]);(0,N.useEffect)(()=>{X()},[X]),(0,N.useEffect)(()=>{let e=window.setInterval(X,l.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[l.tasks,X]);let Z=l.tasks.find(e=>e.id===p),Q=l.workflows||[];(0,N.useEffect)(()=>{k(e=>Z?e?.id===Z.id?e:W(Z):null)},[Z]);let se=(0,N.useMemo)(()=>l.runs.filter(e=>e.taskId===p).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[l.runs,p]),$=e=>k(t=>t&&{...t,...e}),ce=e=>{y&&$({notifications:y.notifications.includes(e)?y.notifications.filter(t=>t!==e):[...y.notifications,e]})};return A?(0,P.jsxs)(E,{children:[(0,P.jsx)(f,{className:`animate-spin`,size:23}),(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.loadingScheduledTasks`)})]}):(0,P.jsxs)(P.Fragment,{children:[K&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),K]}),(0,P.jsxs)(`div`,{className:`split-list-detail grid min-h-[100%] min-w-0 grid-cols-[minmax(0,310px)_minmax(0,1fr)] gap-[12px] overflow-x-hidden max-[900px]:grid-cols-1 max-[650px]:gap-[8px]`,children:[(0,P.jsxs)(O,{className:`selection-list [.config-layout_>_&]:max-h-[calc(100dvh_-_280px)] [.config-layout_>_&]:overflow-y-auto max-[900px]:max-h-[300px] min-h-0 overflow-auto`,children:[(0,P.jsx)(T,{title:o(`schedules:schedulesPage.taskQueue`)}),l.tasks.length?l.tasks.map(e=>(0,P.jsx)(`div`,{className:`schedule-list-item hover:bg-[var(--accent-soft)] [&.active]:bg-[var(--accent-soft)] [&_>_button]:grid [&_>_button]:min-w-0 [&_>_button]:min-h-[68px] [&_>_button]:grid-cols-[minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[8px] [&_>_button]:border-0 [&_>_button]:bg-transparent [&_>_button]:p-[6px_2px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[5px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_em]:flex [&_em]:items-center [&_em]:gap-[4px] [&_em]:text-[var(--text-muted)] [&_em]:text-[13px] [&_em]:[font-style:normal] grid grid-cols-[minmax(0,1fr)_auto] items-center gap-[5px] [border-top:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] [padding:3px_5px] ${p===e.id?`active`:``}`,children:(0,P.jsxs)(`button`,{onClick:()=>g(e.id),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`div`,{className:`schedule-item-head [.schedule-list-item_&]:flex [.schedule-list-item_&]:min-w-0 [.schedule-list-item_&]:items-center [.schedule-list-item_&]:gap-[6px] [.schedule-list-item_&_strong]:flex-1 [.schedule-list-item_&_strong]:min-w-0`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(C,{tone:e.enabled?`green`:`gray`,children:e.enabled?o(`schedules:schedulesPage.enabled`):o(`schedules:schedulesPage.pause`)})]}),(0,P.jsx)(`small`,{children:e.targetType===`workflow`?Q.find(t=>t.id===e.workflowId)?.name||o(`schedules:schedulesPage.workflowUnavailable`):e.prompt})]}),(0,P.jsx)(`em`,{children:G(e,c)})]})},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center`,children:[(0,P.jsx)(j,{size:38}),(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.theTimelineIsStillUnlit`)}),(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})]})]}),Z&&y?(0,P.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(O,{children:[(0,P.jsxs)(w,{className:`max-[650px]:flex-wrap max-[650px]:items-start`,children:[(0,P.jsx)(`h2`,{className:`min-w-0 break-words`,children:y.name}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-[5px] max-[650px]:w-full`,children:[(0,P.jsx)(D,{value:y.enabled,onChange:e=>$({enabled:e}),ariaLabel:y.name}),(0,P.jsxs)(v,{size:`lg`,disabled:L||Z.lastStatus===`running`,onClick:async()=>{if(Z){B(!0),Y(``);try{await _(`/api/schedules/${encodeURIComponent(Z.id)}/run`,{method:`POST`,body:`{}`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{B(!1)}}},children:[Z.lastStatus===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(u,{size:14}),Z.lastStatus===`running`?o(`schedules:schedulesPage.running`):o(`schedules:schedulesPage.runNow`)]}),(0,P.jsx)(v,{variant:`destructive`,size:`icon`,title:o(`schedules:schedulesPage.deleteTask`),"aria-label":o(`schedules:schedulesPage.deleteTask`),onClick:async()=>{if(Z&&await a({title:o(`schedules:schedulesPage.deleteScheduledTask`),message:o(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:Z.name}),confirmLabel:o(`schedules:schedulesPage.delete`)}))try{await _(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`DELETE`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){Y(e instanceof Error?e.message:String(e))}},children:(0,P.jsx)(m,{size:14})})]})]}),(0,P.jsx)(H,{targetType:y.targetType,prompt:y.prompt,workflowId:y.workflowId,workflowInputs:y.workflowInputs,workflows:Q,onChange:$}),y.targetType===`prompt`&&(0,P.jsx)(U,{value:y.cwd,onChange:e=>$({cwd:e})}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:y.frequency,onChange:e=>$({frequency:e.target.value}),children:Object.keys(ee).map(e=>(0,P.jsx)(`option`,{value:e,children:re(e,o)},e))})]}),y.frequency===`interval`?(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:y.intervalValue,onChange:e=>$({intervalValue:Number(e.target.value)})}),(0,P.jsx)(i,{value:y.intervalUnit,onChange:e=>$({intervalUnit:e.target.value}),children:Object.keys(te).map(e=>(0,P.jsx)(`option`,{value:e,children:ie(e,o)},e))})]})]}):(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:y.time,onChange:e=>$({time:e.target.value})})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:y.timezone,onChange:e=>$({timezone:e.target.value}),children:ne.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),y.targetType===`prompt`&&(0,P.jsx)(z,{value:y.executionMode,onChange:e=>$({executionMode:e})})]}),(0,P.jsxs)(`div`,{className:`schedule-notification-section [&_>_div:first-child]:flex [&_>_div:first-child]:items-center [&_>_div:first-child]:justify-between [&_>_div:first-child]:gap-[8px] [&_>_div:first-child_strong]:text-[13px] [&_>_p]:mt-[4px] [&_>_p]:text-[var(--text-muted)] [&_>_p]:text-[13px] [margin-top:13px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.notificationChannels`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-button hover:text-[var(--text)] border-0 bg-transparent text-[var(--text-soft)] text-[12px] font-[600] [text-decoration:underline] [text-underline-offset:2px]`,onClick:n,children:o(`schedules:schedulesPage.editTemplates`)})]}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,P.jsx)(`div`,{className:`schedule-notification-targets [&_>_button]:grid [&_>_button]:min-h-[52px] [&_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[7px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--surface-subtle)] [&_>_button]:p-[7px_8px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_button_>_svg:last-child]:text-[var(--control-muted)] [&_>_button.selected]:border-[var(--focus)] [&_>_button.selected]:bg-[var(--accent-soft)] [&_>_button.selected]:text-[var(--star-strong)] [&_>_button.selected_>_svg:last-child]:text-[var(--success)] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(5,minmax(0,1fr))] gap-[7px] [margin-top:9px]`,children:Object.entries(F).map(([e,t])=>{let n=t.Icon,r=y.notifications.includes(e);return(0,P.jsxs)(`button`,{type:`button`,className:r?`selected`:``,onClick:()=>ce(e),children:[(0,P.jsx)(n,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:R(e,o)}),(0,P.jsx)(`small`,{children:l.notificationTargets[e].enabled?o(`schedules:schedulesPage.configured`):o(`schedules:schedulesPage.notConfigured`)})]}),(0,P.jsx)(s,{size:15})]},e)})}),(0,P.jsx)(`div`,{className:`flex items-center gap-[6px] [margin-top:9px]`,children:(0,P.jsx)(`button`,{type:`button`,className:`schedule-notification-chip [&.selected]:border-[var(--control-selected-border)] [&.selected]:bg-[var(--control-selected-bg)] [&.selected]:text-[var(--control-selected-text)] [&.selected]:shadow-[var(--sh-1)] dark:bg-[var(--surface-subtle)] inline-flex h-[32px] items-center gap-[4px] [border:1px_solid_var(--stroke)] rounded-[var(--r-pill)] bg-[var(--surface-subtle)] text-[var(--text-muted)] [padding:0_10px] text-[13px] font-[600] ${y.notifyOn===`failure`?`selected`:``}`,onClick:()=>$({notifyOn:y.notifyOn===`failure`?`always`:`failure`}),children:y.notifyOn===`failure`?o(`schedules:schedulesPage.failuresOnly`):o(`schedules:schedulesPage.completionAndFailure`)})})]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:Z.lastRunAt?o(`schedules:schedulesPage.lastRunTime`,{time:x(Z.lastRunAt,c)}):o(`schedules:schedulesPage.nextRunTime`,{time:G(Z,c)})}),(0,P.jsxs)(v,{size:`lg`,disabled:L||!V(y.targetType,y.prompt,y.workflowId,y.workflowInputs,Q),onClick:async()=>{if(!(!Z||!y)){B(!0),Y(``);try{let t=await _(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`PATCH`,body:JSON.stringify(y)});d(t.state),k(W(t.task)),e(o(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{B(!1)}}},children:[L?(0,P.jsx)(f,{className:`animate-spin`,size:14}):null,o(L?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,P.jsxs)(O,{children:[(0,P.jsx)(T,{title:o(`schedules:schedulesPage.recentRuns`)}),se.length?se.map(e=>(0,P.jsxs)(`div`,{className:`schedule-run-row [&_>_svg]:text-[var(--text-muted)] [&.completed_>_svg]:text-[var(--success)] [&.failed_>_svg]:text-[var(--danger)] [&.running_>_svg]:text-[var(--star-strong)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[4px] [&_strong]:[display:-webkit-box] [&_strong]:overflow-hidden [&_strong]:text-[12px] [&_strong]:leading-[1.4] [&_strong]:[-webkit-box-orient:vertical] [&_strong]:[-webkit-line-clamp:2] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_a]:text-[var(--text-soft)] [&_a]:text-[13px] [&_a]:[text-decoration:underline] [&_a]:[text-underline-offset:2px] [&_>_em]:text-[var(--text-secondary)] [&_>_em]:text-[12px] [&_>_em]:[font-style:normal] [&_>_em]:whitespace-nowrap grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:10px_2px] ${e.status}`,children:[e.status===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:15}):e.status===`completed`?(0,P.jsx)(s,{size:15}):(0,P.jsx)(h,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.status===`running`?o(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||o(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?o(`schedules:schedulesPage.taskInterrupted`):e.error||o(`schedules:schedulesPage.taskFailed`)}),(0,P.jsxs)(`small`,{children:[x(e.startedAt,c),` ·`,` `,e.trigger===`manual`?o(`schedules:schedulesPage.manualRun`):o(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${o(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,P.jsx)(`em`,{children:new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:[(0,P.jsx)(j,{size:32}),(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.noRunHistory`)})]})]})]}):(0,P.jsx)(q,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onCreated:t=>{d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]}),ae&&(0,P.jsx)(J,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onClose:()=>oe(!1),onCreated:t=>{oe(!1),d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]})}function q({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,m]=(0,N.useState)(``),[g,y]=(0,N.useState)(``),[x,C]=(0,N.useState)({}),[T,E]=(0,N.useState)(n||``),[D,k]=(0,N.useState)(`daily`),[A,j]=(0,N.useState)(`09:00`),[M,F]=(0,N.useState)(`Asia/Hong_Kong`),[I,L]=(0,N.useState)(1),[R,B]=(0,N.useState)(`hours`),[W,G]=(0,N.useState)(`full-access`),[K,q]=(0,N.useState)(!1),[J,Y]=(0,N.useState)(``);return(0,P.jsxs)(O,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(H,{targetType:l,prompt:p,workflowId:g,workflowInputs:x,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&y(e.workflowId),e.workflowInputs!==void 0&&C(e.workflowInputs)}}),l===`prompt`&&(0,P.jsx)(U,{value:T,onChange:E}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:D,onChange:e=>k(e.target.value),children:Object.keys(ee).map(e=>(0,P.jsx)(`option`,{value:e,children:re(e,o)},e))})]}),D===`interval`?(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:I,onChange:e=>L(Number(e.target.value))}),(0,P.jsx)(i,{value:R,onChange:e=>B(e.target.value),children:Object.keys(te).map(e=>(0,P.jsx)(`option`,{value:e,children:ie(e,o)},e))})]})]}):(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:A,onChange:e=>j(e.target.value)})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:M,onChange:e=>F(e.target.value),children:ne.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,P.jsx)(z,{value:W,onChange:G})]}),J&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),J]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,P.jsxs)(v,{size:`lg`,disabled:K||!s.trim()||!V(l,p,g,x,t),onClick:async()=>{q(!0),Y(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await _(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:g,workflowInputs:x,cwd:T,enabled:!0,frequency:D,time:A,timezone:M,intervalValue:I,intervalUnit:R,executionMode:W,notifications:t,notifyOn:`always`})}))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}},children:[K?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(K?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function J({notificationTargets:e,workflows:t,defaultCwd:n,onClose:i,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,m]=(0,N.useState)(``),[y,x]=(0,N.useState)(``),[C,T]=(0,N.useState)({}),[E,D]=(0,N.useState)(n||``),[O,k]=(0,N.useState)(`full-access`),[A,j]=(0,N.useState)(!1),[M,F]=(0,N.useState)(``);return(0,P.jsx)(`div`,{className:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [backdrop-filter:blur(3px)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`form`,{className:`modal !w-[min(430px,100%)] max-h-[calc(100dvh_-_40px)] overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async t=>{t.preventDefault(),j(!0),F(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await _(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:y,workflowInputs:C,cwd:E,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:O,notifications:t,notifyOn:`always`})}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{j(!1)}},children:[(0,P.jsxs)(w,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,P.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":o(`schedules:schedulesPage.closeDialog`),onClick:i,children:(0,P.jsx)(g,{size:17})})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(H,{targetType:l,prompt:p,workflowId:y,workflowInputs:C,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&x(e.workflowId),e.workflowInputs!==void 0&&T(e.workflowInputs)}}),l===`prompt`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(U,{value:E,onChange:D}),(0,P.jsx)(z,{value:O,onChange:k})]}),M&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),M]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,P.jsx)(v,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i,children:o(`schedules:schedulesPage.cancel`)}),(0,P.jsxs)(v,{size:`lg`,disabled:A||!s.trim()||!V(l,p,y,C,t),children:[A?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(A?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})}export{K as SchedulesPage};
@@ -0,0 +1 @@
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-C7st2Mx5.js";import{o as i}from"./vendor-state-GkUciC5H.js";import"./collapsible-C__hRcbA.js";import{a,n as o,r as s,t as c}from"./dropdown-menu-DmL4pJTo.js";import{o as l}from"./popover-BgmMy1PJ.js";import"./tooltip-Bxq7c2mZ.js";import{t as u}from"./utils-C8uzG5AZ.js";import{t as d}from"./createLucideIcon-Cd-3GVxJ.js";import{t as f}from"./earth-Ddy13fHh.js";import{t as p}from"./external-link-CEQqPcqc.js";import{a as m,h,i as g,k as _,m as v,o as y,r as b,s as x}from"./side-chat-context-B0oP2eS-.js";import{t as S}from"./loader-circle-BOwQzHB-.js";import{t as C}from"./message-square-SKjZyY3v.js";import{t as w}from"./plus-fQbSqB1n.js";import{t as T}from"./square-bHHVTT3G.js";import{t as E}from"./x-07u4-129.js";import{t as D}from"./button-CQA36izu.js";import{t as O}from"./SessionFilesPane-CUhqwp87.js";import"./input-CvjGYteF.js";import{r as k,s as A}from"./shortcuts-CAX2SVZi.js";import{a as j,i as M,n as N,t as P}from"./sheet--Om3LZxh.js";import{t as F}from"./web-preview-B7L-G6kp.js";var I=d(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),L=e(t(),1);function R(e=`files`){return{pages:[{id:`page-1`,kind:e,draft:``,url:``}],activeId:`page-1`,nextId:2}}function z(e,t){if(t.type===`add`){let n=e.pages.find(e=>e.kind===`side-chat`);if(t.kind===`side-chat`&&n)return{...e,activeId:n.id};if(e.pages.length>=12)return e;let r={id:`page-${e.nextId}`,kind:t.kind,draft:``,url:``};return{pages:[...e.pages,r],activeId:r.id,nextId:e.nextId+1}}let n=e.pages.findIndex(e=>e.id===t.id);if(n<0)return e;if(t.type===`select`)return{...e,activeId:t.id};if(t.type===`close`){let r=e.pages.filter(e=>e.id!==t.id);return r.length?{...e,pages:r,activeId:e.activeId===t.id?r[Math.min(n,r.length-1)].id:e.activeId}:R()}return{...e,pages:e.pages.map(e=>e.id===t.id?t.type===`kind`?{...e,kind:t.kind}:{...e,...t.draft===void 0?{}:{draft:t.draft},...t.url===void 0?{}:{url:t.url}}:e)}}var B=i(e=>({sessions:{},update:(t,n,r)=>e(e=>{let i=Object.prototype.hasOwnProperty.call(e.sessions,t)?e.sessions[t]:R(n),a=Object.entries(e.sessions).filter(([e])=>e!==t).slice(-31);return{sessions:Object.fromEntries([...a,[t,z(i,r)]])}})})),V=n(),H=(0,L.createContext)(null),U=()=>{let e=(0,L.useContext)(H);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},W=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,L.useState)(n),[s,c]=(0,L.useState)(!1),l=(0,L.useCallback)(e=>{o(e),r?.(e)},[r]),d=(0,L.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,V.jsx)(H.Provider,{value:d,children:(0,V.jsx)(`div`,{className:u(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},G=({className:e,loading:t,src:n,...r})=>{let{url:i}=U();return(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,V.jsx)(`iframe`,{className:u(`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 K({parentId:e,active:t}){let{t:n}=r(),{entry:i,runtime:a,load:o,setDraft:s}=b(e),c=i.session?.id??``,u=(0,L.useMemo)(()=>e=>a.subscribeSessionState(c,e),[a,c]),d=(0,L.useMemo)(()=>()=>a.getSessionState(c),[a,c]),f=(0,L.useSyncExternalStore)(u,d),[p,_]=(0,L.useState)(!1),[v,w]=(0,L.useState)(!1),[E,O]=(0,L.useState)(``),j=(0,L.useRef)(!1),M=(0,L.useRef)(!1),N=(0,L.useRef)(i.draft);N.current=i.draft;let P=(0,L.useRef)(null),F=A(e=>e.bindings),I=g(f,i.session);(0,L.useEffect)(()=>{t&&o(e)},[t,o,e]);let R=async t=>{t.preventDefault();let n=N.current.trim();if(!(!n||j.current||I||i.expired)){j.current=!0,_(!0),O(``);try{let t=await o(e,!i.session);if(!t?.session)return;let r=t.session.id;if(a.getSessionState(r).streaming)return;N.current.trim()===n&&s(e,``),_(!1),await a.send(r,n),await o(e)}catch(e){O(x(e))}finally{j.current=!1,_(!1)}}},z=(0,L.useCallback)(async()=>{if(!(!c||a.getSessionState(c).streaming)){O(``);try{await a.retry(c),await o(e)}catch(e){O(x(e))}}},[o,e,a,c]),B=async()=>{if(!(!c||v)){w(!0);try{O(``),await a.abort(c)}catch(e){O(x(e))}finally{w(!1)}}},H=(0,V.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-3 px-3 text-center text-sm text-muted-foreground`,children:[(0,V.jsx)(C,{size:22,"aria-hidden":`true`}),(0,V.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:i.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),i.expired&&(0,V.jsxs)(D,{variant:`outline`,size:`sm`,disabled:i.loading,onClick:async()=>{(await o(e,!0))?.session&&P.current?.focus()},children:[i.loading&&(0,V.jsx)(S,{className:`size-4 animate-spin`}),n(`chat:sideChat.restart`)]})]}),U=E||i.error||f.error;return(0,V.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,V.jsx)(`p`,{className:`shrink-0 border-b border-border/50 px-3 py-2 text-xs leading-relaxed text-muted-foreground`,children:n(`chat:sideChat.retention`)}),c?(0,V.jsx)(y,{sessionId:c,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:H,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:I,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:i.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(c),onRetryLastTurn:z}):(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:H}),(0,V.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-border/50 p-3`,onSubmit:R,children:[U&&(0,V.jsx)(h,{error:U,onRetry:i.error||!f.loaded?async()=>{await o(e)}:z}),(0,V.jsx)(m,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(c,e,t)}catch{}}}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-xl border border-border/70 bg-muted/40 p-2 focus-within:border-ring/50`,children:[(0,V.jsx)(`textarea`,{ref:P,rows:2,value:i.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-foreground outline-none placeholder:text-muted-foreground`,onChange:t=>s(e,t.target.value),onCompositionStart:()=>{M.current=!0},onCompositionEnd:()=>{M.current=!1},onKeyDown:e=>{!M.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&k(e.nativeEvent,F.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,V.jsx)(D,{type:I?`button`:`submit`,size:`icon`,className:`size-9 shrink-0 rounded-full`,"aria-label":n(I?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:I?v:p||i.loading||i.expired||!i.draft.trim(),onClick:I?()=>void B():void 0,children:p||v?(0,V.jsx)(S,{className:`size-4 animate-spin`}):I?(0,V.jsx)(T,{size:13,fill:`currentColor`}):(0,V.jsx)(l,{size:17})})]})]})]})}function q({page:e,onChange:t}){let{t:n}=r(),{draft:i,url:a}=e,[o,s]=(0,L.useState)(!1);return(0,V.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,V.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=F(i,window.location.href);s(!n),n&&t({url:n})},children:[(0,V.jsx)(`input`,{"aria-label":n(`common:webPreview.url`),className:`min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[length:var(--app-font-size)]`,value:i,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,V.jsx)(D,{type:`submit`,variant:`outline`,size:`sm`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,V.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,V.jsx)(W,{className:`min-h-0 flex-1 overflow-hidden rounded-md`,defaultUrl:a,children:(0,V.jsx)(G,{src:a,title:n(`common:webPreview.title`)})},a):(0,V.jsxs)(`div`,{className:`grid min-h-0 flex-1 place-content-center justify-items-center gap-2 rounded-md border border-dashed border-[var(--stroke-soft)] text-center text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:[(0,V.jsx)(f,{size:24,"aria-hidden":`true`}),(0,V.jsx)(`p`,{children:n(`chat:sessionContext.browserEmpty`)})]}),a&&(0,V.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,V.jsx)(p,{size:14}),n(`common:webPreview.openExternal`)]}),(0,V.jsx)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:n(`common:webPreview.embedNotice`)})]})}function J({panelId:e,compact:t,embedded:n=!1,sessionId:i,tab:l,plan:u,streaming:d,plansAvailable:p,requestConfirm:m,onTabChange:h,onClose:g}){let{t:y}=r(),b=[{id:`files`,icon:I,label:y(`chat:focusSession.fileChanges`)},...p?[{id:`plan`,icon:_,label:y(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:f,label:y(`common:webPreview.title`)},{id:`side-chat`,icon:C,label:y(`chat:sideChat.title`)}],x=(0,L.useMemo)(()=>R(l),[l]),S=B(e=>Object.prototype.hasOwnProperty.call(e.sessions,i)?e.sessions[i]:void 0)??x,T=(0,L.useRef)(null),D=S.pages.find(e=>e.id===S.activeId)??S.pages[0],k=e=>b.find(t=>t.id===e.kind)??b[0],A=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),F=e=>{let t=z(S,e);B.getState().update(i,l,e);let n=t.pages.find(e=>e.id===t.activeId);n&&h(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&A(t.activeId),e.type===`close`&&S.pages.length===1&&g()},H=y(`chat:sessionContext.addPage`),U=y(`chat:sessionContext.pageLimit`),W=(0,V.jsxs)(c,{children:[(0,V.jsx)(a,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted disabled:opacity-40`,disabled:S.pages.length>=12,"aria-label":H,title:S.pages.length>=12?U:H,children:(0,V.jsx)(w,{size:15})})}),(0,V.jsx)(o,{align:`end`,className:`min-w-40`,children:b.map(({id:e,icon:t,label:n})=>(0,V.jsxs)(s,{onSelect:()=>F({type:`add`,kind:e}),children:[(0,V.jsx)(t,{size:14}),n]},e))})]}),G=(0,V.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground`,children:[(0,V.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-0.5 border-b border-border/60 px-1.5`,children:[(0,V.jsx)(`div`,{ref:T,className:`flex min-w-0 flex-1 items-center overflow-x-auto`,role:`tablist`,"aria-label":y(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),F({type:`close`,id:D.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=S.pages.findIndex(e=>e.id===D.id),n=e.key===`Home`?0:e.key===`End`?S.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+S.pages.length)%S.pages.length;F({type:`select`,id:S.pages[n].id})},children:S.pages.map(t=>{let{icon:n,label:r}=k(t);return(0,V.jsxs)(`div`,{className:`group flex max-w-40 min-w-20 shrink-0 items-center rounded-md ${t.id===D.id?`bg-muted`:`text-muted-foreground`}`,children:[(0,V.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===D.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===D.id?0:-1,className:`flex h-8 min-w-0 flex-1 items-center gap-1.5 px-2 text-xs`,onClick:()=>F({type:`select`,id:t.id}),children:[(0,V.jsx)(n,{size:13,className:`shrink-0`}),(0,V.jsx)(`span`,{className:`truncate`,children:r})]}),(0,V.jsx)(`button`,{type:`button`,className:`mr-0.5 grid size-5 shrink-0 place-items-center rounded hover:bg-foreground/10`,"aria-label":`${y(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>F({type:`close`,id:t.id}),children:(0,V.jsx)(E,{size:11})})]},t.id)})}),W]}),S.pages.map(t=>{let n=k(t),r=D.id===t.id;return(0,V.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`side-chat`?(0,V.jsx)(K,{parentId:i,active:r}):n.id===`browser`?(0,V.jsx)(q,{page:t,onChange:e=>F({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,V.jsx)(O,{sessionId:i,streaming:d,requestConfirm:m}):(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:u?.items?.length?(0,V.jsx)(v,{plan:u}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,V.jsx)(P,{open:!0,onOpenChange:e=>!e&&g(),children:(0,V.jsxs)(N,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,V.jsx)(M,{className:`sr-only`,children:(0,V.jsx)(j,{children:y(`chat:sessionContext.title`)})}),G]})}):(0,V.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-border/60`,"aria-label":y(`chat:sessionContext.title`),children:G})}export{J as SessionContextPanel};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-m5aLB7Li.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-a84Zp9dV.js","assets/i18n-8nTnthu6.js","assets/vendor-router-CZg2bCPV.js","assets/index-AF29hfx9.js","assets/index-BAmsg90v.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/button-CQA36izu.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-a84Zp9dV.js";import{t as a}from"./check-2vYc6QaP.js";import{t as o}from"./file-diff-GxOMJkLj.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./undo-2-CJE_nRTk.js";import{t as l}from"./button-CQA36izu.js";import{t as u}from"./chat-api-CqF-FICX.js";import{n as d}from"./session-change-summary-api--7cl4LDn.js";var f=e(n(),1),p=r(),m=(0,f.lazy)(()=>t(()=>import(`./GitDiffViewer-m5aLB7Li.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))),h=100;function g(e){return e instanceof Error?e.message:String(e)}function _({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[_,v]=(0,f.useState)(0),[y,b]=(0,f.useState)(null),[x,S]=(0,f.useState)(!0),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(``),[D,O]=(0,f.useState)(``),[k,A]=(0,f.useState)(null),[j,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),F=(0,f.useRef)(!1),I=(0,f.useRef)(0),L=(0,f.useRef)(0),R=(0,f.useRef)(!0),z=(0,f.useRef)(!1),B=(0,f.useRef)(t);(0,f.useLayoutEffect)(()=>{B.current=t},[t]),(0,f.useLayoutEffect)(()=>(F.current=!0,()=>{F.current=!1,I.current+=1,L.current+=1}),[]),(0,f.useEffect)(()=>{let t=++I.current;return L.current+=1,M(null),P(null),R.current=!0,S(!0),w(``),u.getSessionFileChanges(e).then(e=>{F.current&&t===I.current&&b(e)},e=>{F.current&&t===I.current&&w(g(e))}).finally(()=>{F.current&&t===I.current&&(R.current=!1,S(!1))}),()=>{I.current+=1}},[_,e,t]);let V=async t=>{if(z.current||R.current)return;let n=++L.current;P(t),E(``);try{let i=await u.getSessionFileChangeDiff(e,t);if(!F.current||n!==L.current)return;if(!i.diff?.trim()){E(r(`chat:focusSession.fileChangesNoSnapshot`));return}M({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){F.current&&n===L.current&&E(g(e))}finally{F.current&&n===L.current&&P(null)}},H=async t=>{if(!F.current||z.current||R.current||B.current||!y||C||!y.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;z.current=!0,A(t),E(``),O(``);let i=++I.current;L.current+=1,M(null),P(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`})||!F.current||B.current||R.current||i!==I.current)return;a=!0;let o=t.kind===`approve`?await u.approveSessionFileChanges(e,t.path):await u.revertSessionFileChanges(e,t.path);if(d(e),!F.current||i!==I.current)return;b(o),t.kind===`approve`?O(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?O(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):O(r(`chat:focusSession.fileChangesRevertDone`)):O(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){F.current&&i===I.current&&E(g(e))}finally{z.current=!1,F.current&&(A(null),a&&(R.current=!0,S(!0),v(e=>e+1)))}},U=x||t||!!k||!!C||!y,W=y?.summary.pending||0,G=y?.files.filter(e=>e.canRevert&&!e.reverted).length||0,K=T||C;return(0,p.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,"aria-label":r(`chat:focusSession.fileChanges`),"aria-busy":x||!!k,children:[(0,p.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] font-medium`,children:r(`chat:focusSession.fileChanges`)}),y&&(0,p.jsxs)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:[r(`chat:focusSession.fileChangesCount`,{count:y.summary.files}),` · `,`+`,y.summary.added,` −`,y.summary.removed,W>0&&` · ${r(`chat:focusSession.fileChangesPending`,{count:W})}`]})]}),(0,p.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1.5`,children:[(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||W===0,title:t?r(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void H({kind:`approve`}),children:[k?.kind===`approve`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(a,{size:14}),r(`chat:focusSession.fileChangesApproveAll`)]}),(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||G===0,title:r(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void H({kind:`revert`}),children:[k?.kind===`revert`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(c,{size:14}),r(`chat:focusSession.fileChangesRevertAll`)]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,"aria-label":r(`chat:focusSession.gitRefresh`),title:r(`chat:focusSession.gitRefresh`),disabled:x||!!k,onClick:()=>{R.current=!0,S(!0),E(``),v(e=>e+1)},children:(0,p.jsx)(s,{className:x?`animate-spin`:``,size:16})})]})]}),K&&(0,p.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:K}),D&&!K&&(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:D}),x&&!y?(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitLoading`)}):y?.files.length?(0,p.jsxs)(`ul`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,"aria-label":r(`chat:focusSession.fileChanges`),children:[y.files.slice(0,h).map(e=>(0,p.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-[var(--surface-subtle)] px-2 py-1`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md text-left text-[length:var(--app-small-size)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-blue)] disabled:opacity-60`,title:e.path,disabled:x||!!k,"aria-busy":N===e.path,onClick:()=>void V(e.path),children:[N===e.path?(0,p.jsx)(s,{size:14,className:`flex-none animate-spin`}):(0,p.jsx)(o,{size:14,className:`flex-none text-[var(--star-strong)]`}),(0,p.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,p.jsx)(`span`,{className:`block truncate`,children:e.path}),(0,p.jsxs)(`span`,{className:`block text-[var(--text-muted)]`,children:[`+`,e.added,` −`,e.removed,e.reverted?` · ${r(`chat:focusSession.fileChangesReverted`)}`:e.approved?` · ${r(`chat:focusSession.fileChangesApproved`)}`:``]})]})]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${r(`chat:focusSession.fileChangesApproveFile`)} ${e.path}`,disabled:U||!e.pending||e.approved||e.reverted,onClick:()=>void H({kind:`approve`,path:e.path}),children:(0,p.jsx)(a,{size:14})}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${r(`chat:focusSession.fileChangesRevertFile`)} ${e.path}`,disabled:U||e.reverted||!e.canRevert,onClick:()=>void H({kind:`revert`,path:e.path}),children:(0,p.jsx)(c,{size:14})})]},e.path)),y.files.length>h&&(0,p.jsx)(`li`,{className:`px-2 py-1 text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitMoreFiles`,{count:y.files.length-h})})]}):!K&&(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.fileChangesEmpty`)}),j&&(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(m,{diff:j.diff,truncated:j.truncated,onClose:()=>M(null)})})]})}export{_ as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-91SrTCWo.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-C7st2Mx5.js","assets/i18n-DKgrgj0w.js","assets/vendor-router-CZg2bCPV.js","assets/index-Dm1UDg72.js","assets/index-DJAtBVyc.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/button-CQA36izu.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-C7st2Mx5.js";import{t as a}from"./check-2vYc6QaP.js";import{t as o}from"./file-diff-GxOMJkLj.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./undo-2-CJE_nRTk.js";import{t as l}from"./button-CQA36izu.js";import{t as u}from"./chat-api-cEcUMaNX.js";import{n as d}from"./session-change-summary-api-BQILNzT4.js";var f=e(n(),1),p=r(),m=(0,f.lazy)(()=>t(()=>import(`./GitDiffViewer-91SrTCWo.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))),h=100;function g(e){return e instanceof Error?e.message:String(e)}function _({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[_,v]=(0,f.useState)(0),[y,b]=(0,f.useState)(null),[x,S]=(0,f.useState)(!0),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(``),[D,O]=(0,f.useState)(``),[k,A]=(0,f.useState)(null),[j,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),F=(0,f.useRef)(!1),I=(0,f.useRef)(0),L=(0,f.useRef)(0),R=(0,f.useRef)(!0),z=(0,f.useRef)(!1),B=(0,f.useRef)(t);(0,f.useLayoutEffect)(()=>{B.current=t},[t]),(0,f.useLayoutEffect)(()=>(F.current=!0,()=>{F.current=!1,I.current+=1,L.current+=1}),[]),(0,f.useEffect)(()=>{let t=++I.current;return L.current+=1,M(null),P(null),R.current=!0,S(!0),w(``),u.getSessionFileChanges(e).then(e=>{F.current&&t===I.current&&b(e)},e=>{F.current&&t===I.current&&w(g(e))}).finally(()=>{F.current&&t===I.current&&(R.current=!1,S(!1))}),()=>{I.current+=1}},[_,e,t]);let V=async t=>{if(z.current||R.current)return;let n=++L.current;P(t),E(``);try{let i=await u.getSessionFileChangeDiff(e,t);if(!F.current||n!==L.current)return;if(!i.diff?.trim()){E(r(`chat:focusSession.fileChangesNoSnapshot`));return}M({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){F.current&&n===L.current&&E(g(e))}finally{F.current&&n===L.current&&P(null)}},H=async t=>{if(!F.current||z.current||R.current||B.current||!y||C||!y.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;z.current=!0,A(t),E(``),O(``);let i=++I.current;L.current+=1,M(null),P(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`})||!F.current||B.current||R.current||i!==I.current)return;a=!0;let o=t.kind===`approve`?await u.approveSessionFileChanges(e,t.path):await u.revertSessionFileChanges(e,t.path);if(d(e),!F.current||i!==I.current)return;b(o),t.kind===`approve`?O(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?O(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):O(r(`chat:focusSession.fileChangesRevertDone`)):O(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){F.current&&i===I.current&&E(g(e))}finally{z.current=!1,F.current&&(A(null),a&&(R.current=!0,S(!0),v(e=>e+1)))}},U=x||t||!!k||!!C||!y,W=y?.summary.pending||0,G=y?.files.filter(e=>e.canRevert&&!e.reverted).length||0,K=T||C;return(0,p.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,"aria-label":r(`chat:focusSession.fileChanges`),"aria-busy":x||!!k,children:[(0,p.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] font-medium`,children:r(`chat:focusSession.fileChanges`)}),y&&(0,p.jsxs)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:[r(`chat:focusSession.fileChangesCount`,{count:y.summary.files}),` · `,`+`,y.summary.added,` −`,y.summary.removed,W>0&&` · ${r(`chat:focusSession.fileChangesPending`,{count:W})}`]})]}),(0,p.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1.5`,children:[(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||W===0,title:t?r(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void H({kind:`approve`}),children:[k?.kind===`approve`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(a,{size:14}),r(`chat:focusSession.fileChangesApproveAll`)]}),(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||G===0,title:r(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void H({kind:`revert`}),children:[k?.kind===`revert`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(c,{size:14}),r(`chat:focusSession.fileChangesRevertAll`)]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,"aria-label":r(`chat:focusSession.gitRefresh`),title:r(`chat:focusSession.gitRefresh`),disabled:x||!!k,onClick:()=>{R.current=!0,S(!0),E(``),v(e=>e+1)},children:(0,p.jsx)(s,{className:x?`animate-spin`:``,size:16})})]})]}),K&&(0,p.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:K}),D&&!K&&(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:D}),x&&!y?(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitLoading`)}):y?.files.length?(0,p.jsxs)(`ul`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,"aria-label":r(`chat:focusSession.fileChanges`),children:[y.files.slice(0,h).map(e=>(0,p.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-[var(--surface-subtle)] px-2 py-1`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md text-left text-[length:var(--app-small-size)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-blue)] disabled:opacity-60`,title:e.path,disabled:x||!!k,"aria-busy":N===e.path,onClick:()=>void V(e.path),children:[N===e.path?(0,p.jsx)(s,{size:14,className:`flex-none animate-spin`}):(0,p.jsx)(o,{size:14,className:`flex-none text-[var(--star-strong)]`}),(0,p.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,p.jsx)(`span`,{className:`block truncate`,children:e.path}),(0,p.jsxs)(`span`,{className:`block text-[var(--text-muted)]`,children:[`+`,e.added,` −`,e.removed,e.reverted?` · ${r(`chat:focusSession.fileChangesReverted`)}`:e.approved?` · ${r(`chat:focusSession.fileChangesApproved`)}`:``]})]})]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${r(`chat:focusSession.fileChangesApproveFile`)} ${e.path}`,disabled:U||!e.pending||e.approved||e.reverted,onClick:()=>void H({kind:`approve`,path:e.path}),children:(0,p.jsx)(a,{size:14})}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${r(`chat:focusSession.fileChangesRevertFile`)} ${e.path}`,disabled:U||e.reverted||!e.canRevert,onClick:()=>void H({kind:`revert`,path:e.path}),children:(0,p.jsx)(c,{size:14})})]},e.path)),y.files.length>h&&(0,p.jsx)(`li`,{className:`px-2 py-1 text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitMoreFiles`,{count:y.files.length-h})})]}):!K&&(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.fileChangesEmpty`)}),j&&(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(m,{diff:j.diff,truncated:j.truncated,onClose:()=>M(null)})})]})}export{_ as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{a as n,n as r,r as i,t as a}from"./dropdown-menu-pKRdLJUe.js";import{t as o}from"./ellipsis-CfGKfbq6.js";import{t as s}from"./button-CQA36izu.js";var c=e();function l({items:e,buttonClassName:l,compact:u=!1,onNavigate:d}){let{t:f}=t();return(0,c.jsxs)(a,{children:[(0,c.jsx)(n,{asChild:!0,children:(0,c.jsxs)(s,{variant:`ghost`,className:l,title:u?f(`navigation:workbench.moreTools`):void 0,children:[(0,c.jsx)(o,{size:16}),(0,c.jsx)(`span`,{className:u?`sr-only`:void 0,children:f(`navigation:workbench.moreTools`)})]})}),(0,c.jsx)(r,{side:`right`,align:`start`,className:`w-48`,children:e.map(([e,t,n])=>(0,c.jsxs)(i,{onSelect:()=>d(e),children:[(0,c.jsx)(n,{size:16}),t]},e))})]})}export{l as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-C7st2Mx5.js";import{a as n,n as r,r as i,t as a}from"./dropdown-menu-DmL4pJTo.js";import{t as o}from"./ellipsis-CfGKfbq6.js";import{t as s}from"./button-CQA36izu.js";var c=e();function l({items:e,buttonClassName:l,compact:u=!1,onNavigate:d}){let{t:f}=t();return(0,c.jsxs)(a,{children:[(0,c.jsx)(n,{asChild:!0,children:(0,c.jsxs)(s,{variant:`ghost`,className:l,title:u?f(`navigation:workbench.moreTools`):void 0,children:[(0,c.jsx)(o,{size:16}),(0,c.jsx)(`span`,{className:u?`sr-only`:void 0,children:f(`navigation:workbench.moreTools`)})]})}),(0,c.jsx)(r,{side:`right`,align:`start`,className:`w-48`,children:e.map(([e,t,n])=>(0,c.jsxs)(i,{onSelect:()=>d(e),children:[(0,c.jsx)(n,{size:16}),t]},e))})]})}export{l as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePicker-CDJPgjpW.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-C7st2Mx5.js","assets/i18n-DKgrgj0w.js","assets/vendor-router-CZg2bCPV.js","assets/index-Dm1UDg72.js","assets/index-DJAtBVyc.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/check-2vYc6QaP.js","assets/loader-circle-BOwQzHB-.js","assets/triangle-alert-CE1q54ci.js","assets/button-CQA36izu.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js","assets/alert-QoPGoIY6.js","assets/dialog-D-ER2p-D.js","assets/dist-BdkTa5R3.js","assets/dist-B_a0oV4U.js","assets/es2015-0QT3KgdC.js","assets/x-07u4-129.js","assets/input-CvjGYteF.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{t as n}from"./index-Dm1UDg72.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-C7st2Mx5.js";import{a as o,i as s,o as c}from"./vendor-state-GkUciC5H.js";import{t as l}from"./storage-BpAqa-YY.js";import{c as u,i as d,o as f,s as p}from"./dist-B_a0oV4U.js";import{a as m,c as ee,i as te,l as ne,n as re,r as h,s as g,t as ie,u as _}from"./dist-swnK7PHk.js";import{t as v}from"./utils-C8uzG5AZ.js";import{t as y}from"./createLucideIcon-Cd-3GVxJ.js";import{n as ae,t as oe}from"./pin-off-DRR1KEvN.js";import{a as se,c as ce,d as le,l as ue,u as de}from"./session-list-JA31_Ff4.js";import{t as fe}from"./chevron-right-C3t2Rckj.js";import{t as pe}from"./circle-alert-DCChabnT.js";import{t as me}from"./loader-circle-BOwQzHB-.js";import{t as he}from"./message-square-SKjZyY3v.js";import{a as ge}from"./sidebar-C3YJQV72.js";import{t as _e}from"./pencil-U08v_vV9.js";import{t as ve}from"./plus-fQbSqB1n.js";import{t as ye}from"./rotate-ccw-C0v8V77_.js";import{t as be}from"./search-D0mqDaf_.js";import{t as b}from"./trash-2-CNrPOoPR.js";import{t as xe}from"./api-DmuPqjXK.js";import{t as x}from"./button-CQA36izu.js";import{t as Se}from"./useQuery-D3P5wO_Z.js";import{a as Ce,t as S}from"./startup-queries-Ci3kCPI9.js";import{n as we}from"./QueryClientProvider-CHJtxoX1.js";import{i as Te,r as Ee}from"./format-BRFKAYMT.js";import{_ as De,a as Oe,m as ke,o as Ae,p as je,s as Me,t as Ne}from"./events-DjkpUZEu.js";import{n as Pe,t as Fe}from"./pick-system-directory-BnIFt85A.js";var C=e(r(),1),w=i(),T=Object.defineProperty,E=(e,t)=>T(e,`name`,{value:t,configurable:!0}),D=`ContextMenu`,[Ie,Le]=p(D,[_]),O=_(),[k,A]=Ie(D),j=E(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=C.useRef(!1),[c,l]=d({prop:i,defaultProp:!1,onChange:r,caller:D}),u=O(t);return(0,w.jsx)(k,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,w.jsx)(m,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),M=`ContextMenuTrigger`,N=C.forwardRef(E(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=A(M,n),o=O(n),[s,c]=C.useState({x:0,y:0}),l=C.useMemo(()=>({current:{getBoundingClientRect:E(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),d=C.useRef(0),p=C.useCallback(()=>window.clearTimeout(d.current),[]),m=E(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return C.useEffect(()=>p,[p]),C.useEffect(()=>void(r&&p()),[r,p]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(ie,{...o,virtualRef:l}),(0,w.jsx)(u.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:f(e.onContextMenu,e=>{p(),m(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:f(e.onPointerDown,B(e=>{p(),a.open&&a.onOpenChange(!1),d.current=window.setTimeout(()=>m(e),700)})),onPointerMove:r?e.onPointerMove:f(e.onPointerMove,B(p)),onPointerCancel:r?e.onPointerCancel:f(e.onPointerCancel,B(p)),onPointerUp:r?e.onPointerUp:f(e.onPointerUp,B(p))})]})},`ContextMenuTrigger`)),P=E(e=>{let{__scopeContextMenu:t,...n}=e,r=O(t);return(0,w.jsx)(te,{...r,...n})},`ContextMenuPortal`),F=`ContextMenuContent`,I=C.forwardRef(E(function(e,t){let{__scopeContextMenu:n,...r}=e,i=A(F,n),a=O(n),o=C.useRef(!1);return(0,w.jsx)(re,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),L=C.forwardRef(E(function(e,t){let{__scopeContextMenu:n,...r}=e,i=O(n);return(0,w.jsx)(h,{...i,...r,ref:t})},`ContextMenuItem`)),R=`ContextMenuSub`,z=E(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=O(t),[s,c]=d({prop:i,defaultProp:a??!1,onChange:r,caller:R});return(0,w.jsx)(g,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),Re=C.forwardRef(E(function(e,t){let{__scopeContextMenu:n,...r}=e,i=O(n);return(0,w.jsx)(ne,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),ze=C.forwardRef(E(function(e,t){let{__scopeContextMenu:n,...r}=e,i=O(n);return(0,w.jsx)(ee,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function B(e){return t=>t.pointerType===`mouse`?void 0:e(t)}E(B,`whenTouchOrPen`);var V=j,H=N,Be=P,U=I,Ve=L,He=z,Ue=Re,We=ze,Ge=y(`folder-closed`,[[`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`}],[`path`,{d:`M2 10h20`,key:`1ir3d8`}]]),Ke=y(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`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`}]]);function W(e=``){let t=e.trim().replace(/\\/g,`/`),n=/^\/+$/u.test(t)?`/`:t.replace(/\/+$/,``);return/^[A-Za-z]:(?:\/|$)/.test(n)?n.toLowerCase():n}function G(e){return W(e.cwd)||`\0`}function qe(e){let t=new Map;for(let n of e){let e=G(n),r=t.get(e)||{key:e,cwd:n.cwd||``,sessions:[]};r.sessions.push(n),t.set(e,r)}return[...t.values()]}function Je(e,t,n=``){let r=new Set(e.slice(0,t).map(e=>e.id));return qe(e).map(e=>({...e,sessions:e.sessions.filter((e,t)=>t===0||r.has(e.id)||e.id===n)}))}function K(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(W))].filter(e=>e===`\0`||e.length>0&&!e.includes(`\0`)):[]}function q(e,t){return K([...e,...t])}function Ye(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,r)=>(n.get(e.key)??t.length)-(n.get(r.key)??t.length))}function Xe(e,t){return e.filter(e=>G(e)===t)}function Ze(e,t,n,r){return!e||!n.has(e)&&(!r||t.some(t=>t.id===e))?null:t[0]?.id||``}async function Qe(e,t){let n=[];for(let r of e)try{await t(r),n.push(r)}catch(e){return{deletedIds:n,failedId:r,error:e}}return{deletedIds:n,failedId:null,error:null}}function J(e){let t=W(e);return t&&t!==`\0`&&!t.includes(`\0`)?t:null}function Y(e){let t=Object.create(null);if(!e||typeof e!=`object`||Array.isArray(e))return t;for(let[n,r]of Object.entries(e)){let e=J(n);if(!e||typeof r!=`string`)continue;let i=r.trim();i&&Array.from(i).length<=120&&(t[e]=i)}return t}var X=s(()=>n),Z=c()(o((e,t)=>({order:[],names:Y(void 0),rememberWorkspaces:n=>{let r=t().order,i=q(r,n);i.length===r.length&&i.every((e,t)=>e===r[t])||e({order:i})},setWorkspaceName:(n,r)=>{let i=typeof n==`string`?J(n):null;if(!i||typeof r!=`string`)throw TypeError(`Invalid workspace name`);let a=r.trim();if(Array.from(a).length>120)throw RangeError(`Workspace name is too long`);let o=t().names;if((o[i]||``)===a)return;if(!X)throw Error(`Workspace preferences storage is unavailable`);let s=Y(o);a?s[i]=a:delete s[i];try{e({names:s})}catch(t){try{e({names:o})}catch{}throw t}}}),{name:`pisper-workspace-order`,storage:X,version:1,partialize:({order:e,names:t})=>({order:e,names:t}),merge:(e,t)=>({...t,order:K(e&&typeof e==`object`&&`order`in e?e.order:void 0),names:Y(e&&typeof e==`object`&&`names`in e?e.names:void 0)})}));function $e({...e}){return(0,w.jsx)(V,{"data-slot":`context-menu`,...e})}function et({className:e,...t}){return(0,w.jsx)(H,{"data-slot":`context-menu-trigger`,className:v(`select-none`,e),...t})}function tt({...e}){return(0,w.jsx)(He,{"data-slot":`context-menu-sub`,...e})}function nt({className:e,...t}){return(0,w.jsx)(Be,{children:(0,w.jsx)(U,{"data-slot":`context-menu-content`,className:v(`z-[200] max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function Q({className:e,inset:t,variant:n=`default`,...r}){return(0,w.jsx)(Ve,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:v(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function rt({className:e,inset:t,children:n,...r}){return(0,w.jsxs)(Ue,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:v(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,w.jsx)(fe,{className:`ml-auto`})]})}function it({className:e,...t}){return(0,w.jsx)(We,{"data-slot":`context-menu-sub-content`,className:v(`z-[200] min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}var at=(0,C.lazy)(()=>t(()=>import(`./WorkspacePicker-CDJPgjpW.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,24]))),ot=24;function st({label:e,onClick:t,children:n}){return(0,w.jsx)(x,{type:`button`,variant:`ghost`,className:`opacity-0 group-hover/workspace:opacity-100 group-focus-within/workspace:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100 !size-7 !min-h-7 !shrink-0 !p-0 !text-[var(--text-muted)] hover:!bg-[var(--surface-hover)] hover:!text-[var(--text)] max-[650px]:!size-11 max-[650px]:!min-h-11`,title:e,"aria-label":e,onClick:t,children:n})}function $({navigate:e,requestText:t,requestConfirm:r,notify:i}){let{t:o,language:s}=a(),c=we(),{isMobile:u,setOpenMobile:d}=ge(),[f,p]=(0,C.useState)(!0),[m,ee]=(0,C.useState)(``),[te,ne]=(0,C.useState)(!1),[re,h]=(0,C.useState)(()=>new Set),g=Z(e=>e.order),ie=Z(e=>e.rememberWorkspaces),_=Z(e=>e.names),v=Z(e=>e.setWorkspaceName),[y,T]=(0,C.useState)(()=>n.getItem(l.activeSession)||``),[E,D]=(0,C.useState)(``),[Ie,Le]=(0,C.useState)(``),[O,k]=(0,C.useState)(!1),[A,j]=(0,C.useState)(!1),M=(0,C.useRef)(!1),N=(0,C.useRef)(0),[P,F]=(0,C.useState)(``);(0,C.useEffect)(()=>()=>{N.current+=1},[]);let{data:I}=Se({...Ce(`sessions`),refetchInterval:2e3});(0,C.useEffect)(()=>De(window,({deletedIds:e})=>{let t=new Set(e);c.setQueryData([`sessions`],e=>e&&{...e,sessions:e.sessions.filter(e=>!t.has(e.id))})}),[c]);let L=(0,C.useMemo)(()=>se(I?.sessions||[]),[I]),R=(0,C.useMemo)(()=>{let e=m.trim().toLocaleLowerCase(s);return e?L.filter(t=>`${t.name||``} ${t.cwd||``} ${_[G(t)]||``}`.toLocaleLowerCase(s).includes(e)):L.filter(e=>!e.archived)},[s,m,L,_]),z=(0,C.useMemo)(()=>qe(L),[L]);(0,C.useEffect)(()=>{ie(z.map(e=>e.key))},[z,ie]);let Re=(0,C.useMemo)(()=>Ye(Je(R,ot,y),g),[R,g,y]),ze=(0,C.useMemo)(()=>new Map(z.map(e=>[e.key,e.sessions.length])),[z]),B=z.find(e=>e.key===E)||null,V=L.find(e=>e.id===Ie)||null,H=e=>e.cwd?_[e.key]||Te(e.cwd,s):o(`navigation:appSidebar.noWorkspace`);(0,C.useEffect)(()=>{let e=()=>{S(`sessions`,!0).catch(()=>{})},t=()=>{document.visibilityState===`visible`&&e()},r=e=>{let t=e.detail;T(t?.id||n.getItem(l.activeSession)||``)};return document.addEventListener(`visibilitychange`,t),window.addEventListener(Oe,r),window.addEventListener(Ne,r),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(Oe,r),window.removeEventListener(Ne,r)}},[]);let Be=t=>{T(t),ke(t),e(`chat`),u&&d(!1)},U=t=>{je(t)&&(ee(``),p(!0),h(e=>{let n=new Set(e);return n.delete(G({id:``,cwd:t})),n}),e(`chat`),u&&d(!1))},Ve=async()=>{if(M.current)return;if(!Fe()){k(!0);return}M.current=!0,j(!0);let e=++N.current;try{let t=await Pe();e===N.current&&t&&U(t)}catch(t){e===N.current&&i(t instanceof Error?t.message:String(t),`error`)}finally{e===N.current&&(M.current=!1,j(!1))}},He=async(e,t=L)=>{let r=await Qe(e.map(e=>e.id),e=>xe(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`}));Me(r.deletedIds.length?{deletedIds:r.deletedIds}:void 0);let i=null;try{i=(await S(`sessions`,!0)).sessions}catch{}let a=new Set(r.deletedIds),o=i??t.filter(e=>!a.has(e.id)),s=Ze(n.getItem(l.activeSession)||y,o,a,i!==null);return s!==null&&(T(s),s?ke(s):(n.removeItem(l.activeSession),Ae(``))),{...r,sessions:o,verified:i!==null}},Ue=async e=>{if(P)return;let t=e.cwd?`${H(e)} · ${e.cwd}`:H(e);F(e.key);try{let n=(await S(`sessions`,!0)).sessions,a=Xe(n,e.key);if(!a.length){i(o(`navigation:appSidebar.projectNoChats`,{project:t}),`info`);return}if(!await r({title:o(`navigation:appSidebar.deleteProject`),message:o(`navigation:appSidebar.deleteProjectConfirm`,{project:t,count:a.length}),confirmLabel:o(`navigation:appSidebar.deleteProjectAction`)}))return;let s=await He(a,n);if(!s.verified){i(o(`navigation:appSidebar.projectDeleteUnverified`,{project:t,deleted:s.deletedIds.length}),`error`);return}let c=Xe(s.sessions,e.key).length;if(s.failedId!==null||c){i(o(`navigation:appSidebar.projectDeletePartial`,{project:t,deleted:s.deletedIds.length,remaining:c}),`error`);return}i(o(`navigation:appSidebar.projectDeleted`,{project:t}))}catch(e){i(e instanceof ce?o(`chat:chatHistoryPage.sessionUpdateFailed`):e instanceof Error?e.message:String(e),`error`)}finally{F(``)}},We=async e=>{if(P)return;let t=e.name||o(`navigation:appSidebar.untitledChat`);if(await r({title:o(`chat:chatHistoryPage.deleteChat`),message:o(`chat:chatHistoryPage.deleteChatNameThisAlsoRemovesLocalChatHistory`,{name:t}),confirmLabel:o(`chat:chatHistoryPage.delete`)})){F(e.id);try{let t=await He([e]);if(t.failedId!==null)throw t.error??Error(o(`navigation:appSidebar.chatDeleteFailed`));i(o(`chat:chatHistoryPage.chatDeleted`))}catch(e){i(e instanceof Error?e.message:String(e),`error`)}finally{F(``)}}},W=async e=>{let n=await t({title:o(`chat:chatHistoryPage.renameChat`),inputLabel:o(`chat:chatHistoryPage.chatTitle`),value:e.name,confirmLabel:o(`chat:chatHistoryPage.save`)});if(n!==null&&n!==e.name)try{let t=await xe(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify({name:n})});Me({id:e.id,name:t.name}),S(`sessions`,!0).catch(()=>{}),i(o(`chat:chatHistoryPage.chatTitleUpdated`))}catch(e){i(e instanceof Error?e.message:String(e),`error`)}},K=(e,t)=>{try{v(e.cwd,t),i(o(`navigation:appSidebar.projectNameUpdated`))}catch{i(o(`navigation:appSidebar.projectNameSaveFailed`),`error`)}},q=async e=>{if(!e.cwd)return;let n=H(e),r=await t({title:o(`navigation:appSidebar.renameProject`),message:o(`navigation:appSidebar.renameProjectDescription`),inputLabel:o(`navigation:appSidebar.projectName`),value:n,maxLength:120,confirmLabel:o(`chat:chatHistoryPage.save`)});r===null||!r.trim()||r.trim()===n||K(e,r.trim())},J=async(e,t,n)=>{if(!P)try{let r=await ue(e.id,t);c.setQueryData([`sessions`],e=>e&&{...e,sessions:e.sessions.map(e=>e.id===r.id?{...e,...r}:e)}),i(n)}catch(e){i(e instanceof Error?e.message:String(e),`error`)}},Y=e=>{h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},X=(e=``,t=``)=>{D(e),Le(t)},$=(e,t=``,n=``)=>{e.pointerType!==`mouse`&&X(t,n)},ct=t=>{e(t),u&&d(!1)};return(0,w.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col px-2 pt-3`,"aria-label":o(`navigation:appSidebar.recentChats`),children:[(0,w.jsxs)(`div`,{className:`mb-1 flex h-8 shrink-0 items-center gap-1 px-1.5`,children:[(0,w.jsxs)(`button`,{className:`mr-auto flex min-w-0 items-center gap-1 rounded-md px-1 py-1 text-xs text-muted-foreground hover:text-foreground`,"aria-controls":`sidebar-recent-sessions`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[(0,w.jsx)(`span`,{children:o(`navigation:workbench.projects`)}),(0,w.jsx)(fe,{className:f?`rotate-90`:``,size:12})]}),(0,w.jsx)(x,{variant:`ghost`,size:`icon-sm`,className:`size-6 text-muted-foreground`,title:o(`navigation:workbench.filterSessions`),"aria-label":o(`navigation:workbench.filterSessions`),"aria-expanded":te,onClick:()=>ne(e=>!e),children:(0,w.jsx)(be,{size:13})}),(0,w.jsx)(x,{variant:`ghost`,size:`icon-sm`,className:`size-6 text-muted-foreground`,title:o(`navigation:appSidebar.newProject`),"aria-label":o(`navigation:appSidebar.newProject`),"aria-haspopup":`dialog`,"aria-expanded":O,disabled:A,onClick:()=>void Ve(),children:(0,w.jsx)(Ke,{size:14})}),(0,w.jsx)(`button`,{className:`rounded-md px-1 py-1 text-[11px] text-muted-foreground hover:text-foreground`,"aria-label":o(`navigation:appSidebar.viewAllCountChats`,{count:L.length}),onClick:()=>ct(`chatHistory`),children:o(`navigation:appSidebar.viewAll`)})]}),(te||m)&&(0,w.jsxs)(`label`,{className:`mx-2 mb-2 flex h-8 shrink-0 items-center gap-2 rounded-lg border border-border px-2 text-muted-foreground focus-within:ring-1 focus-within:ring-ring`,children:[(0,w.jsx)(be,{size:13,"aria-hidden":`true`}),(0,w.jsx)(`input`,{className:`min-w-0 flex-1 border-0 bg-transparent text-xs outline-none`,value:m,onChange:e=>ee(e.target.value),placeholder:o(`navigation:appSidebar.searchChats`),"aria-label":o(`navigation:appSidebar.searchChats`)})]}),f&&(0,w.jsxs)($e,{onOpenChange:e=>{e||(D(``),Le(``))},children:[(0,w.jsx)(et,{asChild:!0,children:(0,w.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-[2px] [padding-bottom:2px] overflow-y-auto [animation:page-in_var(--d1)_var(--ease-out)]`,id:`sidebar-recent-sessions`,onPointerDownCapture:e=>$(e),onContextMenuCapture:()=>X(),children:[Re.map(e=>{let t=re.has(e.key),n=H(e);return(0,w.jsxs)(`div`,{className:`nav-workspace-group [.nav-workspace-group_+_&]:mt-[3px]`,children:[(0,w.jsxs)(`div`,{className:`group/workspace flex min-w-0 items-center gap-[2px]`,onContextMenu:()=>D(e.key),onPointerDown:t=>$(t,e.key),children:[(0,w.jsxs)(`button`,{className:`flex h-8 min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 text-left text-sm text-foreground hover:bg-sidebar-accent [&_span]:min-w-0 [&_span]:flex-1 [&_span]:truncate [&_small]:hidden [&_.is-open]:rotate-90`,"aria-expanded":!t,onClick:()=>Y(e.key),title:e.cwd||n,children:[(0,w.jsx)(fe,{className:t?``:`is-open`,size:13}),(0,w.jsx)(Ge,{size:13}),(0,w.jsx)(`span`,{children:n}),(0,w.jsx)(`small`,{children:ze.get(e.key)||e.sessions.length})]}),e.cwd&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(st,{label:o(`navigation:appSidebar.renameProjectNamed`,{project:n}),onClick:()=>void q(e),children:(0,w.jsx)(_e,{size:14,"aria-hidden":`true`})}),(0,w.jsx)(st,{label:o(`navigation:appSidebar.newChatInWorkspace`,{workspace:e.cwd}),onClick:()=>U(e.cwd),children:(0,w.jsx)(ve,{size:14})})]})]}),!t&&e.sessions.map(e=>(0,w.jsxs)(`button`,{className:`flex h-8 w-full items-center gap-1 rounded-lg pl-8 pr-2.5 text-left text-sm font-normal text-muted-foreground hover:bg-sidebar-accent hover:text-foreground ${e.id===y?`active-session bg-sidebar-accent text-foreground`:``}`,"aria-current":e.id===y?`page`:void 0,title:`${e.name||o(`navigation:appSidebar.untitledChat`)} · ${Ee(e.modified,s)}`,onClick:()=>Be(e.id),onContextMenu:()=>Le(e.id),onPointerDown:t=>$(t,``,e.id),children:[e.streaming&&(0,w.jsx)(me,{className:`mr-1 size-3.5 shrink-0 animate-spin text-foreground`,"aria-label":o(`navigation:appSidebar.running`)}),e.pinned&&(0,w.jsx)(de,{className:`mr-1 size-3 shrink-0`,"aria-label":o(`navigation:appSidebar.pinned`)}),e.needsAttention&&(0,w.jsx)(pe,{className:`mr-1 size-3 shrink-0`,"aria-label":o(`navigation:appSidebar.needsAttention`)}),e.unread&&(0,w.jsx)(`span`,{className:`mr-1 size-1.5 shrink-0 rounded-full bg-[var(--brand-blue)]`,"aria-label":o(`navigation:appSidebar.unread`)}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 select-none truncate`,children:e.name||o(`navigation:appSidebar.untitledChat`)}),(0,w.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/70`,dateTime:e.modified,children:Ee(e.modified,s)}),e.archived&&(0,w.jsx)(`span`,{className:`ml-auto text-[11px] font-normal text-muted-foreground`,children:o(`navigation:appSidebar.archived`)})]},e.id))]},e.key)}),!R.length&&(0,w.jsx)(`span`,{className:`[padding:8px] text-[var(--text-muted)] text-xs font-normal`,children:m.trim()?o(`navigation:appSidebar.noMatchingChats`):L.length?o(`navigation:appSidebar.noActiveChats`):o(`navigation:appSidebar.noChatHistoryYet`)})]})}),(0,w.jsx)(nt,{className:`w-[220px]`,children:V?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Q,{onSelect:()=>Be(V.id),children:[(0,w.jsx)(he,{size:13}),o(`navigation:appSidebar.openSession`)]}),(0,w.jsxs)(Q,{onSelect:()=>void W(V),children:[(0,w.jsx)(_e,{size:13}),o(`chat:chatHistoryPage.renameChat`)]}),(0,w.jsxs)(Q,{onSelect:()=>void J(V,{pinned:!V.pinned},V.pinned?o(`navigation:appSidebar.unpinned`):o(`navigation:appSidebar.pinned`)),children:[V.pinned?(0,w.jsx)(oe,{size:13}):(0,w.jsx)(de,{size:13}),V.pinned?o(`navigation:appSidebar.unpin`):o(`navigation:appSidebar.pin`)]}),(0,w.jsxs)(Q,{onSelect:()=>void J(V,{archived:!V.archived},V.archived?o(`navigation:appSidebar.restored`):o(`navigation:appSidebar.movedToArchive`)),children:[V.archived?(0,w.jsx)(ae,{size:13}):(0,w.jsx)(le,{size:13}),V.archived?o(`navigation:appSidebar.restore`):o(`navigation:appSidebar.archive`)]}),V.unread&&(0,w.jsx)(Q,{onSelect:()=>void J(V,{read:!0},o(`navigation:appSidebar.markedRead`)),children:o(`navigation:appSidebar.markRead`)}),(0,w.jsxs)(Q,{variant:`destructive`,disabled:!!P,onSelect:()=>void We(V),children:[(0,w.jsx)(b,{size:13}),o(`chat:chatHistoryPage.delete`)]})]}):B?(0,w.jsxs)(w.Fragment,{children:[B.cwd&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Q,{onSelect:()=>U(B.cwd),children:[(0,w.jsx)(ve,{size:13}),o(`navigation:appSidebar.newChat`)]}),(0,w.jsxs)(Q,{onSelect:()=>void q(B),children:[(0,w.jsx)(_e,{size:13}),o(`navigation:appSidebar.renameProject`)]}),_[B.key]&&(0,w.jsxs)(Q,{onSelect:()=>K(B,``),children:[(0,w.jsx)(ye,{size:13}),o(`navigation:appSidebar.resetProjectName`)]})]}),(0,w.jsxs)(Q,{variant:`destructive`,disabled:!!P||!B.sessions.length,onSelect:()=>void Ue(B),children:[(0,w.jsx)(b,{size:13}),o(`navigation:appSidebar.deleteProject`)]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(Q,{disabled:A,onSelect:()=>void Ve(),children:[(0,w.jsx)(Ke,{size:13}),o(`navigation:appSidebar.newProject`)]}),(0,w.jsxs)(tt,{children:[(0,w.jsxs)(rt,{disabled:!z.length||!!P,children:[(0,w.jsx)(b,{size:13}),o(`navigation:appSidebar.deleteProject`)]}),(0,w.jsx)(it,{className:`max-h-[70vh] max-w-[280px] overflow-y-auto`,children:z.map(e=>(0,w.jsx)(Q,{onSelect:()=>void Ue(e),children:(0,w.jsx)(`span`,{className:`truncate`,title:e.cwd||H(e),children:H(e)})},e.key))})]})]})})]}),O&&(0,w.jsx)(C.Suspense,{fallback:null,children:(0,w.jsx)(at,{open:!0,description:o(`navigation:appSidebar.newProjectPickerDescription`),onOpenChange:k,onSelect:e=>{k(!1),U(e)}})})]})}export{$ as SidebarRecentSessions};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./settings-QX0oWnVK.js";import{t as i}from"./button-CQA36izu.js";var a=e();function o({onOpen:e,active:o=!1,compact:s=!1}){let{t:c}=t();return(0,a.jsxs)(i,{variant:`ghost`,onClick:e,"aria-current":o?`true`:void 0,title:s?c(`navigation:navigation.settings`):void 0,className:n(`h-11 w-full justify-start gap-2.5 rounded-lg px-2.5 text-sm font-normal text-foreground transition-colors hover:bg-sidebar-accent`,o&&`bg-sidebar-accent`,s&&`justify-center px-0`),children:[(0,a.jsx)(r,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:s?`sr-only`:void 0,children:c(`navigation:navigation.settings`)})]})}export{o as SidebarSettingsButton};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-C7st2Mx5.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./settings-QX0oWnVK.js";import{t as i}from"./button-CQA36izu.js";var a=e();function o({onOpen:e,active:o=!1,compact:s=!1}){let{t:c}=t();return(0,a.jsxs)(i,{variant:`ghost`,onClick:e,"aria-current":o?`true`:void 0,title:s?c(`navigation:navigation.settings`):void 0,className:n(`h-11 w-full justify-start gap-2.5 rounded-lg px-2.5 text-sm font-normal text-foreground transition-colors hover:bg-sidebar-accent`,o&&`bg-sidebar-accent`,s&&`justify-center px-0`),children:[(0,a.jsx)(r,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:s?`sr-only`:void 0,children:c(`navigation:navigation.settings`)})]})}export{o as SidebarSettingsButton};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--accent-soft)] text-[var(--text)] transition-colors hover:bg-sidebar-accent ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:f?`animate-spin shrink-0`:`shrink-0`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-[12px]`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-[11px] text-[var(--text-muted)]`,children:h})]})]})}export{s as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-C7st2Mx5.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--accent-soft)] text-[var(--text)] transition-colors hover:bg-sidebar-accent ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:f?`animate-spin shrink-0`:`shrink-0`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-[12px]`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-[11px] text-[var(--text-muted)]`,children:h})]})]})}export{s as default};
@@ -1 +1 @@
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-a84Zp9dV.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./save-CHBB52P8.js";import{t as l}from"./sparkles-S_eeuqn9.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./wrench-6pg6_bqI.js";import{t as f}from"./api-YI8_cHpR.js";import{t as p}from"./button-CQA36izu.js";import{c as m,l as h,n as g,o as _,r as v,s as y,t as b}from"./app-primitives-SxfoFmHc.js";import{t as x}from"./usePagePrimaryAction-CWPC0C_f.js";var S=i(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),C=e(t(),1),w=n(),T=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`];function E(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function D(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function O(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?S:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?d:l}function k(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function A({notify:e,query:t=``,activeSessionId:n=``,registerPrimaryAction:i,requestText:a,requestConfirm:o}){let{t:l}=r(),[d,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(``),[N,P]=(0,C.useState)(`all`),[F,I]=(0,C.useState)(!1),[L,R]=(0,C.useState)(!0),[,z]=(0,C.useState)(``),B=(0,C.useCallback)(async()=>{z(``);try{let e=await f(E(`/api/skills`,n));return A(e),M(t=>e.skills.some(e=>e.id===t)?t:e.skills[0]?.id||``),e}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{R(!1)}},[n]);(0,C.useEffect)(()=>{B()},[B]);let V=(0,C.useCallback)(async()=>{let t=await a?.({title:l(`skills:skillsPage.importGlobalSkill`),message:l(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:l(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:l(`skills:skillsPage.continue`)});if(t?.trim()&&await o?.({title:l(`skills:skillsPage.importGlobalSkill`),message:l(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:l(`skills:skillsPage.import`),tone:`danger`})!==!1){I(!0),z(``);try{let r=await f(E(`/api/skills/install`,n),{method:`POST`,body:JSON.stringify({source:t})});A(r),M(r.installed?.[0]?.id||r.skills[0]?.id||``),e(l(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);z(n),e(n,`error`)}finally{I(!1)}}},[n,e,o,a,l]);if(x(i,V),L&&!d)return(0,w.jsx)(`div`,{className:`skills-page flex min-h-[100%] flex-col gap-[12px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(s,{className:`animate-spin`,size:23}),(0,w.jsx)(`h2`,{children:l(`skills:skillsPage.loadingSkills`)}),(0,w.jsx)(`p`,{children:l(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)})]})});let H=d?.skills||[],U=H.filter(e=>k(e,N)&&`${e.name} ${e.description}`.toLowerCase().includes(t.toLowerCase())),W=H.filter(e=>e.sourceInfo?.scope!==`project`),G=H.filter(e=>e.sourceInfo?.scope===`project`),K=U.filter(e=>e.sourceInfo?.scope!==`project`),q=U.filter(e=>e.sourceInfo?.scope===`project`),J=H.find(e=>e.id===j)||U[0]||H[0]||null,Y=(d?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?l(`skills:skillsPage.projectScopedConfiguration`):l(`skills:skillsPage.userScopedConfiguration`),status:e.installed?l(`skills:skillsPage.locallyReady`):l(`skills:skillsPage.notMaterialized`),tone:e.installed?`green`:`gray`})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(t.toLowerCase())),X=async(e,t)=>{if(e){I(!0),z(``);try{let r=await f(E(`/api/skills/${encodeURIComponent(e.id)}`,n),{method:`PATCH`,body:JSON.stringify(t)});A(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){z(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Z=async()=>{I(!0),z(``);try{A(await f(E(`/api/skills/reload`,n),{method:`POST`,body:`{}`})),e(l(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){z(e instanceof Error?e.message:String(e))}finally{I(!1)}},Q=async()=>{if(J?.removable&&await o?.({title:l(`skills:skillsPage.uninstallSkill`),message:l(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:l(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){I(!0),z(``);try{await f(E(`/api/skills/${encodeURIComponent(J.id)}`,n),{method:`DELETE`});let t=await B();M(t?.skills[0]?.id||``),e(l(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);z(n),e(n,`error`)}finally{I(!1)}}},$=(e,t,n,r,i=``)=>(0,w.jsxs)(`section`,{className:`skill-scope [.skill-scope_+_&]:[border-top:1px_solid_var(--stroke)] [.skill-scope_+_&]:pt-[14px]`,children:[(0,w.jsxs)(`div`,{className:`skill-scope-head [&_>_div]:min-w-0 [&_small]:block [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_span]:min-w-[24px] [&_>_span]:text-[var(--text-secondary)] [&_>_span]:text-[12px] [&_>_span]:font-[600] [&_>_span]:text-right flex min-w-0 items-start justify-between gap-[10px]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(_,{title:e}),i&&(0,w.jsx)(`small`,{title:i,children:i})]}),(0,w.jsx)(`span`,{children:t.length})]}),t.length?t.map(e=>{let t=O(e);return(0,w.jsxs)(`div`,{className:`skill-row grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent p-[10px_8px] text-left hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.selected]:rounded-[var(--r-sm)] [&.selected]:bg-[var(--accent-soft)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] grid-cols-[minmax(0,1fr)_auto] [padding-block:4px] ${J?.id===e.id?`selected`:``}`,children:[(0,w.jsxs)(`button`,{className:`skill-row-main [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent [padding:6px_4px] text-left`,onClick:()=>M(e.id),children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(t,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(`small`,{className:`line-clamp-2`,title:e.description,children:e.description})]})]}),(0,w.jsx)(y,{value:e.enabled,disabled:F,ariaLabel:l(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void X(e,{enabled:t})})]},e.id)}):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:n.length?l(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})]});return(0,w.jsxs)(`div`,{className:`skills-page flex min-h-[100%] flex-col gap-[12px]`,children:[(0,w.jsx)(m,{options:T.map(e=>D(e,l)),value:D(N,l),onChange:e=>P(T.find(t=>D(t,l)===e)||`all`)}),(0,w.jsxs)(`div`,{className:`skills-layout max-[1150px]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:grid-cols-[1fr] grid min-h-0 flex-1 grid-cols-[minmax(240px,.85fr)_minmax(290px,1.05fr)_minmax(280px,1fr)] gap-[12px]`,children:[(0,w.jsxs)(b,{className:`flex flex-col gap-[16px]`,children:[N!==`project`&&$(l(`skills:skillsPage.globalSkills`),K,W,l(`skills:skillsPage.noGlobalSkills`),d?.locations?.global||`~/.pisper/agent/skills`),N!==`global`&&$(l(`skills:skillsPage.projectSkills`),q,G,l(`skills:skillsPage.noProjectSkills`),d?.locations?.project||(d?.cwd?`${d.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``))]}),(0,w.jsxs)(b,{children:[(0,w.jsxs)(g,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.configuredSkillPackages`)}),(0,w.jsx)(`span`,{className:`text-[var(--text-secondary)] text-[12px] font-[600]`,children:l(`skills:skillsPage.countSkillPackages`,{count:Y.length})})]}),Y.length?Y.map(e=>(0,w.jsxs)(`div`,{className:`market-row [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap grid min-h-[48px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_2px]`,children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(S,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{title:e.source,children:e.source}),(0,w.jsx)(`small`,{children:e.description})]}),(0,w.jsx)(h,{tone:e.tone,children:e.status})]},e.source)):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:l(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})]}),(0,w.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,children:[(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.selectedSkill`)}),(0,w.jsx)(`h2`,{children:J?.name||l(`skills:skillsPage.noSkillAvailable`)}),(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55]`,children:J?.description||l(`skills:skillsPage.addGlobalOrProjectSkill`)}),[[l(`skills:skillsPage.triggerMode`),J?.modelInvocationEnabled?l(`skills:skillsPage.automaticManual`):l(`skills:skillsPage.manualOnly`)],[l(`skills:skillsPage.permissions`),J?.allowedTools?.length?J.allowedTools.join(`, `):l(`skills:skillsPage.usesChatToolPermissions`)],[l(`skills:skillsPage.scope`),J?.sourceInfo?.scope===`project`?l(`skills:skillsPage.project`):l(`skills:skillsPage.global`)],[l(`skills:skillsPage.version`),J?.version||`latest`],[l(`skills:skillsPage.source`),J?.source||`—`]].map(e=>(0,w.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,w.jsx)(`span`,{children:e[0]}),(0,w.jsx)(`strong`,{children:e[1]})]},e[0])),(0,w.jsxs)(p,{variant:J?.removable?`destructive`:`default`,size:`lg`,className:`w-full`,disabled:F,onClick:J?.removable?Q:Z,children:[J?.removable?(0,w.jsx)(u,{size:14}):(0,w.jsx)(c,{size:14}),J?.removable?l(`skills:skillsPage.uninstallSkill`):l(`skills:skillsPage.saveSettings`)]})]}),(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.triggerConditions`)}),[[l(`skills:skillsPage.allowAutomaticModelInvocation`),!!J?.modelInvocationEnabled,!1,e=>void X(J,{modelInvocationEnabled:e})],[l(`skills:skillsPage.supportManualSkillCommand`),!!J?.command,!0],[l(`skills:skillsPage.projectScopedSkill`),J?.sourceInfo?.scope===`project`,!0],[l(`skills:skillsPage.declaresRequiredTools`),!!J?.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,w.jsxs)(`label`,{className:`check-row [&_input]:[accent-color:var(--star-strong)] flex items-center gap-[7px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_2px] text-[12px]`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!J||F||n,onChange:e=>r?.(e.target.checked)}),(0,w.jsx)(`span`,{children:e})]},e))]})]})]})]})}export{A as SkillsPage};
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-C7st2Mx5.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./save-CHBB52P8.js";import{t as l}from"./sparkles-S_eeuqn9.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./wrench-6pg6_bqI.js";import{t as f}from"./api-DmuPqjXK.js";import{t as p}from"./button-CQA36izu.js";import{c as m,l as h,n as g,o as _,r as v,s as y,t as b}from"./app-primitives-BBXY6U2S.js";import{t as x}from"./usePagePrimaryAction-CWPC0C_f.js";var S=i(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),C=e(t(),1),w=n(),T=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`];function E(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function D(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function O(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?S:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?d:l}function k(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function A({notify:e,query:t=``,activeSessionId:n=``,registerPrimaryAction:i,requestText:a,requestConfirm:o}){let{t:l}=r(),[d,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(``),[N,P]=(0,C.useState)(`all`),[F,I]=(0,C.useState)(!1),[L,R]=(0,C.useState)(!0),[,z]=(0,C.useState)(``),B=(0,C.useCallback)(async()=>{z(``);try{let e=await f(E(`/api/skills`,n));return A(e),M(t=>e.skills.some(e=>e.id===t)?t:e.skills[0]?.id||``),e}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{R(!1)}},[n]);(0,C.useEffect)(()=>{B()},[B]);let V=(0,C.useCallback)(async()=>{let t=await a?.({title:l(`skills:skillsPage.importGlobalSkill`),message:l(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:l(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:l(`skills:skillsPage.continue`)});if(t?.trim()&&await o?.({title:l(`skills:skillsPage.importGlobalSkill`),message:l(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:l(`skills:skillsPage.import`),tone:`danger`})!==!1){I(!0),z(``);try{let r=await f(E(`/api/skills/install`,n),{method:`POST`,body:JSON.stringify({source:t})});A(r),M(r.installed?.[0]?.id||r.skills[0]?.id||``),e(l(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);z(n),e(n,`error`)}finally{I(!1)}}},[n,e,o,a,l]);if(x(i,V),L&&!d)return(0,w.jsx)(`div`,{className:`skills-page flex min-h-[100%] flex-col gap-[12px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(s,{className:`animate-spin`,size:23}),(0,w.jsx)(`h2`,{children:l(`skills:skillsPage.loadingSkills`)}),(0,w.jsx)(`p`,{children:l(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)})]})});let H=d?.skills||[],U=H.filter(e=>k(e,N)&&`${e.name} ${e.description}`.toLowerCase().includes(t.toLowerCase())),W=H.filter(e=>e.sourceInfo?.scope!==`project`),G=H.filter(e=>e.sourceInfo?.scope===`project`),K=U.filter(e=>e.sourceInfo?.scope!==`project`),q=U.filter(e=>e.sourceInfo?.scope===`project`),J=H.find(e=>e.id===j)||U[0]||H[0]||null,Y=(d?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?l(`skills:skillsPage.projectScopedConfiguration`):l(`skills:skillsPage.userScopedConfiguration`),status:e.installed?l(`skills:skillsPage.locallyReady`):l(`skills:skillsPage.notMaterialized`),tone:e.installed?`green`:`gray`})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(t.toLowerCase())),X=async(e,t)=>{if(e){I(!0),z(``);try{let r=await f(E(`/api/skills/${encodeURIComponent(e.id)}`,n),{method:`PATCH`,body:JSON.stringify(t)});A(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){z(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Z=async()=>{I(!0),z(``);try{A(await f(E(`/api/skills/reload`,n),{method:`POST`,body:`{}`})),e(l(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){z(e instanceof Error?e.message:String(e))}finally{I(!1)}},Q=async()=>{if(J?.removable&&await o?.({title:l(`skills:skillsPage.uninstallSkill`),message:l(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:l(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){I(!0),z(``);try{await f(E(`/api/skills/${encodeURIComponent(J.id)}`,n),{method:`DELETE`});let t=await B();M(t?.skills[0]?.id||``),e(l(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);z(n),e(n,`error`)}finally{I(!1)}}},$=(e,t,n,r,i=``)=>(0,w.jsxs)(`section`,{className:`skill-scope [.skill-scope_+_&]:[border-top:1px_solid_var(--stroke)] [.skill-scope_+_&]:pt-[14px]`,children:[(0,w.jsxs)(`div`,{className:`skill-scope-head [&_>_div]:min-w-0 [&_small]:block [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_span]:min-w-[24px] [&_>_span]:text-[var(--text-secondary)] [&_>_span]:text-[12px] [&_>_span]:font-[600] [&_>_span]:text-right flex min-w-0 items-start justify-between gap-[10px]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(_,{title:e}),i&&(0,w.jsx)(`small`,{title:i,children:i})]}),(0,w.jsx)(`span`,{children:t.length})]}),t.length?t.map(e=>{let t=O(e);return(0,w.jsxs)(`div`,{className:`skill-row grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent p-[10px_8px] text-left hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.selected]:rounded-[var(--r-sm)] [&.selected]:bg-[var(--accent-soft)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] grid-cols-[minmax(0,1fr)_auto] [padding-block:4px] ${J?.id===e.id?`selected`:``}`,children:[(0,w.jsxs)(`button`,{className:`skill-row-main [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent [padding:6px_4px] text-left`,onClick:()=>M(e.id),children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(t,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(`small`,{className:`line-clamp-2`,title:e.description,children:e.description})]})]}),(0,w.jsx)(y,{value:e.enabled,disabled:F,ariaLabel:l(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void X(e,{enabled:t})})]},e.id)}):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:n.length?l(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})]});return(0,w.jsxs)(`div`,{className:`skills-page flex min-h-[100%] flex-col gap-[12px]`,children:[(0,w.jsx)(m,{options:T.map(e=>D(e,l)),value:D(N,l),onChange:e=>P(T.find(t=>D(t,l)===e)||`all`)}),(0,w.jsxs)(`div`,{className:`skills-layout max-[1150px]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:grid-cols-[1fr] grid min-h-0 flex-1 grid-cols-[minmax(240px,.85fr)_minmax(290px,1.05fr)_minmax(280px,1fr)] gap-[12px]`,children:[(0,w.jsxs)(b,{className:`flex flex-col gap-[16px]`,children:[N!==`project`&&$(l(`skills:skillsPage.globalSkills`),K,W,l(`skills:skillsPage.noGlobalSkills`),d?.locations?.global||`~/.pisper/agent/skills`),N!==`global`&&$(l(`skills:skillsPage.projectSkills`),q,G,l(`skills:skillsPage.noProjectSkills`),d?.locations?.project||(d?.cwd?`${d.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``))]}),(0,w.jsxs)(b,{children:[(0,w.jsxs)(g,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.configuredSkillPackages`)}),(0,w.jsx)(`span`,{className:`text-[var(--text-secondary)] text-[12px] font-[600]`,children:l(`skills:skillsPage.countSkillPackages`,{count:Y.length})})]}),Y.length?Y.map(e=>(0,w.jsxs)(`div`,{className:`market-row [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap grid min-h-[48px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_2px]`,children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(S,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{title:e.source,children:e.source}),(0,w.jsx)(`small`,{children:e.description})]}),(0,w.jsx)(h,{tone:e.tone,children:e.status})]},e.source)):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:l(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})]}),(0,w.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,children:[(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.selectedSkill`)}),(0,w.jsx)(`h2`,{children:J?.name||l(`skills:skillsPage.noSkillAvailable`)}),(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55]`,children:J?.description||l(`skills:skillsPage.addGlobalOrProjectSkill`)}),[[l(`skills:skillsPage.triggerMode`),J?.modelInvocationEnabled?l(`skills:skillsPage.automaticManual`):l(`skills:skillsPage.manualOnly`)],[l(`skills:skillsPage.permissions`),J?.allowedTools?.length?J.allowedTools.join(`, `):l(`skills:skillsPage.usesChatToolPermissions`)],[l(`skills:skillsPage.scope`),J?.sourceInfo?.scope===`project`?l(`skills:skillsPage.project`):l(`skills:skillsPage.global`)],[l(`skills:skillsPage.version`),J?.version||`latest`],[l(`skills:skillsPage.source`),J?.source||`—`]].map(e=>(0,w.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,w.jsx)(`span`,{children:e[0]}),(0,w.jsx)(`strong`,{children:e[1]})]},e[0])),(0,w.jsxs)(p,{variant:J?.removable?`destructive`:`default`,size:`lg`,className:`w-full`,disabled:F,onClick:J?.removable?Q:Z,children:[J?.removable?(0,w.jsx)(u,{size:14}):(0,w.jsx)(c,{size:14}),J?.removable?l(`skills:skillsPage.uninstallSkill`):l(`skills:skillsPage.saveSettings`)]})]}),(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.triggerConditions`)}),[[l(`skills:skillsPage.allowAutomaticModelInvocation`),!!J?.modelInvocationEnabled,!1,e=>void X(J,{modelInvocationEnabled:e})],[l(`skills:skillsPage.supportManualSkillCommand`),!!J?.command,!0],[l(`skills:skillsPage.projectScopedSkill`),J?.sourceInfo?.scope===`project`,!0],[l(`skills:skillsPage.declaresRequiredTools`),!!J?.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,w.jsxs)(`label`,{className:`check-row [&_input]:[accent-color:var(--star-strong)] flex items-center gap-[7px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_2px] text-[12px]`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!J||F||n,onChange:e=>r?.(e.target.checked)}),(0,w.jsx)(`span`,{children:e})]},e))]})]})]})]})}export{A as SkillsPage};
@@ -1,4 +1,4 @@
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"./createLucideIcon-Cd-3GVxJ.js";import{t as i}from"./chevron-down-CxtxIjiP.js";import{t as a}from"./minus-BuutOHSj.js";import{t as o}from"./plus-fQbSqB1n.js";import{t as s}from"./square-terminal-BVG6cUT1.js";import{t as c}from"./x-07u4-129.js";import{t as l}from"./api-YI8_cHpR.js";import{t as u}from"./button-CQA36izu.js";import{r as d}from"./events-KqdUtjsm.js";var f=r(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),p=e(t(),1),m=2,h=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},g=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=_.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function te(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var _=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!te(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ne=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function re(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ie=class{constructor(e=re,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ne;this._linkProvider=this._terminal.registerLinkProvider(new g(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},ae=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?oe(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ae(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,b={get:()=>ce,set:e=>ce=e},le=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>le,set:e=>le=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function fe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function pe(e,t,n,r){e.stopPropagation(),e.clipboardData&&me(e.clipboardData.getData(`text/plain`),t,n,r)}function me(e,t,n,r){e=de(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function S(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function C(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ge(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var _e=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ve=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},ye=``,be=` `,xe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new w}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},w=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},T=class e extends xe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new w,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?C(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Se=`di$target`,E=`di$dependencies`,Ce=new Map;function we(e){return e[E]||[]}function D(e){if(Ce.has(e))return Ce.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Te(t,e,r)};return t._id=e,Ce.set(e,t),t}function Te(e,t,n){t[Se]===t?t[E].push({id:e,index:n}):(t[E]=[{id:e,index:n}],t[Se]=t)}var O=D(`BufferService`),Ee=D(`CoreMouseService`),De=D(`CoreService`),Oe=D(`CharsetService`),ke=D(`InstantiationService`),Ae=D(`LogService`),k=D(`OptionsService`),je=D(`OscLinkService`),Me=D(`UnicodeService`),Ne=D(`DecorationService`),Pe=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new T,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Fe(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Pe=v([y(0,O),y(1,k),y(2,je)],Pe);function Fe(e,t){if(confirm(`Do you want to navigate to ${t}?
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"./createLucideIcon-Cd-3GVxJ.js";import{t as i}from"./chevron-down-CxtxIjiP.js";import{t as a}from"./minus-BuutOHSj.js";import{t as o}from"./plus-fQbSqB1n.js";import{t as s}from"./square-terminal-BVG6cUT1.js";import{t as c}from"./x-07u4-129.js";import{t as l}from"./api-DmuPqjXK.js";import{t as u}from"./button-CQA36izu.js";import{r as d}from"./events-DjkpUZEu.js";var f=r(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),p=e(t(),1),m=2,h=1,ee=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},g=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=_.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function te(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var _=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!te(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ne=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function re(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ie=class{constructor(e=re,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ne;this._linkProvider=this._terminal.registerLinkProvider(new g(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},ae=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?oe(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ae(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,b={get:()=>ce,set:e=>ce=e},le=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>le,set:e=>le=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function fe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function pe(e,t,n,r){e.stopPropagation(),e.clipboardData&&me(e.clipboardData.getData(`text/plain`),t,n,r)}function me(e,t,n,r){e=de(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function S(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function C(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ge(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var _e=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ve=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},ye=``,be=` `,xe=class e{constructor(){this.fg=0,this.bg=0,this.extended=new w}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},w=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},T=class e extends xe{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new w,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?C(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Se=`di$target`,E=`di$dependencies`,Ce=new Map;function we(e){return e[E]||[]}function D(e){if(Ce.has(e))return Ce.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Te(t,e,r)};return t._id=e,Ce.set(e,t),t}function Te(e,t,n){t[Se]===t?t[E].push({id:e,index:n}):(t[E]=[{id:e,index:n}],t[Se]=t)}var O=D(`BufferService`),Ee=D(`CoreMouseService`),De=D(`CoreService`),Oe=D(`CharsetService`),ke=D(`InstantiationService`),Ae=D(`LogService`),k=D(`OptionsService`),je=D(`OscLinkService`),Me=D(`UnicodeService`),Ne=D(`DecorationService`),Pe=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new T,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Fe(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Pe=v([y(0,O),y(1,k),y(2,je)],Pe);function Fe(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Ie=D(`CharSizeService`),Le=D(`CoreBrowserService`),Re=D(`MouseService`),ze=D(`RenderService`),Be=D(`SelectionService`),Ve=D(`CharacterJoinerService`),He=D(`ThemeService`),Ue=D(`LinkProviderService`),We=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Xe.isErrorNoTelemetry(e)?new Xe(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./createLucideIcon-Cd-3GVxJ.js";import{n as i,r as a,t as o}from"./sun-DBWBo3We.js";import{t as s}from"./button-CQA36izu.js";import{n as c}from"./ui-store-BGs-dEVz.js";var l=r(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),u=e(),d={system:a,scheduled:l,dark:i,light:o};function f({theme:e,onCycle:r,compact:i=!1,className:a}){let{t:o}=t(),l={system:o(`navigation:pageHeader.system`),scheduled:o(`navigation:pageHeader.scheduled`),dark:o(`navigation:pageHeader.dark`),light:o(`navigation:pageHeader.light`)},f=d[e],p={theme:l[e],next:l[c(e)]};return(0,u.jsx)(s,{variant:i?`ghost`:`outline`,size:`icon`,className:n(`[-webkit-app-region:no-drag]`,i&&`size-8 rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground`,a),"data-testid":`theme-toggle`,title:o(`navigation:pageHeader.themeThemeClickToSwitch`,p),"aria-label":o(`navigation:pageHeader.themeThemeClickToSwitchThemes`,p),onClick:r,children:(0,u.jsx)(f,{className:`size-4`,"aria-hidden":`true`})})}export{f as t};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-C7st2Mx5.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./createLucideIcon-Cd-3GVxJ.js";import{n as i,r as a,t as o}from"./sun-DBWBo3We.js";import{t as s}from"./button-CQA36izu.js";import{n as c}from"./ui-store-DLloh4Rv.js";var l=r(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),u=e(),d={system:a,scheduled:l,dark:i,light:o};function f({theme:e,onCycle:r,compact:i=!1,className:a}){let{t:o}=t(),l={system:o(`navigation:pageHeader.system`),scheduled:o(`navigation:pageHeader.scheduled`),dark:o(`navigation:pageHeader.dark`),light:o(`navigation:pageHeader.light`)},f=d[e],p={theme:l[e],next:l[c(e)]};return(0,u.jsx)(s,{variant:i?`ghost`:`outline`,size:`icon`,className:n(`[-webkit-app-region:no-drag]`,i&&`size-8 rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground`,a),"data-testid":`theme-toggle`,title:o(`navigation:pageHeader.themeThemeClickToSwitch`,p),"aria-label":o(`navigation:pageHeader.themeThemeClickToSwitchThemes`,p),onClick:r,children:(0,u.jsx)(f,{className:`size-4`,"aria-hidden":`true`})})}export{f as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./index-AF29hfx9.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-a84Zp9dV.js";import{t as a}from"./api-YI8_cHpR.js";var o=e(n(),1),s=r(),c=192,l=288,u=`pisper-web-desktop-pet-position`,d={idle:{row:0,frames:6,durationMs:1100},waving:{row:3,frames:4,durationMs:700},jumping:{row:4,frames:5,durationMs:840},failed:{row:5,frames:8,durationMs:1220},waiting:{row:6,frames:6,durationMs:1010},running:{row:7,frames:6,durationMs:820},review:{row:8,frames:6,durationMs:1030}};function f(e){return{x:Math.max(0,Math.min(window.innerWidth-c,e.x)),y:Math.max(0,Math.min(window.innerHeight-l,e.y))}}function p(){try{let e=JSON.parse(t.getItem(u)||`{}`);if(Number.isFinite(e?.x)&&Number.isFinite(e?.y))return f(e)}catch{}return f({x:window.innerWidth-c-20,y:window.innerHeight-l-20})}function m(e){return e&&e in d?e:`idle`}function h(){let{t:e}=i(),[n,r]=(0,o.useState)(null),[c,l]=(0,o.useState)(p),[h,g]=(0,o.useState)(null),_=(0,o.useRef)(null),v=(0,o.useRef)(void 0),y=(0,o.useCallback)(async()=>{try{r(await a(`/api/desktop-pet`))}catch{}},[]);if((0,o.useEffect)(()=>{if(window.pisperDesktop?.getPetStatus)return;let e,t=()=>{document.visibilityState===`visible`&&e===void 0&&(y(),e=window.setInterval(y,1200))},n=()=>{e!==void 0&&(window.clearInterval(e),e=void 0)},i=()=>{document.visibilityState===`visible`?t():n()},a=e=>{let t=e.detail;t?r(t):y()},o=()=>l(e=>f(e));return t(),document.addEventListener(`visibilitychange`,i),window.addEventListener(`pisper:desktop-pet-changed`,a),window.addEventListener(`resize`,o),()=>{n(),window.clearTimeout(v.current),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`pisper:desktop-pet-changed`,a),window.removeEventListener(`resize`,o)}},[y]),window.pisperDesktop?.getPetStatus||!n?.running||!n.spriteUrl)return null;let b=h||m(n.state),x=d[b],S={review:e(`config:desktopPetSettings.bubbleThinking`),running:e(`config:desktopPetSettings.bubbleWorking`),waiting:e(`config:desktopPetSettings.bubbleResponding`),waving:e(`config:desktopPetSettings.bubbleDone`),failed:e(`config:desktopPetSettings.bubbleFailed`),jumping:e(`config:desktopPetSettings.bubbleHello`)}[b]||``,C=e=>{let n=_.current;if(!(!n||n.id!==e.pointerId)){if(_.current=null,e.currentTarget.releasePointerCapture(e.pointerId),n.moved){t.setItem(u,JSON.stringify(c));return}g(`jumping`),window.clearTimeout(v.current),v.current=window.setTimeout(()=>g(null),900)}};return(0,s.jsxs)(`div`,{className:`web-desktop-pet max-[640px]:[transform:scale(0.75)] max-[640px]:origin-[bottom_right] fixed z-[70] w-[192px] h-[288px] cursor-grab [touch-action:none] select-none [filter:drop-shadow(0_12px_14px_rgb(15_23_42_/_0.16))] ${_.current?`dragging [.web-desktop-pet&]:cursor-grabbing`:``}`,style:{left:c.x,top:c.y,opacity:n.opacity??1},onPointerDown:e=>{if(e.button!==0)return;let t=e.currentTarget.getBoundingClientRect();_.current={id:e.pointerId,offsetX:e.clientX-t.left,offsetY:e.clientY-t.top,startX:e.clientX,startY:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{let t=_.current;!t||t.id!==e.pointerId||(Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>4&&(t.moved=!0),l(f({x:e.clientX-t.offsetX,y:e.clientY-t.offsetY})))},onPointerUp:C,onPointerCancel:C,"aria-label":e(`config:desktopPetSettings.webPetLabel`,{name:n.selectedName||n.selectedSlug}),children:[(0,s.jsx)(`div`,{className:`web-desktop-pet-bubble motion-reduce:[transition:none] absolute z-[2] [left:50%] [bottom:210px] max-w-[180px] [padding:6px_10px] [transform:translateX(-50%)_translateY(4px)] [border:1px_solid_color-mix(in_srgb,_var(--stroke)_75%,_transparent)] rounded-[10px] bg-[color-mix(in_srgb,_var(--surface)_94%,_transparent)] shadow-[0_8px_24px_rgb(15_23_42_/_0.2)] text-[var(--text)] text-[11px] leading-[1.4] opacity-0 pointer-events-none text-center [transition:opacity_0.18s_ease,_transform_0.18s_ease] whitespace-nowrap ${S?`visible [.web-desktop-pet-bubble&]:opacity-100 [.web-desktop-pet-bubble&]:[transform:translateX(-50%)_translateY(0)]`:``}`,role:`status`,children:S}),(0,s.jsx)(`div`,{className:`absolute left-0 bottom-0 w-[192px] h-[208px] [contain:layout_paint] overflow-hidden`,role:`img`,children:(0,s.jsx)(`div`,{className:`web-desktop-pet-sprite [--pet-sprite-y:calc(var(--pet-row)_*_-208px)] [--pet-sprite-end-x:calc(var(--pet-frames)_*_-192px)] w-[192px] h-[208px] [background-image:var(--pet-sprite-url)] [background-repeat:no-repeat] [background-size:var(--pet-sheet-width,_1536px)_var(--pet-sheet-height,_1872px)] [image-rendering:pixelated] [transform:translateZ(0)] origin-[top_left] [will-change:background-position] [animation:web-pet-state_var(--pet-duration)_steps(var(--pet-frames))_infinite] motion-reduce:[animation:none]`,style:{"--pet-sprite-url":`url("${n.spriteUrl}")`,"--pet-sheet-width":`${n.sheetWidth||1536}px`,"--pet-sheet-height":`${n.sheetHeight||1872}px`,"--pet-row":x.row,"--pet-frames":x.frames,"--pet-duration":`${x.durationMs}ms`}})})]})}export{h as WebDesktopPet};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./index-Dm1UDg72.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-C7st2Mx5.js";import{t as a}from"./api-DmuPqjXK.js";var o=e(n(),1),s=r(),c=192,l=288,u=`pisper-web-desktop-pet-position`,d={idle:{row:0,frames:6,durationMs:1100},waving:{row:3,frames:4,durationMs:700},jumping:{row:4,frames:5,durationMs:840},failed:{row:5,frames:8,durationMs:1220},waiting:{row:6,frames:6,durationMs:1010},running:{row:7,frames:6,durationMs:820},review:{row:8,frames:6,durationMs:1030}};function f(e){return{x:Math.max(0,Math.min(window.innerWidth-c,e.x)),y:Math.max(0,Math.min(window.innerHeight-l,e.y))}}function p(){try{let e=JSON.parse(t.getItem(u)||`{}`);if(Number.isFinite(e?.x)&&Number.isFinite(e?.y))return f(e)}catch{}return f({x:window.innerWidth-c-20,y:window.innerHeight-l-20})}function m(e){return e&&e in d?e:`idle`}function h(){let{t:e}=i(),[n,r]=(0,o.useState)(null),[c,l]=(0,o.useState)(p),[h,g]=(0,o.useState)(null),_=(0,o.useRef)(null),v=(0,o.useRef)(void 0),y=(0,o.useCallback)(async()=>{try{r(await a(`/api/desktop-pet`))}catch{}},[]);if((0,o.useEffect)(()=>{if(window.pisperDesktop?.getPetStatus)return;let e,t=()=>{document.visibilityState===`visible`&&e===void 0&&(y(),e=window.setInterval(y,1200))},n=()=>{e!==void 0&&(window.clearInterval(e),e=void 0)},i=()=>{document.visibilityState===`visible`?t():n()},a=e=>{let t=e.detail;t?r(t):y()},o=()=>l(e=>f(e));return t(),document.addEventListener(`visibilitychange`,i),window.addEventListener(`pisper:desktop-pet-changed`,a),window.addEventListener(`resize`,o),()=>{n(),window.clearTimeout(v.current),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`pisper:desktop-pet-changed`,a),window.removeEventListener(`resize`,o)}},[y]),window.pisperDesktop?.getPetStatus||!n?.running||!n.spriteUrl)return null;let b=h||m(n.state),x=d[b],S={review:e(`config:desktopPetSettings.bubbleThinking`),running:e(`config:desktopPetSettings.bubbleWorking`),waiting:e(`config:desktopPetSettings.bubbleResponding`),waving:e(`config:desktopPetSettings.bubbleDone`),failed:e(`config:desktopPetSettings.bubbleFailed`),jumping:e(`config:desktopPetSettings.bubbleHello`)}[b]||``,C=e=>{let n=_.current;if(!(!n||n.id!==e.pointerId)){if(_.current=null,e.currentTarget.releasePointerCapture(e.pointerId),n.moved){t.setItem(u,JSON.stringify(c));return}g(`jumping`),window.clearTimeout(v.current),v.current=window.setTimeout(()=>g(null),900)}};return(0,s.jsxs)(`div`,{className:`web-desktop-pet max-[640px]:[transform:scale(0.75)] max-[640px]:origin-[bottom_right] fixed z-[70] w-[192px] h-[288px] cursor-grab [touch-action:none] select-none [filter:drop-shadow(0_12px_14px_rgb(15_23_42_/_0.16))] ${_.current?`dragging [.web-desktop-pet&]:cursor-grabbing`:``}`,style:{left:c.x,top:c.y,opacity:n.opacity??1},onPointerDown:e=>{if(e.button!==0)return;let t=e.currentTarget.getBoundingClientRect();_.current={id:e.pointerId,offsetX:e.clientX-t.left,offsetY:e.clientY-t.top,startX:e.clientX,startY:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId)},onPointerMove:e=>{let t=_.current;!t||t.id!==e.pointerId||(Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>4&&(t.moved=!0),l(f({x:e.clientX-t.offsetX,y:e.clientY-t.offsetY})))},onPointerUp:C,onPointerCancel:C,"aria-label":e(`config:desktopPetSettings.webPetLabel`,{name:n.selectedName||n.selectedSlug}),children:[(0,s.jsx)(`div`,{className:`web-desktop-pet-bubble motion-reduce:[transition:none] absolute z-[2] [left:50%] [bottom:210px] max-w-[180px] [padding:6px_10px] [transform:translateX(-50%)_translateY(4px)] [border:1px_solid_color-mix(in_srgb,_var(--stroke)_75%,_transparent)] rounded-[10px] bg-[color-mix(in_srgb,_var(--surface)_94%,_transparent)] shadow-[0_8px_24px_rgb(15_23_42_/_0.2)] text-[var(--text)] text-[11px] leading-[1.4] opacity-0 pointer-events-none text-center [transition:opacity_0.18s_ease,_transform_0.18s_ease] whitespace-nowrap ${S?`visible [.web-desktop-pet-bubble&]:opacity-100 [.web-desktop-pet-bubble&]:[transform:translateX(-50%)_translateY(0)]`:``}`,role:`status`,children:S}),(0,s.jsx)(`div`,{className:`absolute left-0 bottom-0 w-[192px] h-[208px] [contain:layout_paint] overflow-hidden`,role:`img`,children:(0,s.jsx)(`div`,{className:`web-desktop-pet-sprite [--pet-sprite-y:calc(var(--pet-row)_*_-208px)] [--pet-sprite-end-x:calc(var(--pet-frames)_*_-192px)] w-[192px] h-[208px] [background-image:var(--pet-sprite-url)] [background-repeat:no-repeat] [background-size:var(--pet-sheet-width,_1536px)_var(--pet-sheet-height,_1872px)] [image-rendering:pixelated] [transform:translateZ(0)] origin-[top_left] [will-change:background-position] [animation:web-pet-state_var(--pet-duration)_steps(var(--pet-frames))_infinite] motion-reduce:[animation:none]`,style:{"--pet-sprite-url":`url("${n.spriteUrl}")`,"--pet-sheet-width":`${n.sheetWidth||1536}px`,"--pet-sheet-height":`${n.sheetHeight||1872}px`,"--pet-row":x.row,"--pet-frames":x.frames,"--pet-duration":`${x.durationMs}ms`}})})]})}export{h as WebDesktopPet};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./createLucideIcon-Cd-3GVxJ.js";import{a as i,i as a}from"./sidebar-C3YJQV72.js";var o=r(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),s=r(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),c=e();function l({inSidebar:e=!1}){let{open:r,openMobile:l,isMobile:u,persistent:d}=i(),{t:f}=t(),p=u?l:r;if(d||!u&&!e)return null;let m=f(p?`navigation:appSidebar.collapseSidebar`:`navigation:appSidebar.expandSidebar`);return(0,c.jsxs)(a,{id:e&&p?`workbench-sidebar-collapse`:`workbench-sidebar-expand`,"aria-label":m,"aria-expanded":p,"aria-controls":`workbench-sidebar`,title:m,className:n(`h-8 shrink-0 rounded-lg border-sidebar-border hover:bg-sidebar-accent [-webkit-app-region:no-drag]`,e?p?`w-auto gap-1.5 px-2 text-xs`:`h-11 w-full`:`w-8`),children:[p?(0,c.jsx)(o,{"aria-hidden":`true`}):(0,c.jsx)(s,{"aria-hidden":`true`}),e&&p&&(0,c.jsx)(`span`,{children:f(`navigation:workbench.collapseSidebar`)})]})}export{l as t};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-C7st2Mx5.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./createLucideIcon-Cd-3GVxJ.js";import{a as i,i as a}from"./sidebar-C3YJQV72.js";var o=r(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),s=r(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),c=e();function l({inSidebar:e=!1}){let{open:r,openMobile:l,isMobile:u,persistent:d}=i(),{t:f}=t(),p=u?l:r;if(d||!u&&!e)return null;let m=f(p?`navigation:appSidebar.collapseSidebar`:`navigation:appSidebar.expandSidebar`);return(0,c.jsxs)(a,{id:e&&p?`workbench-sidebar-collapse`:`workbench-sidebar-expand`,"aria-label":m,"aria-expanded":p,"aria-controls":`workbench-sidebar`,title:m,className:n(`h-8 shrink-0 rounded-lg border-sidebar-border hover:bg-sidebar-accent [-webkit-app-region:no-drag]`,e?p?`w-auto gap-1.5 px-2 text-xs`:`h-11 w-full`:`w-8`),children:[p?(0,c.jsx)(o,{"aria-hidden":`true`}):(0,c.jsx)(s,{"aria-hidden":`true`}),e&&p&&(0,c.jsx)(`span`,{children:f(`navigation:workbench.collapseSidebar`)})]})}export{l as t};