pisper 0.6.11 → 0.6.12

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 (135) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +667 -597
  3. package/web/assets/{AppDialog-CbXmk5vN.js → AppDialog-B2sA9Pb-.js} +1 -1
  4. package/web/assets/{AppOverlays-BFLcGGx9.js → AppOverlays-BSQhRkJA.js} +1 -1
  5. package/web/assets/{AssetsPage-BoB8pJxi.js → AssetsPage-BYt5ux5w.js} +1 -1
  6. package/web/assets/{BoardPage-C3P69gtK.js → BoardPage-CMlI4ZXS.js} +3 -3
  7. package/web/assets/{ChannelsPage-yPVopq7h.js → ChannelsPage-D_wMSCSQ.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-DPulJWKJ.js → ChatAppearancePage-I3n1MqQQ.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-CZX27BNu.js → ChatHistoryPage-DfYaF_Up.js} +1 -1
  10. package/web/assets/{ChatPage-Bkv4vff9.js → ChatPage-Da-Olqli.js} +5 -5
  11. package/web/assets/{ConfigPage-D1MJyBus.js → ConfigPage-BEor5fZj.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-CKaPEgxw.js → DesktopWindowControls-CNMZrILS.js} +1 -1
  13. package/web/assets/{DispatchOverlay-CGLJLqZo.js → DispatchOverlay-D-gu_80O.js} +1 -1
  14. package/web/assets/{FeaturePage-RH3fTWIk.js → FeaturePage-Bh5TePxl.js} +1 -1
  15. package/web/assets/{FileAttachmentPreview-BhdQDxeP.js → FileAttachmentPreview-BKf_g87y.js} +1 -1
  16. package/web/assets/{FloatingWidgets-UItLK_UZ.js → FloatingWidgets-C1qQaPBd.js} +1 -1
  17. package/web/assets/{FocusRuntimeControls-DyexiBAA.js → FocusRuntimeControls-6ayCBCsE.js} +1 -1
  18. package/web/assets/{GitDiffViewer-dtiUySxH.js → GitDiffViewer-BMyafOfq.js} +1 -1
  19. package/web/assets/LaunchConsole-DM4YN3y3.js +3 -0
  20. package/web/assets/ManageProjectsDialog-B694Yqbw.js +1 -0
  21. package/web/assets/{MarkdownMessage-CYDI17zd.js → MarkdownMessage-mIynIAzE.js} +1 -1
  22. package/web/assets/McpPage-BfGjtNdb.js +1 -0
  23. package/web/assets/{MemoryPage-ObL1zsXe.js → MemoryPage-2htmr0tu.js} +1 -1
  24. package/web/assets/{MobileNavigation-BIPy8A0i.js → MobileNavigation-qjEdcfhX.js} +1 -1
  25. package/web/assets/{MorePage-CFfeYmW_.js → MorePage-B5nQDAQP.js} +1 -1
  26. package/web/assets/NewFolderDialog-D68r0xND.js +1 -0
  27. package/web/assets/{PageHeader-SVPzWuI3.js → PageHeader-BsadnkzI.js} +1 -1
  28. package/web/assets/{PhoneDrawer-C08oZFjf.js → PhoneDrawer-CGi1h7IU.js} +1 -1
  29. package/web/assets/{PhoneMenuButton-BCxDG78_.js → PhoneMenuButton-DkkEDkfk.js} +1 -1
  30. package/web/assets/{PhoneTopBar-6KsMmalq.js → PhoneTopBar-BwIvKnLT.js} +1 -1
  31. package/web/assets/{PluginsPage-jhrfFTbZ.js → PluginsPage-BV0HrLjj.js} +1 -1
  32. package/web/assets/{QuickPromptIdeas-CX8dS2LC.js → QuickPromptIdeas-Do7Bs-V_.js} +1 -1
  33. package/web/assets/{SafeModePrompt-v1_UpOAA.js → SafeModePrompt-zkBI0cAo.js} +1 -1
  34. package/web/assets/SchedulesPage-Dids4PHA.js +1 -0
  35. package/web/assets/{SessionBrowserPane-Bvy_BC-s.js → SessionBrowserPane-DXca3lhC.js} +2 -2
  36. package/web/assets/{SessionContextPanel-B6c71Uom.js → SessionContextPanel-XMQkDDgD.js} +2 -2
  37. package/web/assets/{SessionHome-B-lxCMjh.js → SessionHome-BoPMlfbE.js} +1 -1
  38. package/web/assets/{SessionInspector-FhXk25KK.js → SessionInspector-DoXEstqb.js} +1 -1
  39. package/web/assets/{SessionShell-B-zDO3z-.js → SessionShell-DC0uS7ab.js} +1 -1
  40. package/web/assets/{SettingsSidebar-K4O49gWb.js → SettingsSidebar-D1F4VOzp.js} +1 -1
  41. package/web/assets/{ShortcutHelpDialog-LajY5QoG.js → ShortcutHelpDialog-b1wuKRGr.js} +1 -1
  42. package/web/assets/{ShortcutKeys-BCndDMeY.js → ShortcutKeys-YBlbJmQo.js} +1 -1
  43. package/web/assets/{SidebarUpdateStatus-2eLpofE7.js → SidebarUpdateStatus-Dn95j8CE.js} +1 -1
  44. package/web/assets/{SkillsPage-Z_czQryK.js → SkillsPage-_g13X5ID.js} +1 -1
  45. package/web/assets/{TaskProcessesPane-GyemHu_6.js → TaskProcessesPane-ChitlEI4.js} +1 -1
  46. package/web/assets/{TaskTerminalView-C7WW5feg.js → TaskTerminalView-od0JCnVb.js} +1 -1
  47. package/web/assets/{TerminalPanel-Ddu_dEnz.js → TerminalPanel-CW47PtOX.js} +1 -1
  48. package/web/assets/{WebDesktopPet-DfAoMXEk.js → WebDesktopPet-BgQkrvFd.js} +1 -1
  49. package/web/assets/{WorkflowsPage-D_wAL0Md.js → WorkflowsPage-BFyP0_j_.js} +1 -1
  50. package/web/assets/{WorkspacePicker-DsJ0_nq_.js → WorkspacePicker-tsgOFkg0.js} +1 -1
  51. package/web/assets/{api-DxQIocGp.js → api-DOHQjQrv.js} +1 -1
  52. package/web/assets/{app-update-awVCww9P.js → app-update-C1oLil1b.js} +1 -1
  53. package/web/assets/{approval-confirm-9qU8wa0h.js → approval-confirm-Bpma8HMP.js} +1 -1
  54. package/web/assets/{board-launch-B2PD2yr-.js → board-launch-CM1zjdqN.js} +1 -1
  55. package/web/assets/board-messages-BOWWyhz_.js +1 -0
  56. package/web/assets/board-projects-Cm1I_eWA.js +1 -0
  57. package/web/assets/{chat-api-CjiINBKJ.js → chat-api-tHFjf7aB.js} +1 -1
  58. package/web/assets/{client-store-H1xTSbo-.js → client-store-CpJ1iryH.js} +1 -1
  59. package/web/assets/{config-search-hFrcaQf0.js → config-search-CyM8kWGv.js} +1 -1
  60. package/web/assets/{dialog-Bs9_FZX7.js → dialog-CfgIErMS.js} +1 -1
  61. package/web/assets/{events-DWUUCmbP.js → events-DV8PYjtk.js} +1 -1
  62. package/web/assets/{field-DaxtcBBA.js → field-DoLEb0np.js} +1 -1
  63. package/web/assets/folder-paths-Bky-CpjC.js +1 -0
  64. package/web/assets/{hosts-DsWmhXz4.js → hosts-DJ2bPahU.js} +1 -1
  65. package/web/assets/{i18n-BjpQE1sJ.js → i18n-CHHZADSh.js} +1 -1
  66. package/web/assets/{index-C3xrFlMb.js → index-CKGGgVei.js} +2 -2
  67. package/web/assets/input-group-h8z63MzW.js +1 -0
  68. package/web/assets/mount-app-B1dKgqo5.js +9 -0
  69. package/web/assets/mutation-CEbxdVYy.js +1 -0
  70. package/web/assets/{palette-navigation-Bni8Mp34.js → palette-navigation-ByC1_QS5.js} +1 -1
  71. package/web/assets/{permission-rules-api-BO8nujtv.js → permission-rules-api-DS_p7Lik.js} +1 -1
  72. package/web/assets/{pick-system-directory-C7BKn3Gc.js → pick-system-directory-Bhvwq-o2.js} +1 -1
  73. package/web/assets/placements-DBcA75II.js +2 -0
  74. package/web/assets/{popover-BqqbRCrL.js → popover-4UKNni3P.js} +1 -1
  75. package/web/assets/public-DMzrVWzM.js +1 -0
  76. package/web/assets/{public-Dp3V7Oez.js → public-QbkhsZjX.js} +2 -2
  77. package/web/assets/{public-components-CjL2gwlJ.js → public-components-Bvl5b8HI.js} +1 -1
  78. package/web/assets/public-diff-zWlldwG3.js +1 -0
  79. package/web/assets/public-launch-WirHCXQ8.js +1 -0
  80. package/web/assets/query-Bj-DUNYq.js +1 -0
  81. package/web/assets/runtime-capabilities-4_ZwLBqF.js +1 -0
  82. package/web/assets/{runtime-capabilities-store-BvWnn9Kx.js → runtime-capabilities-store-CLDMF6_P.js} +1 -1
  83. package/web/assets/{safe-mode-instance-UY-RZ5fF.js → safe-mode-instance-DPnZDrTR.js} +1 -1
  84. package/web/assets/safe-mode-sentinel-DNy3YZMh.js +1 -0
  85. package/web/assets/{session-change-summary-api-CI_mYqV8.js → session-change-summary-api-IM8k3njh.js} +1 -1
  86. package/web/assets/{session-home-sBII_AAO.js → session-home-BSH7HEmZ.js} +1 -1
  87. package/web/assets/{session-organization-api-Dt_FNL0d.js → session-organization-api-dGpPgiLe.js} +1 -1
  88. package/web/assets/{session-scope-SQQU-bRA.js → session-scope-_kqXQnb0.js} +1 -1
  89. package/web/assets/{session-tree-actions-AdyVzQwO.js → session-tree-actions-WcOcYBo-.js} +1 -1
  90. package/web/assets/{session-tree-summary-BfBt_ogL.js → session-tree-summary-CpuI5gMj.js} +1 -1
  91. package/web/assets/session-workspaces-BWTBYaGT.js +1 -0
  92. package/web/assets/{settings-navigation-DV3N_utl.js → settings-navigation-_yUm71Uk.js} +1 -1
  93. package/web/assets/{shortcuts-DWF7_dCu.js → shortcuts-BheSJu4D.js} +1 -1
  94. package/web/assets/{side-chat-context-CtRt4VcS.js → side-chat-context-fHd5qktG.js} +3 -3
  95. package/web/assets/sidebar-DQjsKcJn.js +2 -0
  96. package/web/assets/{sidebar-store-Da-3xIaR.js → sidebar-store-0l_ZiIAA.js} +1 -1
  97. package/web/assets/{speech-session-DjxOmcG7.js → speech-session-CrscgV-X.js} +1 -1
  98. package/web/assets/startup-queries-B_DpfvaA.js +1 -0
  99. package/web/assets/{use-i18n-BIJtH0nB.js → use-i18n-BWyVtWF9.js} +1 -1
  100. package/web/assets/{use-studio-actions-e1FiDWGR.js → use-studio-actions-CdzG_H8p.js} +1 -1
  101. package/web/assets/{useBoardItems-CzLK6g45.js → useBoardItems-RCXS90vW.js} +1 -1
  102. package/web/assets/{useFleetSystemInfo-kKFDmOS4.js → useFleetSystemInfo-rj18NGAd.js} +1 -1
  103. package/web/assets/useNewProjectPicker-q3Albbmn.js +1 -0
  104. package/web/assets/useNow-DlbPA2gp.js +1 -0
  105. package/web/assets/{usePhoneShell-BuNqR-TS.js → usePhoneShell-cDHpi_4q.js} +1 -1
  106. package/web/assets/useQuery-DdcpUQhO.js +1 -0
  107. package/web/assets/useSessionListQuery-B-MnlVs6.js +2 -0
  108. package/web/assets/useSessionRowActions-C6dpdoDz.js +1 -0
  109. package/web/assets/{useSidebarModel-CBd3rSxV.js → useSidebarModel-BIzp9khQ.js} +1 -1
  110. package/web/assets/{web-preview-DJZpUrZT.js → web-preview-DZqYC0Ca.js} +1 -1
  111. package/web/assets/{web-preview-events-DRcd0j1W.js → web-preview-events-DQAcSBmI.js} +1 -1
  112. package/web/assets/workspace-order-store-Cw1fZTM7.js +1 -0
  113. package/web/index.html +1 -1
  114. package/web/assets/LaunchConsole-BIiKjt0j.js +0 -2
  115. package/web/assets/ManageProjectsDialog-CLskSna6.js +0 -1
  116. package/web/assets/McpPage-DC_9gmSC.js +0 -1
  117. package/web/assets/SchedulesPage-G1R7ua11.js +0 -1
  118. package/web/assets/board-messages-xFeTO3o6.js +0 -1
  119. package/web/assets/board-projects-Dxd3yet9.js +0 -1
  120. package/web/assets/input-group-CDEyjyK4.js +0 -1
  121. package/web/assets/launch-defaults-store-DTq_ndTa.js +0 -1
  122. package/web/assets/mount-app-DQkz4dfd.js +0 -9
  123. package/web/assets/mutation-Difliohy.js +0 -1
  124. package/web/assets/placements-Dgq244bc.js +0 -2
  125. package/web/assets/public-DjZxpaMo.js +0 -1
  126. package/web/assets/public-diff-BpkmyA3H.js +0 -1
  127. package/web/assets/public-launch-C4NBmnGZ.js +0 -1
  128. package/web/assets/runtime-capabilities-BhAMiYhG.js +0 -1
  129. package/web/assets/safe-mode-sentinel-DnReXgjI.js +0 -1
  130. package/web/assets/sidebar-DTHEZloM.js +0 -2
  131. package/web/assets/startup-queries-_OUFiG02.js +0 -1
  132. package/web/assets/useNow-CpKRH_uQ.js +0 -1
  133. package/web/assets/useQuery-Bg3cTjsY.js +0 -1
  134. package/web/assets/useSessionListQuery-jM0IQ1En.js +0 -2
  135. package/web/assets/useSessionRowActions-BG8yJygF.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-BIJtH0nB.js";import{t as i}from"./api-DxQIocGp.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./check-2vYc6QaP.js";import{t as s}from"./file-code-corner-BnE1ljT0.js";import{t as c}from"./info-DATxy0fb.js";import{t as l}from"./pencil-U08v_vV9.js";import{t as u}from"./plus-fQbSqB1n.js";import{t as d}from"./refresh-cw-TbWxTY4K.js";import{t as f}from"./sparkles-S_eeuqn9.js";import{t as p}from"./trash-2-CNrPOoPR.js";import{t as m}from"./x-07u4-129.js";import{t as h}from"./more-pages-D_PnxLN0.js";import{i as ee,n as g,t as te}from"./tooltip-D4MFbqcG.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as _,t as v}from"./button-CCcCN8tE.js";import{s as y}from"./shortcuts-DWF7_dCu.js";import{n as b,r as x,t as re}from"./PageState-Cz6vFMXv.js";import{t as S}from"./input-CPw-zkYh.js";import{t as ie}from"./textarea-DmATpOqT.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./FeaturePage-RH3fTWIk.js";import{t as C}from"./field-DaxtcBBA.js";import{c as fe,i as pe,n as w,t as T}from"./app-primitives-Drz_SjnR.js";import{t as E}from"./AppSelect-BGVBQRP1.js";var D=a(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),O=a(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),k=e(t(),1);function me(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,k.useState)(null),[a,o]=(0,k.useState)(()=>!document.hidden),[s,c]=(0,k.useState)(!0),l=(0,k.useCallback)(e=>{i(e)},[]);return(0,k.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,k.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var A=n(),j={width:600,height:420,cx:300,cy:206},he=24,M=Math.PI*(3-Math.sqrt(5));function ge({type:e}){return(0,A.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:N[e]}})}var N={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},_e={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function P(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function F(e,t){let n=e.slice(0,he);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:j.cx,y:j.cy,twinkle:0}];let r=P(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=P(e.id),a=t*M+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:j.cx+Math.cos(a)*o*1.38,y:j.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function I(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function ve({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,k.useState)(1),[f,p]=(0,k.useState)(``),m=(0,k.useRef)(null),h=(0,k.useRef)(0),{ref:ee,playing:g}=me(),te=(0,k.useCallback)(e=>{m.current=e,ee(e)},[ee]),ne=g?``:`[&:before]:[animation-play-state:paused]! [&:after]:[animation-play-state:paused]! [&_*]:[animation-play-state:paused]! [&_*:before]:[animation-play-state:paused]! [&_*:after]:[animation-play-state:paused]!`,_=e=>{if(!g)return;let t=m.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},v=()=>{cancelAnimationFrame(h.current),m.current?.style.setProperty(`--px`,`0`),m.current?.style.setProperty(`--py`,`0`)};(0,k.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,k.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,k.useMemo)(()=>F(e,n),[e,n]),b=(0,k.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),re=(0,k.useMemo)(()=>{let e=new Set(y.map(e=>e.node.id));return t.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[y,t]),S=f||i,ie=new Set(t.flatMap(e=>e.sourceId===S?[e.targetId]:e.targetId===S?[e.sourceId]:[]));return(0,A.jsxs)(T,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel ${ne}`,onPointerMove:_,onPointerLeave:v,children:[(0,A.jsxs)(`div`,{className:`graph-toolbar absolute top-2.5 left-2.5 z-[4] flex gap-0.5 rounded-sm border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] p-0.5 text-[var(--galaxy-toolbar-text)] [&_button]:grid [&_button]:size-7 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:transition-colors [&_button]:duration-(--d-fast) [&_button:hover]:bg-[var(--galaxy-toolbar-hover)] max-[650px]:[&_button]:size-11 [&_svg]:size-3.5`,children:[(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,A.jsx)(u,{})}),(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomIn`),"aria-label":c(`memory:memoryPage.zoomIn`),onClick:()=>d(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,A.jsx)(O,{})}),(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomOut`),"aria-label":c(`memory:memoryPage.zoomOut`),onClick:()=>d(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,A.jsx)(D,{})})]}),(0,A.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${S?`has-focus`:``}`,ref:te,style:{transform:`scale(${l})`},children:[(0,A.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,A.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,A.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,A.jsx)(`defs`,{children:re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,A.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,A.jsx)(`stop`,{offset:`0`,stopColor:N[n.node.type]||`var(--galaxy-line-active)`}),(0,A.jsx)(`stop`,{offset:`1`,stopColor:N[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===S||e.targetId===S,a=I(n,r,P(e.id));return(0,A.jsxs)(`g`,{children:[(0,A.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,A.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,A.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),y.map(({node:e,x:t,y:n,twinkle:r},a)=>(0,A.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${i===e.id?`active`:``} ${S&&e.id!==S&&!ie.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,"aria-pressed":i===e.id,onClick:()=>o(e.id),onMouseEnter:()=>p(e.id),onMouseLeave:()=>p(``),style:{left:`${t/j.width*100}%`,top:`${n/j.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":P(e.id)%100/100,"--g-star-color":N[e.type],"--g-star-glow":_e[e.type]},title:e.content,children:[i===e.id&&(0,A.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),i===e.id&&(0,A.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,A.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,A.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,A.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,A.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,A.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!y.length&&(0,A.jsxs)(`span`,{className:`pointer-events-none absolute right-3 bottom-2.5 z-[3] rounded-xs border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] px-2 text-xs leading-5 text-[var(--galaxy-label)] tabular-nums`,children:[`✦`,` `,c(`memory:memoryPage.visibleTotalMemories`,{visible:y.length,total:e.length})]}),!a&&!y.length&&(0,A.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,A.jsx)(x,{size:44}),(0,A.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],L=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,R=`modal grid max-h-[calc(100dvh_-_40px)] w-[min(430px,100%)] gap-0.5 overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,z=`key-value flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`;function be(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function xe(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function B(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function V(e){return e instanceof Error?e.message:String(e)}function Se({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,ie]=(0,k.useState)(``),{t:C,language:w}=r(),[T,E]=(0,k.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[D,O]=(0,k.useState)(``),[me,j]=(0,k.useState)(``),[he,M]=(0,k.useState)(``),[N,_e]=(0,k.useState)(`galaxy`),P=(0,k.useRef)(null),F=(0,k.useRef)(0),[I,L]=(0,k.useState)(!0),[R,Se]=(0,k.useState)(!1),[Te,H]=(0,k.useState)(``),[Ee,U]=(0,k.useState)(null),[De,Oe]=(0,k.useState)(null),[W,ke]=(0,k.useState)(``),[G,Ae]=(0,k.useState)(null),[je,K]=(0,k.useState)(``),[Me,Ne]=(0,k.useState)(`load`),[Pe,Fe]=(0,k.useState)(!0),q=(0,k.useRef)(null),J=(0,k.useRef)(0),Ie=(0,k.useRef)(0),Le=(0,k.useRef)(0),Re=(0,k.useRef)(null),Y=(0,k.useRef)(null),ze=(0,k.useRef)(!1),X=(0,k.useRef)(null),Z=(0,k.useRef)(!0),[Be,Ve]=(0,k.useState)(!1),Q=(0,k.useCallback)(async(e=``)=>{let t=++F.current;L(!0),H(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),x.trim()&&n.set(`query`,x.trim());let r=await i(`/api/memory?${n}`);if(t!==F.current)return;E(r),Se(!0),O(r.selectedSpaceId||``),j(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===F.current&&H(V(e))}finally{t===F.current&&L(!1)}},[x]);(0,k.useEffect)(()=>(Q(D),()=>{F.current+=1}),[Q,D]);let He=(0,k.useCallback)(async()=>{Re.current?.abort();let e=new AbortController;Re.current=e;let t=++Ie.current,n=J.current,r=n===Le.current;Fe(!0),K(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Z.current||t!==Ie.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(C(`memory:memoryPage.invalidAutoApproveThreshold`));r&&J.current===n&&(q.current=o,Ae(String(o)))}catch(n){!e.signal.aborted&&Z.current&&t===Ie.current&&(Ne(`load`),K(V(n)))}finally{!e.signal.aborted&&Z.current&&t===Ie.current&&Fe(!1)}},[C]);(0,k.useEffect)(()=>(Z.current=!0,He(),()=>{Z.current=!1,Re.current?.abort(),Y.current?.abort(),X.current=null}),[He]);let Ue=async()=>{if(G===null||!G.trim()||q.current===null)return;let t=Number(G);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!Y.current&&!ze.current&&n===q.current){X.current=null,Le.current=J.current,Ae(String(n)),K(``);return}if(X.current={value:n,revision:J.current},Y.current)return;let r=new AbortController;Y.current=r,Ve(!0),K(``);try{for(;X.current&&Z.current&&!r.signal.aborted;){let t=X.current;if(X.current=null,t.value!==q.current||ze.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Z.current||r.signal.aborted)return;X.current||=t,ze.current=!0,Ne(`save`),K(V(e));return}if(!Z.current||r.signal.aborted)return;q.current=t.value,ze.current=!1}Le.current=t.revision,J.current===t.revision&&(Ae(String(t.value)),X.current||e(C(`memory:memoryPage.autoApproveSaved`)))}}finally{Y.current===r&&(Y.current=null,Z.current&&Ve(!1))}},We=T.nodes.find(e=>e.id===me)||null,Ge=e=>{let t=new Set(T.links.flatMap(t=>t.sourceId===e?[t.targetId]:t.targetId===e?[t.sourceId]:[]));return{count:t.size,files:T.nodes.filter(n=>n.type===`file`&&(t.has(n.id)||n.id===e))}},$=T.spaces.find(e=>e.id===D),Ke=async t=>{if(await n({title:C(`memory:memoryPage.deleteMemory`),message:C(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(C(`memory:memoryPage.memoryDeleted`)),await Q(D)}catch(e){H(V(e))}},qe=async(t,n)=>{if(!W){ke(t.id),H(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(C(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Je=async()=>{if(!(W||!T.candidates?.length)){ke(`__all__`),H(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(C(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Ye=async()=>{if($&&await n({title:C(`memory:memoryPage.deleteMemorySpace`),message:C(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:B($,C)}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent($.id)}`,{method:`DELETE`}),O(``),j(``),e(C(`memory:memoryPage.memorySpaceDeleted`))}catch(e){H(V(e))}},Xe=C(`navigation:navigation.memory`),Ze=B($,C),Qe=e=>{j(e),requestAnimationFrame(()=>P.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=Ge(e.id);return(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,A.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,A.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,A.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,A.jsxs)(`dl`,{children:[(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.memoryType`)}),(0,A.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,A.jsx)(ge,{type:e.type}),be(e.type,C)]})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.source`)}),(0,A.jsx)(`dd`,{children:e.sourceType===`conversation_confirmed`?C(`memory:memoryPage.userConfirmedConversationCandidate`):e.sourceType===`user_confirmed`?C(`memory:memoryPage.explicitUserRequest`):e.sourceType===`agent`?C(`memory:memoryPage.createdByAgent`):C(`memory:memoryPage.addedManually`)})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.authority`)}),(0,A.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.evidence`)}),(0,A.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.created`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:xe(e.createdAt,w)})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.relatedMemories`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:C(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>void Ke(e),children:[(0,A.jsx)(p,{}),C(`memory:memoryPage.delete`)]}),(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>U(e),children:[(0,A.jsx)(l,{}),C(`memory:memoryPage.edit`)]})]}),(0,A.jsxs)(`section`,{className:`min-w-0`,"aria-label":C(`memory:memoryPage.relatedFiles`),children:[(0,A.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[C(`memory:memoryPage.relatedFiles`),` · `,n.files.length]}),n.files.length?(0,A.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,A.jsxs)(`li`,{className:`file-row grid min-h-11 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 py-1`,children:[(0,A.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,A.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,A.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||C(`memory:memoryPage.localMemory`)})]}),(0,A.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,A.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>N===`galaxy`?j(t.id):M(t.id),children:C(`memory:memoryPage.view`)}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>U(t),children:(0,A.jsx)(l,{})}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.delete`)}: ${t.title}`,onClick:()=>void Ke(t),children:(0,A.jsx)(p,{})})]})]},t.id))}):(0,A.jsx)(`p`,{className:`text-xs text-content-muted`,children:C(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,A.jsxs)(le,{title:Xe,description:C(`memory:memoryPage.lede`),back:t&&{label:C(`navigation:sidebar.features`),ariaLabel:C(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,A.jsx)(ue,{search:(0,A.jsx)(ae,{id:h,value:x,onValueChange:ie,placeholder:C(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:C(`navigation:more.clearSearch`)}),actions:(0,A.jsxs)(v,{type:`button`,className:`h-9`,disabled:!R,onClick:()=>U({spaceId:D||T.selectedSpaceId}),children:[(0,A.jsx)(u,{}),C(`memory:memoryPage.addMemory`)]}),filters:(0,A.jsx)(fe,{options:[C(`memory:memoryPage.galaxyView`),C(`memory:memoryPage.listView`)],value:C(N===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>_e(e===C(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!R&&I?(0,A.jsx)(b,{kind:`loading`,title:C(`common:pageTemplate.loading`)}):R?(0,A.jsxs)(A.Fragment,{children:[Te&&(0,A.jsx)(de,{children:Te}),(0,A.jsx)(ce,{title:C(`memory:memoryPage.memorySpaces`),count:T.spaces.length,actions:(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe({}),children:[(0,A.jsx)(u,{}),C(`memory:memoryPage.newMemorySpace`)]}),children:(0,A.jsx)(se,{children:T.spaces.map(e=>{let t=e.id===D;return(0,A.jsx)(oe,{"data-memory-space":e.id,"aria-current":t||void 0,className:ne(`relative`,t&&`after:absolute after:top-3.5 after:bottom-3.5 after:-left-3 after:w-[3px] after:rounded-r-[3px] after:bg-star max-[650px]:after:-left-2.5`),icon:(0,A.jsx)(f,{}),onOpen:()=>{O(e.id),j(``),M(``)},name:B(e,C),status:C(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,A.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe(e),children:[(0,A.jsx)(l,{}),C(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,A.jsx)(p,{}),C(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,A.jsx)(ce,{"data-memory-stars":!0,title:Ze||C(`memory:memoryPage.memorySpaces`),count:T.nodes.length,actions:(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:I,disabled:I,"aria-label":C(`memory:memoryPage.refresh`),title:C(`memory:memoryPage.refresh`),onClick:()=>void Q(D),children:(0,A.jsx)(d,{})}),children:N===`galaxy`?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,A.jsx)(ve,{nodes:T.nodes,links:T.links,spaceId:D,selectedId:me,loading:I,onSelect:Qe,onAdd:()=>U({spaceId:D})}),(0,A.jsx)(`div`,{role:`group`,"aria-label":C(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:ye.map(e=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,A.jsx)(ge,{type:e}),be(e,C)]},e))}),(0,A.jsx)(`div`,{ref:P,role:`region`,"data-memory-detail":!0,"aria-label":C(`memory:memoryPage.selectedMemory`),className:`min-w-0 scroll-mb-4 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:We?$e(We,!0):(0,A.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:C(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):T.nodes.length?(0,A.jsx)(se,{children:T.nodes.map(e=>(0,A.jsx)(oe,{"data-memory-node":e.id,icon:(0,A.jsx)(ge,{type:e.type}),name:e.title,nameMeta:be(e.type,C),description:e.content,expanded:he===e.id,onExpandedChange:t=>M(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,A.jsx)(re,{title:x.trim()?C(`memory:memoryPage.noMatchingMemories`):C(`memory:memoryPage.noMemoriesInSpace`)})}),(0,A.jsxs)(ce,{title:C(`memory:memoryPage.memoryDrafts`),count:T.candidates?.length||0,actions:!!T.candidates?.length&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,A.jsx)(m,{}),C(`memory:memoryPage.ignoreAll`)]}),children:[Pe&&(0,A.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,A.jsx)(_,{className:`size-3.5`}),C(`memory:memoryPage.loadingAutoApproveThreshold`)]}),je&&(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,A.jsxs)(pe,{className:`my-0`,children:[C(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,je]}),(0,A.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Pe||Be,onClick:()=>void(Me===`save`?Ue():He()),children:C(`memory:memoryPage.retryAutoApproveThreshold`)})]}),G!==null&&(0,A.jsxs)(`div`,{className:`memory-auto-approve-row flex min-h-12 items-center justify-between gap-3 border-t border-stroke py-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,A.jsx)(`span`,{children:C(`memory:memoryPage.autoApproveThreshold`)}),(0,A.jsxs)(te,{children:[(0,A.jsx)(ee,{asChild:!0,children:(0,A.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,A.jsx)(g,{align:`center`,side:`top`,children:C(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,A.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,A.jsx)(S,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:G,"aria-busy":Be,"aria-label":C(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{J.current+=1,Ae(e.target.value)},onBlur:()=>void Ue(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Ue())}}),`%`,Be&&(0,A.jsx)(_,{className:`size-3.5`})]})]}),T.candidates?.length?(0,A.jsx)(se,{children:T.candidates.map(e=>(0,A.jsx)(oe,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,A.jsxs)(`span`,{className:`truncate tabular-nums`,children:[B(T.spaces.find(t=>t.id===e.spaceId),C),` · `,e.sourceType===`agent`?C(`memory:memoryPage.agentProposed`):C(`memory:memoryPage.conversationExtracted`),` · `,C(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,A.jsx)(o,{}),C(`memory:memoryPage.confirm`)]}),(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,A.jsx)(m,{}),C(`memory:memoryPage.ignore`)]})]}),detail:(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,A.jsxs)(`span`,{children:[C(`memory:memoryPage.topic`),`:`,(0,A.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,A.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[C(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,A.jsxs)(`span`,{className:`tabular-nums`,children:[C(`memory:memoryPage.created`),`:`,xe(e.createdAt,w),e.expiresAt?` · ${C(`memory:memoryPage.expires`)}:${xe(e.expiresAt,w)}`:``]})]})},e.id))}):(0,A.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:C(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,A.jsx)(b,{kind:`error`,title:C(`memory:memoryPage.loadFailed`),description:Te,action:(0,A.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void Q(D),children:C(`common:pageTemplate.retry`)})}),Ee&&(0,A.jsx)(Ce,{spaces:T.spaces,node:Ee.id?Ee:null,initialSpaceId:Ee.spaceId||D,onClose:()=>U(null),onSaved:async t=>{U(null),e(t),await Q(D)}}),De&&(0,A.jsx)(we,{space:De.id?De:null,onClose:()=>Oe(null),onSaved:async(t,n)=>{Oe(null),O(t.id),e(n)}})]})}function Ce({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,k.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[d,f]=(0,k.useState)(!1),[p,h]=(0,k.useState)(``);return(0,A.jsx)(`div`,{className:L,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:R,onSubmit:async e=>{if(e.preventDefault(),!d){f(!0),h(``);try{await i(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(c)}),await o(s(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){h(V(e))}finally{f(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,A.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,A.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":s(`memory:memoryPage.closeDialog`),disabled:d,onClick:a,children:(0,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,A.jsx)(E,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,A.jsx)(`option`,{value:e.id,children:B(e,s)},e.id))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,A.jsx)(S,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,A.jsx)(ie,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,A.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,A.jsx)(E,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:ye.map(e=>(0,A.jsx)(`option`,{value:e,children:be(e,s)},e))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,A.jsxs)(E,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,A.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,A.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,A.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,A.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,A.jsx)(S,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,A.jsx)(pe,{children:p}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function we({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,k.useState)(e?.name||``),[c,l]=(0,k.useState)(!1),[d,f]=(0,k.useState)(``);return(0,A.jsx)(`div`,{className:L,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:R,onSubmit:async t=>{if(t.preventDefault(),!c){l(!0),f(``);try{await n(await i(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),a(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){f(V(e))}finally{l(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,A.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,A.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":a(`memory:memoryPage.closeDialog`),disabled:c,onClick:t,children:(0,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,A.jsx)(S,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,A.jsx)(pe,{children:d}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{Se as MemoryPage};
1
+ 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-BWyVtWF9.js";import{t as i}from"./api-DOHQjQrv.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./check-2vYc6QaP.js";import{t as s}from"./file-code-corner-BnE1ljT0.js";import{t as c}from"./info-DATxy0fb.js";import{t as l}from"./pencil-U08v_vV9.js";import{t as u}from"./plus-fQbSqB1n.js";import{t as d}from"./refresh-cw-TbWxTY4K.js";import{t as f}from"./sparkles-S_eeuqn9.js";import{t as p}from"./trash-2-CNrPOoPR.js";import{t as m}from"./x-07u4-129.js";import{t as h}from"./more-pages-D_PnxLN0.js";import{i as ee,n as g,t as te}from"./tooltip-D4MFbqcG.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as _,t as v}from"./button-CCcCN8tE.js";import{s as y}from"./shortcuts-BheSJu4D.js";import{n as b,r as x,t as re}from"./PageState-Cz6vFMXv.js";import{t as S}from"./input-CPw-zkYh.js";import{t as ie}from"./textarea-DmATpOqT.js";import{a as ae,i as oe,n as se,o as ce,r as le,s as ue,t as de}from"./FeaturePage-Bh5TePxl.js";import{n as C}from"./field-DoLEb0np.js";import{c as fe,i as pe,n as w,t as T}from"./app-primitives-Drz_SjnR.js";import{t as E}from"./AppSelect-BGVBQRP1.js";var D=a(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),O=a(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),k=e(t(),1);function me(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,k.useState)(null),[a,o]=(0,k.useState)(()=>!document.hidden),[s,c]=(0,k.useState)(!0),l=(0,k.useCallback)(e=>{i(e)},[]);return(0,k.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,k.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var A=n(),j={width:600,height:420,cx:300,cy:206},he=24,M=Math.PI*(3-Math.sqrt(5));function ge({type:e}){return(0,A.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:N[e]}})}var N={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},_e={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function P(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function F(e,t){let n=e.slice(0,he);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:j.cx,y:j.cy,twinkle:0}];let r=P(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=P(e.id),a=t*M+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:j.cx+Math.cos(a)*o*1.38,y:j.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function I(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function ve({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,k.useState)(1),[f,p]=(0,k.useState)(``),m=(0,k.useRef)(null),h=(0,k.useRef)(0),{ref:ee,playing:g}=me(),te=(0,k.useCallback)(e=>{m.current=e,ee(e)},[ee]),ne=g?``:`[&:before]:[animation-play-state:paused]! [&:after]:[animation-play-state:paused]! [&_*]:[animation-play-state:paused]! [&_*:before]:[animation-play-state:paused]! [&_*:after]:[animation-play-state:paused]!`,_=e=>{if(!g)return;let t=m.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},v=()=>{cancelAnimationFrame(h.current),m.current?.style.setProperty(`--px`,`0`),m.current?.style.setProperty(`--py`,`0`)};(0,k.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,k.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,k.useMemo)(()=>F(e,n),[e,n]),b=(0,k.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),re=(0,k.useMemo)(()=>{let e=new Set(y.map(e=>e.node.id));return t.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[y,t]),S=f||i,ie=new Set(t.flatMap(e=>e.sourceId===S?[e.targetId]:e.targetId===S?[e.sourceId]:[]));return(0,A.jsxs)(T,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel ${ne}`,onPointerMove:_,onPointerLeave:v,children:[(0,A.jsxs)(`div`,{className:`graph-toolbar absolute top-2.5 left-2.5 z-[4] flex gap-0.5 rounded-sm border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] p-0.5 text-[var(--galaxy-toolbar-text)] [&_button]:grid [&_button]:size-7 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:transition-colors [&_button]:duration-(--d-fast) [&_button:hover]:bg-[var(--galaxy-toolbar-hover)] max-[650px]:[&_button]:size-11 [&_svg]:size-3.5`,children:[(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,A.jsx)(u,{})}),(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomIn`),"aria-label":c(`memory:memoryPage.zoomIn`),onClick:()=>d(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,A.jsx)(O,{})}),(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomOut`),"aria-label":c(`memory:memoryPage.zoomOut`),onClick:()=>d(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,A.jsx)(D,{})})]}),(0,A.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${S?`has-focus`:``}`,ref:te,style:{transform:`scale(${l})`},children:[(0,A.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,A.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,A.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,A.jsx)(`defs`,{children:re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,A.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,A.jsx)(`stop`,{offset:`0`,stopColor:N[n.node.type]||`var(--galaxy-line-active)`}),(0,A.jsx)(`stop`,{offset:`1`,stopColor:N[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===S||e.targetId===S,a=I(n,r,P(e.id));return(0,A.jsxs)(`g`,{children:[(0,A.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,A.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,A.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),y.map(({node:e,x:t,y:n,twinkle:r},a)=>(0,A.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${i===e.id?`active`:``} ${S&&e.id!==S&&!ie.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,"aria-pressed":i===e.id,onClick:()=>o(e.id),onMouseEnter:()=>p(e.id),onMouseLeave:()=>p(``),style:{left:`${t/j.width*100}%`,top:`${n/j.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":P(e.id)%100/100,"--g-star-color":N[e.type],"--g-star-glow":_e[e.type]},title:e.content,children:[i===e.id&&(0,A.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),i===e.id&&(0,A.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,A.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,A.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,A.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,A.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,A.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!y.length&&(0,A.jsxs)(`span`,{className:`pointer-events-none absolute right-3 bottom-2.5 z-[3] rounded-xs border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] px-2 text-xs leading-5 text-[var(--galaxy-label)] tabular-nums`,children:[`✦`,` `,c(`memory:memoryPage.visibleTotalMemories`,{visible:y.length,total:e.length})]}),!a&&!y.length&&(0,A.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,A.jsx)(x,{size:44}),(0,A.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],L=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,R=`modal grid max-h-[calc(100dvh_-_40px)] w-[min(430px,100%)] gap-0.5 overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,z=`key-value flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`;function be(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function xe(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function B(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function V(e){return e instanceof Error?e.message:String(e)}function Se({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,ie]=(0,k.useState)(``),{t:C,language:w}=r(),[T,E]=(0,k.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[D,O]=(0,k.useState)(``),[me,j]=(0,k.useState)(``),[he,M]=(0,k.useState)(``),[N,_e]=(0,k.useState)(`galaxy`),P=(0,k.useRef)(null),F=(0,k.useRef)(0),[I,L]=(0,k.useState)(!0),[R,Se]=(0,k.useState)(!1),[Te,H]=(0,k.useState)(``),[Ee,U]=(0,k.useState)(null),[De,Oe]=(0,k.useState)(null),[W,ke]=(0,k.useState)(``),[G,Ae]=(0,k.useState)(null),[je,K]=(0,k.useState)(``),[Me,Ne]=(0,k.useState)(`load`),[Pe,Fe]=(0,k.useState)(!0),q=(0,k.useRef)(null),J=(0,k.useRef)(0),Ie=(0,k.useRef)(0),Le=(0,k.useRef)(0),Re=(0,k.useRef)(null),Y=(0,k.useRef)(null),ze=(0,k.useRef)(!1),X=(0,k.useRef)(null),Z=(0,k.useRef)(!0),[Be,Ve]=(0,k.useState)(!1),Q=(0,k.useCallback)(async(e=``)=>{let t=++F.current;L(!0),H(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),x.trim()&&n.set(`query`,x.trim());let r=await i(`/api/memory?${n}`);if(t!==F.current)return;E(r),Se(!0),O(r.selectedSpaceId||``),j(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===F.current&&H(V(e))}finally{t===F.current&&L(!1)}},[x]);(0,k.useEffect)(()=>(Q(D),()=>{F.current+=1}),[Q,D]);let He=(0,k.useCallback)(async()=>{Re.current?.abort();let e=new AbortController;Re.current=e;let t=++Ie.current,n=J.current,r=n===Le.current;Fe(!0),K(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Z.current||t!==Ie.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(C(`memory:memoryPage.invalidAutoApproveThreshold`));r&&J.current===n&&(q.current=o,Ae(String(o)))}catch(n){!e.signal.aborted&&Z.current&&t===Ie.current&&(Ne(`load`),K(V(n)))}finally{!e.signal.aborted&&Z.current&&t===Ie.current&&Fe(!1)}},[C]);(0,k.useEffect)(()=>(Z.current=!0,He(),()=>{Z.current=!1,Re.current?.abort(),Y.current?.abort(),X.current=null}),[He]);let Ue=async()=>{if(G===null||!G.trim()||q.current===null)return;let t=Number(G);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!Y.current&&!ze.current&&n===q.current){X.current=null,Le.current=J.current,Ae(String(n)),K(``);return}if(X.current={value:n,revision:J.current},Y.current)return;let r=new AbortController;Y.current=r,Ve(!0),K(``);try{for(;X.current&&Z.current&&!r.signal.aborted;){let t=X.current;if(X.current=null,t.value!==q.current||ze.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Z.current||r.signal.aborted)return;X.current||=t,ze.current=!0,Ne(`save`),K(V(e));return}if(!Z.current||r.signal.aborted)return;q.current=t.value,ze.current=!1}Le.current=t.revision,J.current===t.revision&&(Ae(String(t.value)),X.current||e(C(`memory:memoryPage.autoApproveSaved`)))}}finally{Y.current===r&&(Y.current=null,Z.current&&Ve(!1))}},We=T.nodes.find(e=>e.id===me)||null,Ge=e=>{let t=new Set(T.links.flatMap(t=>t.sourceId===e?[t.targetId]:t.targetId===e?[t.sourceId]:[]));return{count:t.size,files:T.nodes.filter(n=>n.type===`file`&&(t.has(n.id)||n.id===e))}},$=T.spaces.find(e=>e.id===D),Ke=async t=>{if(await n({title:C(`memory:memoryPage.deleteMemory`),message:C(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(C(`memory:memoryPage.memoryDeleted`)),await Q(D)}catch(e){H(V(e))}},qe=async(t,n)=>{if(!W){ke(t.id),H(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(C(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Je=async()=>{if(!(W||!T.candidates?.length)){ke(`__all__`),H(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(C(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Ye=async()=>{if($&&await n({title:C(`memory:memoryPage.deleteMemorySpace`),message:C(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:B($,C)}),confirmLabel:C(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent($.id)}`,{method:`DELETE`}),O(``),j(``),e(C(`memory:memoryPage.memorySpaceDeleted`))}catch(e){H(V(e))}},Xe=C(`navigation:navigation.memory`),Ze=B($,C),Qe=e=>{j(e),requestAnimationFrame(()=>P.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=Ge(e.id);return(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,A.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,A.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,A.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,A.jsxs)(`dl`,{children:[(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.memoryType`)}),(0,A.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,A.jsx)(ge,{type:e.type}),be(e.type,C)]})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.source`)}),(0,A.jsx)(`dd`,{children:e.sourceType===`conversation_confirmed`?C(`memory:memoryPage.userConfirmedConversationCandidate`):e.sourceType===`user_confirmed`?C(`memory:memoryPage.explicitUserRequest`):e.sourceType===`agent`?C(`memory:memoryPage.createdByAgent`):C(`memory:memoryPage.addedManually`)})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.authority`)}),(0,A.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.evidence`)}),(0,A.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.created`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:xe(e.createdAt,w)})]}),(0,A.jsxs)(`div`,{className:z,children:[(0,A.jsx)(`dt`,{children:C(`memory:memoryPage.relatedMemories`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:C(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>void Ke(e),children:[(0,A.jsx)(p,{}),C(`memory:memoryPage.delete`)]}),(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>U(e),children:[(0,A.jsx)(l,{}),C(`memory:memoryPage.edit`)]})]}),(0,A.jsxs)(`section`,{className:`min-w-0`,"aria-label":C(`memory:memoryPage.relatedFiles`),children:[(0,A.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[C(`memory:memoryPage.relatedFiles`),` · `,n.files.length]}),n.files.length?(0,A.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,A.jsxs)(`li`,{className:`file-row grid min-h-11 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 py-1`,children:[(0,A.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,A.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,A.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||C(`memory:memoryPage.localMemory`)})]}),(0,A.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,A.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>N===`galaxy`?j(t.id):M(t.id),children:C(`memory:memoryPage.view`)}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>U(t),children:(0,A.jsx)(l,{})}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":`${C(`memory:memoryPage.delete`)}: ${t.title}`,onClick:()=>void Ke(t),children:(0,A.jsx)(p,{})})]})]},t.id))}):(0,A.jsx)(`p`,{className:`text-xs text-content-muted`,children:C(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,A.jsxs)(le,{title:Xe,description:C(`memory:memoryPage.lede`),back:t&&{label:C(`navigation:sidebar.features`),ariaLabel:C(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,A.jsx)(ue,{search:(0,A.jsx)(ae,{id:h,value:x,onValueChange:ie,placeholder:C(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:C(`navigation:more.clearSearch`)}),actions:(0,A.jsxs)(v,{type:`button`,className:`h-9`,disabled:!R,onClick:()=>U({spaceId:D||T.selectedSpaceId}),children:[(0,A.jsx)(u,{}),C(`memory:memoryPage.addMemory`)]}),filters:(0,A.jsx)(fe,{options:[C(`memory:memoryPage.galaxyView`),C(`memory:memoryPage.listView`)],value:C(N===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>_e(e===C(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!R&&I?(0,A.jsx)(b,{kind:`loading`,title:C(`common:pageTemplate.loading`)}):R?(0,A.jsxs)(A.Fragment,{children:[Te&&(0,A.jsx)(de,{children:Te}),(0,A.jsx)(ce,{title:C(`memory:memoryPage.memorySpaces`),count:T.spaces.length,actions:(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe({}),children:[(0,A.jsx)(u,{}),C(`memory:memoryPage.newMemorySpace`)]}),children:(0,A.jsx)(se,{children:T.spaces.map(e=>{let t=e.id===D;return(0,A.jsx)(oe,{"data-memory-space":e.id,"aria-current":t||void 0,className:ne(`relative`,t&&`after:absolute after:top-3.5 after:bottom-3.5 after:-left-3 after:w-[3px] after:rounded-r-[3px] after:bg-star max-[650px]:after:-left-2.5`),icon:(0,A.jsx)(f,{}),onOpen:()=>{O(e.id),j(``),M(``)},name:B(e,C),status:C(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,A.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe(e),children:[(0,A.jsx)(l,{}),C(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,A.jsx)(p,{}),C(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,A.jsx)(ce,{"data-memory-stars":!0,title:Ze||C(`memory:memoryPage.memorySpaces`),count:T.nodes.length,actions:(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:I,disabled:I,"aria-label":C(`memory:memoryPage.refresh`),title:C(`memory:memoryPage.refresh`),onClick:()=>void Q(D),children:(0,A.jsx)(d,{})}),children:N===`galaxy`?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,A.jsx)(ve,{nodes:T.nodes,links:T.links,spaceId:D,selectedId:me,loading:I,onSelect:Qe,onAdd:()=>U({spaceId:D})}),(0,A.jsx)(`div`,{role:`group`,"aria-label":C(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:ye.map(e=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,A.jsx)(ge,{type:e}),be(e,C)]},e))}),(0,A.jsx)(`div`,{ref:P,role:`region`,"data-memory-detail":!0,"aria-label":C(`memory:memoryPage.selectedMemory`),className:`min-w-0 scroll-mb-4 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:We?$e(We,!0):(0,A.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:C(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):T.nodes.length?(0,A.jsx)(se,{children:T.nodes.map(e=>(0,A.jsx)(oe,{"data-memory-node":e.id,icon:(0,A.jsx)(ge,{type:e.type}),name:e.title,nameMeta:be(e.type,C),description:e.content,expanded:he===e.id,onExpandedChange:t=>M(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,A.jsx)(re,{title:x.trim()?C(`memory:memoryPage.noMatchingMemories`):C(`memory:memoryPage.noMemoriesInSpace`)})}),(0,A.jsxs)(ce,{title:C(`memory:memoryPage.memoryDrafts`),count:T.candidates?.length||0,actions:!!T.candidates?.length&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,A.jsx)(m,{}),C(`memory:memoryPage.ignoreAll`)]}),children:[Pe&&(0,A.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,A.jsx)(_,{className:`size-3.5`}),C(`memory:memoryPage.loadingAutoApproveThreshold`)]}),je&&(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,A.jsxs)(pe,{className:`my-0`,children:[C(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,je]}),(0,A.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Pe||Be,onClick:()=>void(Me===`save`?Ue():He()),children:C(`memory:memoryPage.retryAutoApproveThreshold`)})]}),G!==null&&(0,A.jsxs)(`div`,{className:`memory-auto-approve-row flex min-h-12 items-center justify-between gap-3 border-t border-stroke py-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,A.jsx)(`span`,{children:C(`memory:memoryPage.autoApproveThreshold`)}),(0,A.jsxs)(te,{children:[(0,A.jsx)(ee,{asChild:!0,children:(0,A.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,A.jsx)(g,{align:`center`,side:`top`,children:C(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,A.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,A.jsx)(S,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:G,"aria-busy":Be,"aria-label":C(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{J.current+=1,Ae(e.target.value)},onBlur:()=>void Ue(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Ue())}}),`%`,Be&&(0,A.jsx)(_,{className:`size-3.5`})]})]}),T.candidates?.length?(0,A.jsx)(se,{children:T.candidates.map(e=>(0,A.jsx)(oe,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,A.jsxs)(`span`,{className:`truncate tabular-nums`,children:[B(T.spaces.find(t=>t.id===e.spaceId),C),` · `,e.sourceType===`agent`?C(`memory:memoryPage.agentProposed`):C(`memory:memoryPage.conversationExtracted`),` · `,C(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,A.jsx)(o,{}),C(`memory:memoryPage.confirm`)]}),(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,A.jsx)(m,{}),C(`memory:memoryPage.ignore`)]})]}),detail:(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,A.jsxs)(`span`,{children:[C(`memory:memoryPage.topic`),`:`,(0,A.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,A.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[C(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,A.jsxs)(`span`,{className:`tabular-nums`,children:[C(`memory:memoryPage.created`),`:`,xe(e.createdAt,w),e.expiresAt?` · ${C(`memory:memoryPage.expires`)}:${xe(e.expiresAt,w)}`:``]})]})},e.id))}):(0,A.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:C(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,A.jsx)(b,{kind:`error`,title:C(`memory:memoryPage.loadFailed`),description:Te,action:(0,A.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void Q(D),children:C(`common:pageTemplate.retry`)})}),Ee&&(0,A.jsx)(Ce,{spaces:T.spaces,node:Ee.id?Ee:null,initialSpaceId:Ee.spaceId||D,onClose:()=>U(null),onSaved:async t=>{U(null),e(t),await Q(D)}}),De&&(0,A.jsx)(we,{space:De.id?De:null,onClose:()=>Oe(null),onSaved:async(t,n)=>{Oe(null),O(t.id),e(n)}})]})}function Ce({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,k.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[d,f]=(0,k.useState)(!1),[p,h]=(0,k.useState)(``);return(0,A.jsx)(`div`,{className:L,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:R,onSubmit:async e=>{if(e.preventDefault(),!d){f(!0),h(``);try{await i(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(c)}),await o(s(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){h(V(e))}finally{f(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,A.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,A.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":s(`memory:memoryPage.closeDialog`),disabled:d,onClick:a,children:(0,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,A.jsx)(E,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,A.jsx)(`option`,{value:e.id,children:B(e,s)},e.id))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,A.jsx)(S,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,A.jsx)(ie,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,A.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,A.jsx)(E,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:ye.map(e=>(0,A.jsx)(`option`,{value:e,children:be(e,s)},e))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,A.jsxs)(E,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,A.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,A.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,A.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,A.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,A.jsx)(S,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,A.jsx)(pe,{children:p}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function we({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,k.useState)(e?.name||``),[c,l]=(0,k.useState)(!1),[d,f]=(0,k.useState)(``);return(0,A.jsx)(`div`,{className:L,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:R,onSubmit:async t=>{if(t.preventDefault(),!c){l(!0),f(``);try{await n(await i(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),a(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){f(V(e))}finally{l(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,A.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,A.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":a(`memory:memoryPage.closeDialog`),disabled:c,onClick:t,children:(0,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,A.jsx)(S,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,A.jsx)(pe,{children:d}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{Se as MemoryPage};
@@ -1 +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-BIJtH0nB.js";import{t as i}from"./runtime-capabilities-store-BvWnn9Kx.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-DV3N_utl.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
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-BWyVtWF9.js";import{t as i}from"./runtime-capabilities-store-CLDMF6_P.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-_yUm71Uk.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
@@ -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-BIJtH0nB.js";import{t as i}from"./useQuery-Bg3cTjsY.js";import{a,l as o}from"./api-DxQIocGp.js";import{a as s,n as c,t as l}from"./runtime-capabilities-BhAMiYhG.js";import{t as u}from"./runtime-capabilities-store-BvWnn9Kx.js";import{m as d}from"./placements-Dgq244bc.js";import{t as ee}from"./client-store-H1xTSbo-.js";import{t as f}from"./usePhoneShell-BuNqR-TS.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-DWUUCmbP.js";import{n as N,r as P}from"./config-search-hFrcaQf0.js";import{s as F}from"./shortcuts-DWF7_dCu.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
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-BWyVtWF9.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-DOHQjQrv.js";import{a as s,n as c,t as l}from"./runtime-capabilities-4_ZwLBqF.js";import{t as u}from"./runtime-capabilities-store-CLDMF6_P.js";import{m as d}from"./placements-DBcA75II.js";import{t as ee}from"./client-store-CpJ1iryH.js";import{t as f}from"./usePhoneShell-cDHpi_4q.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-DV8PYjtk.js";import{n as N,r as P}from"./config-search-CyM8kWGv.js";import{s as F}from"./shortcuts-BheSJu4D.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
@@ -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-BWyVtWF9.js";import{u as i}from"./api-DOHQjQrv.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{t as o}from"./folder-plus-OPHZsJho.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-CfgIErMS.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-Bhvwq-o2.js";import{r as S,t as C}from"./folder-paths-Bky-CpjC.js";import{n as w,t as T}from"./alert-firawb0H.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BIJtH0nB.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-DWF7_dCu.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BWyVtWF9.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-BheSJu4D.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BIJtH0nB.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-Da-3xIaR.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BWyVtWF9.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-0l_ZiIAA.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BIJtH0nB.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-Da-3xIaR.js";import{t as a}from"./useSidebarModel-CBd3rSxV.js";import"./public-DjZxpaMo.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center gap-1.5 rounded-[var(--r-md)] px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BWyVtWF9.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-0l_ZiIAA.js";import{t as a}from"./useSidebarModel-BIzp9khQ.js";import"./public-DMzrVWzM.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center gap-1.5 rounded-[var(--r-md)] px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BIJtH0nB.js";import{t as n}from"./PhoneMenuButton-BCxDG78_.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-1`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BWyVtWF9.js";import{t as n}from"./PhoneMenuButton-DkkEDkfk.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-1`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
@@ -1 +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-BIJtH0nB.js";import{t as i}from"./api-DxQIocGp.js";import{i as a}from"./runtime-capabilities-BhAMiYhG.js";import{t as o}from"./runtime-capabilities-store-BvWnn9Kx.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as b}from"./shield-alert-oZqX6MNu.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as x}from"./triangle-alert-CE1q54ci.js";import{t as S}from"./more-pages-D_PnxLN0.js";import{a as C}from"./dist-41X0pdUs.js";import{o as w,s as T}from"./dist-BsRXXcSL.js";import{a as E,c as D,i as O,l as k,n as A,o as te,r as ne,s as re,t as ie}from"./dist-BHkR6BLP.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as ae,t as M}from"./button-CCcCN8tE.js";import{s as oe}from"./shortcuts-DWF7_dCu.js";import{n as se,t as ce}from"./PageState-Cz6vFMXv.js";import{a as le,i as N,l as P,o as F,s as I,t as L}from"./dialog-Bs9_FZX7.js";import{t as R}from"./input-CPw-zkYh.js";import{a as ue,i as z,n as B,o as V,r as de,s as fe,t as H}from"./FeaturePage-RH3fTWIk.js";import{t as U}from"./pick-system-directory-C7BKn3Gc.js";import{c as pe,i as me,s as he}from"./app-primitives-Drz_SjnR.js";import{t as W}from"./AppSelect-BGVBQRP1.js";import{a as G,i as ge,n as _e,o as ve,r as K,s as ye,t as be}from"./tool-labels-BUEvdohv.js";var q=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),J=e(t(),1),Y=n(),X=Object.defineProperty,Z=(e,t)=>X(e,`name`,{value:t,configurable:!0}),[xe,Se]=T(`AlertDialog`,[k]),Q=k(),Ce=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ie,{...r,...n,modal:!0})},`AlertDialog`);J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(D,{...i,...r,ref:t})},`AlertDialogTrigger`));var we=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(te,{...r,...n})},`AlertDialogPortal`),Te=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(E,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=xe(`AlertDialogContent`),De=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=J.useRef(null),s=C(t,o),c=J.useRef(null);return(0,Y.jsx)(Ee,{scope:n,cancelRef:c,children:(0,Y.jsx)(ne,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:w(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(re,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(O,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(A,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Q(n),o=C(t,i);return(0,Y.jsx)(A,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=Ce,Pe=we,Fe=Te,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,Y.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,Y.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,Y.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:j(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,Y.jsxs)(He,{children:[(0,Y.jsx)(Ue,{}),(0,Y.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:j(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:j(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ke({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:j(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qe({className:e,...t}){return(0,Y.jsx)(ze,{"data-slot":`alert-dialog-title`,className:j(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Je({className:e,...t}){return(0,Y.jsx)(Be,{"data-slot":`alert-dialog-description`,className:j(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Y.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Le,{"data-slot":`alert-dialog-action`,className:j(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Y.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:j(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``);return(0,J.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,Y.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,Y.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,Y.jsxs)(I,{children:[(0,Y.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,Y.jsx)(le,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,Y.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await U(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,Y.jsx)(p,{})})]})]}),l&&(0,Y.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,Y.jsx)(c,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,Y.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,Y.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,Y.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,Y.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,Y.jsx)(x,{className:`mt-0.5 shrink-0`,size:15}),(0,Y.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,Y.jsxs)(me,{className:`m-0`,children:[(0,Y.jsx)(x,{size:14}),(0,Y.jsx)(`span`,{children:m})]})]}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,Y.jsxs)(M,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,Y.jsx)(ae,{className:`text-current`}):l?(0,Y.jsx)(q,{}):(0,Y.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return G({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:K(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,Y.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,Y.jsxs)(W,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,Y.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,Y.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,Y.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,Y.jsxs)(W,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,Y.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,Y.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,Y.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,Y.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,Y.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(null),[f,p]=(0,J.useState)([]),[m,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),S=(0,J.useCallback)(async(e=``)=>{g(!0),x(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){x(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,J.useEffect)(()=>{S(``)},[S]);let C=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),w=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},T=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await w(e.trim())},E=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await S(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},D=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,Y.jsxs)(Y.Fragment,{children:[D.map(e=>(0,Y.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,Y.jsx)(B,{children:e.items.map(t=>(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,Y.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void E(t),children:[(0,Y.jsx)(ee,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,Y.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(M,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Y.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,size:`sm`,onClick:T,disabled:!!_,children:[(0,Y.jsx)(q,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,Y.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),S(s)},children:[(0,Y.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,Y.jsxs)(M,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,Y.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),b&&(0,Y.jsx)(H,{className:`mt-0 mb-3`,children:b}),C.length>0&&(0,Y.jsx)(B,{children:C.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void w(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=oe(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,J.useState)(``),[h,v]=(0,J.useState)(null),[y,C]=(0,J.useState)([]),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(`all`),[O,k]=(0,J.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[A,te]=(0,J.useState)(!1),[ne,re]=(0,J.useState)(!1),[ie,le]=(0,J.useState)(!1),[N,P]=(0,J.useState)(null),[F,I]=(0,J.useState)(!1),[L,R]=(0,J.useState)(``),[H,U]=(0,J.useState)(!1),W=(0,J.useCallback)(e=>{v(e),C(e.plugins),k(e.webSearch)},[]),G=(0,J.useCallback)(async()=>{R(``);try{W(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[W]);(0,J.useEffect)(()=>{G()},[G]);let K=(0,J.useMemo)(()=>ot(y),[y]),X=(0,J.useMemo)(()=>at(y),[y]),Z=h?!lt(X,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(O)!==JSON.stringify(h.webSearch):!1,xe=(0,J.useCallback)(async()=>{if(!A){if(!h||!Z){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}te(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:X,webSearch:O,computerUseEnabled:st(y),piExtensions:ct(y)})});W(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[W,h,Z,y,X,e,A,c,O]),Se=async()=>{re(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(O)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{re(!1)}},Q=(e,t,n)=>{C(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},Ce=()=>!Z||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),we=async()=>{if(!(!N||F)){I(!0),R(``);try{W(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),T(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Te=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=K.filter(e=>E!==`all`&&e.pluginSource!==E?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,Y.jsxs)(de,{title:Te,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Y.jsx)(fe,{search:(0,Y.jsx)(ue,{id:S,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Te}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Y.jsxs)(Y.Fragment,{children:[d&&(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Ce()&&le(!0),children:[(0,Y.jsx)(q,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,Y.jsxs)(M,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:A,disabled:!h||A,onClick:()=>void xe(),children:[(0,Y.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,Y.jsx)(pe,{options:f.map(e=>it(e,c)),value:it(E,c),onChange:e=>D(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,Y.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[K.filter(e=>e.enabled).length,`/`,K.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:Z&&(0,Y.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,Y.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,Y.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,Y.jsx)(t,{}),name:(0,Y.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ve(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,Y.jsx)(he,{value:e.enabled,onChange:t=>Q(e.pluginId,e.name,t),ariaLabel:n}),expanded:w===e.name,onExpandedChange:t=>T(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,Y.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:ge({id:e.name,description:e.description},c)}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,Y.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,Y.jsx)(`dd`,{className:j((be(e.risk)||_e(e.risk))&&`font-medium text-content!`),children:ve(e.risk,c)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,Y.jsx)(`dd`,{children:ye({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,Y.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,Y.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,Y.jsx)(ft,{value:O,testing:ne,onChange:k,onTest:Se}),!e.pluginBuiltIn&&(0,Y.jsxs)(M,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Ce()&&P(e),children:[(0,Y.jsx)(ee,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,Y.jsx)(ce,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,Y.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,Y.jsx)(se,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,Y.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,loading:H,disabled:H,onClick:()=>{U(!0),G().finally(()=>U(!1))},children:c(`common:pageTemplate.retry`)})}):(0,Y.jsx)(se,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,Y.jsx)(Qe,{open:ie,onOpenChange:le,onInstalled:G}),(0,Y.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,Y.jsxs)(We,{className:`z-[220]`,children:[(0,Y.jsxs)(Ge,{children:[(0,Y.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,Y.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,Y.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:we,children:[F&&(0,Y.jsx)(ae,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,Y.jsxs)(me,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,Y.jsx)(x,{size:13}),L]})]})}export{mt as PluginsPage};
1
+ 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-BWyVtWF9.js";import{t as i}from"./api-DOHQjQrv.js";import{i as a}from"./runtime-capabilities-4_ZwLBqF.js";import{t as o}from"./runtime-capabilities-store-CLDMF6_P.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as b}from"./shield-alert-oZqX6MNu.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as x}from"./triangle-alert-CE1q54ci.js";import{t as S}from"./more-pages-D_PnxLN0.js";import{a as C}from"./dist-41X0pdUs.js";import{o as w,s as T}from"./dist-BsRXXcSL.js";import{a as E,c as D,i as O,l as k,n as A,o as te,r as ne,s as re,t as ie}from"./dist-BHkR6BLP.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as ae,t as M}from"./button-CCcCN8tE.js";import{s as oe}from"./shortcuts-BheSJu4D.js";import{n as se,t as ce}from"./PageState-Cz6vFMXv.js";import{a as le,i as N,l as P,o as F,s as I,t as L}from"./dialog-CfgIErMS.js";import{t as R}from"./input-CPw-zkYh.js";import{t as z}from"./pick-system-directory-Bhvwq-o2.js";import{a as ue,i as B,n as V,o as H,r as de,s as fe,t as U}from"./FeaturePage-Bh5TePxl.js";import{c as pe,i as me,s as he}from"./app-primitives-Drz_SjnR.js";import{t as W}from"./AppSelect-BGVBQRP1.js";import{a as G,i as ge,n as _e,o as ve,r as K,s as ye,t as be}from"./tool-labels-BUEvdohv.js";var q=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),J=e(t(),1),Y=n(),X=Object.defineProperty,Z=(e,t)=>X(e,`name`,{value:t,configurable:!0}),[xe,Se]=T(`AlertDialog`,[k]),Q=k(),Ce=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ie,{...r,...n,modal:!0})},`AlertDialog`);J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(D,{...i,...r,ref:t})},`AlertDialogTrigger`));var we=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(te,{...r,...n})},`AlertDialogPortal`),Te=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(E,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=xe(`AlertDialogContent`),De=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=J.useRef(null),s=C(t,o),c=J.useRef(null);return(0,Y.jsx)(Ee,{scope:n,cancelRef:c,children:(0,Y.jsx)(ne,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:w(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(re,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(O,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(A,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Q(n),o=C(t,i);return(0,Y.jsx)(A,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=Ce,Pe=we,Fe=Te,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,Y.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,Y.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,Y.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:j(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,Y.jsxs)(He,{children:[(0,Y.jsx)(Ue,{}),(0,Y.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:j(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:j(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ke({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:j(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qe({className:e,...t}){return(0,Y.jsx)(ze,{"data-slot":`alert-dialog-title`,className:j(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Je({className:e,...t}){return(0,Y.jsx)(Be,{"data-slot":`alert-dialog-description`,className:j(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Y.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Le,{"data-slot":`alert-dialog-action`,className:j(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Y.jsx)(M,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:j(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``);return(0,J.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,Y.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,Y.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,Y.jsxs)(I,{children:[(0,Y.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,Y.jsx)(le,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,Y.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await z(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,Y.jsx)(p,{})})]})]}),l&&(0,Y.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,Y.jsx)(c,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,Y.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,Y.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,Y.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,Y.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,Y.jsx)(x,{className:`mt-0.5 shrink-0`,size:15}),(0,Y.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,Y.jsxs)(me,{className:`m-0`,children:[(0,Y.jsx)(x,{size:14}),(0,Y.jsx)(`span`,{children:m})]})]}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,Y.jsxs)(M,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,Y.jsx)(ae,{className:`text-current`}):l?(0,Y.jsx)(q,{}):(0,Y.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return G({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:K(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,Y.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,Y.jsxs)(W,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,Y.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,Y.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,Y.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,Y.jsxs)(W,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,Y.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,Y.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,Y.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,Y.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,Y.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(null),[f,p]=(0,J.useState)([]),[m,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),S=(0,J.useCallback)(async(e=``)=>{g(!0),x(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){x(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,J.useEffect)(()=>{S(``)},[S]);let C=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),w=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},T=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await w(e.trim())},E=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await S(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},D=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,Y.jsxs)(Y.Fragment,{children:[D.map(e=>(0,Y.jsx)(H,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,Y.jsx)(V,{children:e.items.map(t=>(0,Y.jsx)(B,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,Y.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void E(t),children:[(0,Y.jsx)(ee,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,Y.jsxs)(H,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(M,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Y.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,size:`sm`,onClick:T,disabled:!!_,children:[(0,Y.jsx)(q,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,Y.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),S(s)},children:[(0,Y.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,Y.jsxs)(M,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,Y.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),b&&(0,Y.jsx)(U,{className:`mt-0 mb-3`,children:b}),C.length>0&&(0,Y.jsx)(V,{children:C.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,Y.jsx)(B,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,Y.jsx)(M,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void w(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=oe(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,J.useState)(``),[h,v]=(0,J.useState)(null),[y,C]=(0,J.useState)([]),[w,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(`all`),[O,k]=(0,J.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[A,te]=(0,J.useState)(!1),[ne,re]=(0,J.useState)(!1),[ie,le]=(0,J.useState)(!1),[N,P]=(0,J.useState)(null),[F,I]=(0,J.useState)(!1),[L,R]=(0,J.useState)(``),[z,U]=(0,J.useState)(!1),W=(0,J.useCallback)(e=>{v(e),C(e.plugins),k(e.webSearch)},[]),G=(0,J.useCallback)(async()=>{R(``);try{W(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[W]);(0,J.useEffect)(()=>{G()},[G]);let K=(0,J.useMemo)(()=>ot(y),[y]),X=(0,J.useMemo)(()=>at(y),[y]),Z=h?!lt(X,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(O)!==JSON.stringify(h.webSearch):!1,xe=(0,J.useCallback)(async()=>{if(!A){if(!h||!Z){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}te(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:X,webSearch:O,computerUseEnabled:st(y),piExtensions:ct(y)})});W(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[W,h,Z,y,X,e,A,c,O]),Se=async()=>{re(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(O)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{re(!1)}},Q=(e,t,n)=>{C(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},Ce=()=>!Z||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),we=async()=>{if(!(!N||F)){I(!0),R(``);try{W(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),T(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Te=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=K.filter(e=>E!==`all`&&e.pluginSource!==E?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,Y.jsxs)(de,{title:Te,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Y.jsx)(fe,{search:(0,Y.jsx)(ue,{id:S,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Te}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Y.jsxs)(Y.Fragment,{children:[d&&(0,Y.jsxs)(M,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Ce()&&le(!0),children:[(0,Y.jsx)(q,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,Y.jsxs)(M,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:A,disabled:!h||A,onClick:()=>void xe(),children:[(0,Y.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,Y.jsx)(pe,{options:f.map(e=>it(e,c)),value:it(E,c),onChange:e=>D(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(H,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,Y.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[K.filter(e=>e.enabled).length,`/`,K.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:Z&&(0,Y.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,Y.jsx)(V,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,Y.jsx)(B,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,Y.jsx)(t,{}),name:(0,Y.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ve(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,Y.jsx)(he,{value:e.enabled,onChange:t=>Q(e.pluginId,e.name,t),ariaLabel:n}),expanded:w===e.name,onExpandedChange:t=>T(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,Y.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:ge({id:e.name,description:e.description},c)}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,Y.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,Y.jsx)(`dd`,{className:j((be(e.risk)||_e(e.risk))&&`font-medium text-content!`),children:ve(e.risk,c)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,Y.jsx)(`dd`,{children:ye({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,Y.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,Y.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,Y.jsx)(ft,{value:O,testing:ne,onChange:k,onTest:Se}),!e.pluginBuiltIn&&(0,Y.jsxs)(M,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Ce()&&P(e),children:[(0,Y.jsx)(ee,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,Y.jsx)(ce,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,Y.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,Y.jsx)(se,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,Y.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,loading:z,disabled:z,onClick:()=>{U(!0),G().finally(()=>U(!1))},children:c(`common:pageTemplate.retry`)})}):(0,Y.jsx)(se,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,Y.jsx)(Qe,{open:ie,onOpenChange:le,onInstalled:G}),(0,Y.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,Y.jsxs)(We,{className:`z-[220]`,children:[(0,Y.jsxs)(Ge,{children:[(0,Y.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,Y.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,Y.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:we,children:[F&&(0,Y.jsx)(ae,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,Y.jsxs)(me,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,Y.jsx)(x,{size:13}),L]})]})}export{mt as PluginsPage};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BIJtH0nB.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./chevron-left-BAtyp3_6.js";import{t as s}from"./chevron-right-C3t2Rckj.js";import{t as c}from"./code-xml-BrUXrBax.js";import{t as l}from"./file-text-N9JICX6E.js";import{n as u,t as d}from"./wand-sparkles-CvEBNUFz.js";import{t as f}from"./list-checks-B5Jl4aiO.js";import{t as p}from"./button-CCcCN8tE.js";var m=a(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),h=a(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),g=a(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),_=t({default:()=>x}),v=e(n(),1),y=r();function b(e,t){return[{icon:c,label:e(`chat:focusSession.explainCode`),prompt:e(`chat:focusSession.explainHowThisCodeWorks`)},{icon:u,label:e(`chat:focusSession.writeTests`),prompt:e(`chat:focusSession.writeUnitTestsForTheFollowingCode`)},{icon:d,label:e(`chat:focusSession.refactor`),prompt:e(`chat:focusSession.refactorThisCodeAndExplainTheImprovements`)},{icon:m,label:e(`chat:focusSession.findABug`),prompt:e(`chat:focusSession.helpMeLocateAndFixThisBug`)},{icon:l,label:e(`chat:focusSession.summarize`),prompt:e(`chat:focusSession.summarizeContentAndExtractKeyPoints`)},...t?[{icon:f,label:e(`chat:focusSession.makeAPlan`),prompt:e(`chat:focusSession.makeAClearActionablePlanForThisGoal`)}]:[],{icon:h,label:e(`chat:focusSession.organizeInformation`),prompt:e(`chat:focusSession.organizeThisInformationIntoAClearStructure`)},{icon:g,label:e(`chat:focusSession.findIssues`),prompt:e(`chat:focusSession.reviewThisContentAndSuggestImprovements`)}]}function x({plansAvailable:e,onPromptSelect:t}){let{t:n}=i(),[r,a]=(0,v.useState)(0),c=b(n,e),l=Math.ceil(c.length/3)-1,u=Math.min(r,l);return(0,y.jsxs)(`section`,{"aria-label":n(`chat:focusSession.promptIdeas`),className:`pt-6 text-left text-sm`,children:[(0,y.jsxs)(`div`,{className:`mb-2 flex min-h-7 items-center justify-between gap-2`,children:[(0,y.jsx)(`h2`,{className:`text-[12px] font-medium tracking-[.02em] text-content-muted`,children:n(`chat:focusSession.promptIdeas`)}),(0,y.jsxs)(`div`,{className:`flex gap-1 @max-[600px]:hidden`,children:[(0,y.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`chat:workbench.previousIdeas`),disabled:u===0,onClick:()=>a(u-1),children:(0,y.jsx)(o,{})}),(0,y.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`chat:workbench.nextIdeas`),disabled:u===l,onClick:()=>a(u+1),children:(0,y.jsx)(s,{})})]})]}),(0,y.jsx)(`div`,{className:`welcome-chips grid grid-cols-3 gap-2 @max-[600px]:flex @max-[600px]:snap-x @max-[600px]:overflow-x-auto @max-[600px]:pb-2`,children:c.map((e,r)=>(0,y.jsxs)(`button`,{type:`button`,"aria-label":e.label,"data-off-page":Math.floor(r/3)!==u||void 0,"data-target-cursor":!0,onClick:()=>t(e.prompt),className:`group/idea flex min-h-[112px] min-w-0 cursor-pointer flex-col gap-2 rounded-md border border-stroke bg-panel p-3 text-left font-normal transition-colors duration-(--d-fast) ease-precise hover:border-stroke-strong hover:bg-surface-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus @max-[600px]:w-[min(240px,80cqw)] @max-[600px]:shrink-0 @max-[600px]:snap-start @min-[600px]:data-off-page:hidden`,children:[(0,y.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`grid size-7 place-items-center rounded-sm border border-key-border bg-key text-content-secondary shadow-key`,children:(0,y.jsx)(e.icon,{size:15,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`rounded-xs border border-stroke px-1.5 text-[12px] leading-[18px] text-content-muted opacity-0 transition-opacity duration-(--d-fast) group-hover/idea:opacity-100 group-focus-visible/idea:opacity-100 pointer-coarse:opacity-100`,children:n(`chat:workbench.tryPrompt`)})]}),(0,y.jsx)(`span`,{className:`mt-1 text-[13px] font-medium text-foreground`,children:e.label}),(0,y.jsx)(`span`,{className:`text-[12px] leading-[1.5] text-content-muted`,children:e.prompt.replace(/[::]$/,``)})]},e.label))})]})}export{_ as t};
1
+ import{a as e,r as t}from"./rolldown-runtime-B0Z9INg1.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BWyVtWF9.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./chevron-left-BAtyp3_6.js";import{t as s}from"./chevron-right-C3t2Rckj.js";import{t as c}from"./code-xml-BrUXrBax.js";import{t as l}from"./file-text-N9JICX6E.js";import{n as u,t as d}from"./wand-sparkles-CvEBNUFz.js";import{t as f}from"./list-checks-B5Jl4aiO.js";import{t as p}from"./button-CCcCN8tE.js";var m=a(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),h=a(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),g=a(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),_=t({default:()=>x}),v=e(n(),1),y=r();function b(e,t){return[{icon:c,label:e(`chat:focusSession.explainCode`),prompt:e(`chat:focusSession.explainHowThisCodeWorks`)},{icon:u,label:e(`chat:focusSession.writeTests`),prompt:e(`chat:focusSession.writeUnitTestsForTheFollowingCode`)},{icon:d,label:e(`chat:focusSession.refactor`),prompt:e(`chat:focusSession.refactorThisCodeAndExplainTheImprovements`)},{icon:m,label:e(`chat:focusSession.findABug`),prompt:e(`chat:focusSession.helpMeLocateAndFixThisBug`)},{icon:l,label:e(`chat:focusSession.summarize`),prompt:e(`chat:focusSession.summarizeContentAndExtractKeyPoints`)},...t?[{icon:f,label:e(`chat:focusSession.makeAPlan`),prompt:e(`chat:focusSession.makeAClearActionablePlanForThisGoal`)}]:[],{icon:h,label:e(`chat:focusSession.organizeInformation`),prompt:e(`chat:focusSession.organizeThisInformationIntoAClearStructure`)},{icon:g,label:e(`chat:focusSession.findIssues`),prompt:e(`chat:focusSession.reviewThisContentAndSuggestImprovements`)}]}function x({plansAvailable:e,onPromptSelect:t}){let{t:n}=i(),[r,a]=(0,v.useState)(0),c=b(n,e),l=Math.ceil(c.length/3)-1,u=Math.min(r,l);return(0,y.jsxs)(`section`,{"aria-label":n(`chat:focusSession.promptIdeas`),className:`pt-6 text-left text-sm`,children:[(0,y.jsxs)(`div`,{className:`mb-2 flex min-h-7 items-center justify-between gap-2`,children:[(0,y.jsx)(`h2`,{className:`text-[12px] font-medium tracking-[.02em] text-content-muted`,children:n(`chat:focusSession.promptIdeas`)}),(0,y.jsxs)(`div`,{className:`flex gap-1 @max-[600px]:hidden`,children:[(0,y.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`chat:workbench.previousIdeas`),disabled:u===0,onClick:()=>a(u-1),children:(0,y.jsx)(o,{})}),(0,y.jsx)(p,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":n(`chat:workbench.nextIdeas`),disabled:u===l,onClick:()=>a(u+1),children:(0,y.jsx)(s,{})})]})]}),(0,y.jsx)(`div`,{className:`welcome-chips grid grid-cols-3 gap-2 @max-[600px]:flex @max-[600px]:snap-x @max-[600px]:overflow-x-auto @max-[600px]:pb-2`,children:c.map((e,r)=>(0,y.jsxs)(`button`,{type:`button`,"aria-label":e.label,"data-off-page":Math.floor(r/3)!==u||void 0,"data-target-cursor":!0,onClick:()=>t(e.prompt),className:`group/idea flex min-h-[112px] min-w-0 cursor-pointer flex-col gap-2 rounded-md border border-stroke bg-panel p-3 text-left font-normal transition-colors duration-(--d-fast) ease-precise hover:border-stroke-strong hover:bg-surface-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus @max-[600px]:w-[min(240px,80cqw)] @max-[600px]:shrink-0 @max-[600px]:snap-start @min-[600px]:data-off-page:hidden`,children:[(0,y.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:`grid size-7 place-items-center rounded-sm border border-key-border bg-key text-content-secondary shadow-key`,children:(0,y.jsx)(e.icon,{size:15,"aria-hidden":`true`})}),(0,y.jsx)(`span`,{className:`rounded-xs border border-stroke px-1.5 text-[12px] leading-[18px] text-content-muted opacity-0 transition-opacity duration-(--d-fast) group-hover/idea:opacity-100 group-focus-visible/idea:opacity-100 pointer-coarse:opacity-100`,children:n(`chat:workbench.tryPrompt`)})]}),(0,y.jsx)(`span`,{className:`mt-1 text-[13px] font-medium text-foreground`,children:e.label}),(0,y.jsx)(`span`,{className:`text-[12px] leading-[1.5] text-content-muted`,children:e.prompt.replace(/[::]$/,``)})]},e.label))})]})}export{_ as t};
@@ -1 +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-BIJtH0nB.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-Bs9_FZX7.js";import{t as d}from"./safe-mode-instance-UY-RZ5fF.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
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-BWyVtWF9.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-CfgIErMS.js";import{t as d}from"./safe-mode-instance-DPnZDrTR.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};