pisper 0.6.43 → 0.6.44

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 (128) hide show
  1. package/package.json +6 -6
  2. package/web/.vite/manifest.json +690 -690
  3. package/web/assets/{AppDialog-Cv4YvRrF.js → AppDialog-BmhtqPq6.js} +1 -1
  4. package/web/assets/{AppOverlays-Du54VkDZ.js → AppOverlays-cyz0mMc9.js} +1 -1
  5. package/web/assets/{AssetsPage-TiFEC32s.js → AssetsPage-a_DNQXQF.js} +1 -1
  6. package/web/assets/{AttachmentTray-BI4I9xoX.js → AttachmentTray-Fx0RVdj2.js} +1 -1
  7. package/web/assets/{BoardPage-BBa6v_6k.js → BoardPage-CQF_701M.js} +3 -3
  8. package/web/assets/{ChannelsPage-BsQCgczL.js → ChannelsPage-C4sSuXef.js} +1 -1
  9. package/web/assets/{ChatAppearancePage-By82YAjZ.js → ChatAppearancePage-BA77E4RG.js} +1 -1
  10. package/web/assets/{ChatHistoryPage-a6EHRkRQ.js → ChatHistoryPage-Bo932avi.js} +1 -1
  11. package/web/assets/{ChatMessage-CrCe2TLj.js → ChatMessage-DyRMVDmJ.js} +3 -3
  12. package/web/assets/{ChatPage-BixfWP4y.js → ChatPage-Bh2srQ5Q.js} +3 -3
  13. package/web/assets/{ConfigPage-CcwhlyGO.js → ConfigPage-CRMPpPxz.js} +3 -3
  14. package/web/assets/{DesktopWindowControls-D3YeNjmV.js → DesktopWindowControls-QTt7BkHB.js} +1 -1
  15. package/web/assets/{FeaturePage-DyRo_I02.js → FeaturePage-DEjUrI25.js} +1 -1
  16. package/web/assets/{FileAttachmentPreview-LLowX6R-.js → FileAttachmentPreview-CU3DVCec.js} +1 -1
  17. package/web/assets/{FloatingWidgets-CgXdrX0y.js → FloatingWidgets-DsEUT3hG.js} +1 -1
  18. package/web/assets/{FocusRuntimeControls-LaHQWOPc.js → FocusRuntimeControls-CoxLbl8K.js} +1 -1
  19. package/web/assets/{GitDiffViewer-D6X8UoVx.js → GitDiffViewer-BFdi1mxr.js} +1 -1
  20. package/web/assets/{ManageProjectsDialog-D4HGh_Lh.js → ManageProjectsDialog-BpsBTKv5.js} +1 -1
  21. package/web/assets/{MarkdownMessage-COsYrsCd.js → MarkdownMessage-B9Bb9VQU.js} +1 -1
  22. package/web/assets/{McpPage-Bfqrm6Ua.js → McpPage-D1onf9RA.js} +1 -1
  23. package/web/assets/MemoryEvolution-D4d8ELda.js +1 -0
  24. package/web/assets/MemoryPage-BxeQ1cdR.js +2 -0
  25. package/web/assets/{MobileNavigation-Ci_zzYIj.js → MobileNavigation-DQcTpoYc.js} +1 -1
  26. package/web/assets/{MorePage-0bECKmUj.js → MorePage-DqfRiueD.js} +1 -1
  27. package/web/assets/{NewFolderDialog-Ctuw8Xt9.js → NewFolderDialog-dNstknkT.js} +1 -1
  28. package/web/assets/{PageHeader-DDHU5m0R.js → PageHeader-Bn_vZ-th.js} +1 -1
  29. package/web/assets/{PhoneDrawer-DZMbkdza.js → PhoneDrawer-BnWXS2P1.js} +1 -1
  30. package/web/assets/{PhoneMenuButton-BtAGHyzX.js → PhoneMenuButton-Coocnsrf.js} +1 -1
  31. package/web/assets/{PhoneTopBar-Cx1lw-iS.js → PhoneTopBar-DUJ9aeM3.js} +1 -1
  32. package/web/assets/{PluginsPage-iBWJo-Ux.js → PluginsPage-Z7Fx-eAU.js} +1 -1
  33. package/web/assets/{SafeModePrompt-CEOQ01Bl.js → SafeModePrompt-DaxOzv7_.js} +1 -1
  34. package/web/assets/{SchedulesPage-Dw3CQw8g.js → SchedulesPage-ZGP3g3Vt.js} +1 -1
  35. package/web/assets/{SessionBrowserPane-DzZvN-iz.js → SessionBrowserPane-DeOqkbLQ.js} +2 -2
  36. package/web/assets/{SessionContextPanel-D2MIRUxU.js → SessionContextPanel-Co419auw.js} +2 -2
  37. package/web/assets/{SessionHome-BTl_EcTv.js → SessionHome-3GRisRUv.js} +1 -1
  38. package/web/assets/{SessionInspector-BY9P2WuS.js → SessionInspector-KjdRXk-P.js} +1 -1
  39. package/web/assets/{SessionShell-DzIXzmYM.js → SessionShell-DrMljmEy.js} +1 -1
  40. package/web/assets/{SettingsSidebar-DxFdOSKE.js → SettingsSidebar-Bfgryx3X.js} +1 -1
  41. package/web/assets/{ShortcutHelpDialog-BhD8_tZa.js → ShortcutHelpDialog-BEv4kDZo.js} +1 -1
  42. package/web/assets/{ShortcutKeys-CAiqwRJW.js → ShortcutKeys-CFnZogMX.js} +1 -1
  43. package/web/assets/{SidebarUpdateStatus-StFlsvF7.js → SidebarUpdateStatus-BaQLz9Ha.js} +1 -1
  44. package/web/assets/{SkillsPage-9ff7FB_P.js → SkillsPage-DiBdvo55.js} +1 -1
  45. package/web/assets/{TaskProcessesPane-Cjti3REL.js → TaskProcessesPane-CgzN0Oqf.js} +1 -1
  46. package/web/assets/{TaskTerminalView-Bj9xJWSN.js → TaskTerminalView-E0ZkafSN.js} +1 -1
  47. package/web/assets/{TerminalPanel-BsVTDd6P.js → TerminalPanel-KwRTV-hb.js} +1 -1
  48. package/web/assets/{WebDesktopPet-B1QzBZFt.js → WebDesktopPet-CGpI6-UL.js} +1 -1
  49. package/web/assets/{WorkflowsPage-BW0PAk_6.js → WorkflowsPage-BCfAr_BN.js} +1 -1
  50. package/web/assets/{WorkspacePicker-Di59Kt67.js → WorkspacePicker-DyL_8DP0.js} +1 -1
  51. package/web/assets/{api-DMqZSAib.js → api-D1flkoh7.js} +1 -1
  52. package/web/assets/{app-update-B3x5F3G0.js → app-update-DWy3AK8N.js} +1 -1
  53. package/web/assets/{approval-confirm-2JlrhCJj.js → approval-confirm-CDGLUuxy.js} +1 -1
  54. package/web/assets/{assets-api-BYWPazKD.js → assets-api-BGMZsyC4.js} +1 -1
  55. package/web/assets/{board-projects-wULJ4QMT.js → board-projects-DjGBcX8k.js} +1 -1
  56. package/web/assets/{bots-store-BFSwqKxI.js → bots-store-Ck_jncK7.js} +1 -1
  57. package/web/assets/{chat-api-CbddSAiB.js → chat-api-BqA8nXly.js} +1 -1
  58. package/web/assets/{client-store-CQELNb0e.js → client-store-e4OXhDNK.js} +1 -1
  59. package/web/assets/{command-BLb6loUF.js → command-LVPgEdXI.js} +1 -1
  60. package/web/assets/{config-search-CEVepeo_.js → config-search-a0xjM1yz.js} +1 -1
  61. package/web/assets/{desktop-hosts-D5V4ltEO.js → desktop-hosts-DsTa6yr4.js} +2 -2
  62. package/web/assets/{dialog-nax_z9Og.js → dialog-DldLiTwf.js} +1 -1
  63. package/web/assets/{event-stream-CuxX_nc8.js → event-stream-DRv0u06j.js} +1 -1
  64. package/web/assets/{events-BgoXNekW.js → events-C8OUQmIW.js} +1 -1
  65. package/web/assets/{folder-paths-BxUl5vo9.js → folder-paths-CfRbR0Ik.js} +1 -1
  66. package/web/assets/{hosts-yZPjlvMS.js → hosts-DbXwJrWt.js} +1 -1
  67. package/web/assets/{http-D4AhfBV1.js → http-B-XVZUum.js} +1 -1
  68. package/web/assets/{http-response-BHt8SJKV.js → http-response-DEs9jkgT.js} +1 -1
  69. package/web/assets/i18n-DyMZgkZI.js +1 -0
  70. package/web/assets/{index-Dw3Kz26s.js → index-CiyAfWLi.js} +2 -2
  71. package/web/assets/{machine-messages-Dy3k2jL6.js → machine-messages-CKHf8pyL.js} +1 -1
  72. package/web/assets/{machines-api-C8KK5tCO.js → machines-api-BeimiMiu.js} +1 -1
  73. package/web/assets/{memory-api-apQzknw7.js → memory-api-Cu3MEsQE.js} +1 -1
  74. package/web/assets/{mount-app-CI5QAfkX.js → mount-app-ISo-f47e.js} +2 -2
  75. package/web/assets/{permission-rules-api-Ci2nr5hD.js → permission-rules-api-bHINce43.js} +1 -1
  76. package/web/assets/{pick-system-directory-BeHwgRu7.js → pick-system-directory-D1GGkOTf.js} +1 -1
  77. package/web/assets/{placements-Bca0DPqX.js → placements-9_rV4h0k.js} +2 -2
  78. package/web/assets/{popover-2hW0lH2e.js → popover-DGWRnOht.js} +1 -1
  79. package/web/assets/{public-BWzxxlQu.js → public-B7wKOz_X.js} +2 -2
  80. package/web/assets/{public-bMk6lfoD.js → public-DRF_OfnY.js} +1 -1
  81. package/web/assets/{public-CUh5RfpQ.js → public-Dr8_scp5.js} +2 -2
  82. package/web/assets/{public-components-COcMq_cr.js → public-components-by-7di2-.js} +1 -1
  83. package/web/assets/public-diff-pNrf0LGG.js +1 -0
  84. package/web/assets/public-events-DmLE1dVC.js +1 -0
  85. package/web/assets/{public-flags-2sXN0jOy.js → public-flags-DHN44K2T.js} +1 -1
  86. package/web/assets/{public-folder-dialog-BrY1IUjD.js → public-folder-dialog-Gkbm4LRI.js} +1 -1
  87. package/web/assets/{public-greeting-F27_o7CG.js → public-greeting-Bdpk4piS.js} +1 -1
  88. package/web/assets/{public-CvQSuCpU.js → public-lAWjPSYc.js} +1 -1
  89. package/web/assets/{public-session-BXcmWF--.js → public-session-CtusCiv8.js} +1 -1
  90. package/web/assets/{public-sidebar-rxvfp6cZ.js → public-sidebar-DmWVSBL3.js} +1 -1
  91. package/web/assets/{runtime-capabilities-store-BA14peh5.js → runtime-capabilities-store-MtXRlSIi.js} +1 -1
  92. package/web/assets/{safe-mode-instance-CpApZsNO.js → safe-mode-instance-CpOBP8Nz.js} +1 -1
  93. package/web/assets/safe-mode-sentinel-BGslsjrl.js +1 -0
  94. package/web/assets/{session-change-summary-api-zrzUcWPa.js → session-change-summary-api-CAkw4_-l.js} +1 -1
  95. package/web/assets/{session-home-cMbldWP4.js → session-home-CJcIlNWK.js} +1 -1
  96. package/web/assets/{session-inspector-store-CVt788oh.js → session-inspector-store-C3BluNoW.js} +1 -1
  97. package/web/assets/{session-questions-CFzjCrxi.js → session-questions-BPKyVhzp.js} +1 -1
  98. package/web/assets/{session-scope-DSz16bMk.js → session-scope-ddZfvpZE.js} +1 -1
  99. package/web/assets/{session-tree-actions-DejUCyUM.js → session-tree-actions-_YCQsWye.js} +1 -1
  100. package/web/assets/{session-tree-summary-Bjg79Vc5.js → session-tree-summary-BLsTrwUq.js} +1 -1
  101. package/web/assets/{session-web-preview-BUv0rBHy.js → session-web-preview-DZOVkeBU.js} +1 -1
  102. package/web/assets/{shortcuts-lvsdkhJa.js → shortcuts-C6ddcUau.js} +1 -1
  103. package/web/assets/{side-chat-context-D9g8NFwu.js → side-chat-context-C7vwSBGo.js} +4 -4
  104. package/web/assets/{sidebar-CtLMqJCy.js → sidebar-B7HP3-3A.js} +1 -1
  105. package/web/assets/{sidebar-store-QQPSgdSc.js → sidebar-store-Bv_D4lVD.js} +1 -1
  106. package/web/assets/{speech-session-C_7w5AfS.js → speech-session-DI3T3jpW.js} +1 -1
  107. package/web/assets/{startup-queries-CbAKsBHA.js → startup-queries-B2k6wlnS.js} +1 -1
  108. package/web/assets/{use-i18n-47vsdOU3.js → use-i18n-CsOCclo6.js} +1 -1
  109. package/web/assets/{use-open-bot-CHjqcvJF.js → use-open-bot-BPSaOfrG.js} +1 -1
  110. package/web/assets/{use-studio-actions-CMpatayc.js → use-studio-actions-Cvz4jiDa.js} +1 -1
  111. package/web/assets/{useCatalogProjects-t9qTve0q.js → useCatalogProjects-D3mDdYej.js} +1 -1
  112. package/web/assets/{useMachines-deaqc_F-.js → useMachines-BwvKcPVd.js} +1 -1
  113. package/web/assets/useNativeBrowser-CF8AHTRL.js +1 -0
  114. package/web/assets/{useNewProjectPicker-D5M2WzCG.js → useNewProjectPicker-DfE1or_O.js} +2 -2
  115. package/web/assets/{useNow-D1gmERNF.js → useNow-CuwOIh4H.js} +1 -1
  116. package/web/assets/{usePhoneShell-Bn3ZlBYr.js → usePhoneShell-e-CScTJH.js} +1 -1
  117. package/web/assets/{useSessionRowActions-C59wvHhe.js → useSessionRowActions-DUufel_k.js} +1 -1
  118. package/web/assets/{useSidebarModel-B9j6QP07.js → useSidebarModel-CShQi_Fw.js} +1 -1
  119. package/web/assets/{workspace-folders-VL22twQS.js → workspace-folders-Dq7V_wOF.js} +1 -1
  120. package/web/assets/{workspace-order-store-Cz2oC0mc.js → workspace-order-store-PI98x5sR.js} +1 -1
  121. package/web/index.html +1 -1
  122. package/web/assets/MemoryEvolution-B3gyPy3a.js +0 -1
  123. package/web/assets/MemoryPage-CpBDpgyx.js +0 -2
  124. package/web/assets/i18n-CHUj56MI.js +0 -1
  125. package/web/assets/public-diff-7U99QOFO.js +0 -1
  126. package/web/assets/public-events-DaY2zYrz.js +0 -1
  127. package/web/assets/safe-mode-sentinel-b5M49bjO.js +0 -1
  128. package/web/assets/useNativeBrowser-C0j3zafh.js +0 -1
@@ -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-CsOCclo6.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./info-DATxy0fb.js";import{t as o}from"./pause-CYWpPg1R.js";import{t as s}from"./play-DNDjDNGn.js";import{t as c}from"./x-07u4-129.js";import{a as l,r as u,t as d}from"./popover-DGWRnOht.js";import{t as f}from"./slider-De8rWVNs.js";import{t as p}from"./segmented-control-xkrEOP_d.js";import{t as m}from"./utils-C8uzG5AZ.js";import{n as h,t as g}from"./button-CCcCN8tE.js";import{n as ee,t as te}from"./PageState-Cz6vFMXv.js";import{t as _}from"./motion-DTR4ZVle.js";import{d as v,l as y}from"./memory-api-Cu3MEsQE.js";var ne=i(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),b=e(t(),1);function re(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(()=>!document.hidden),[s,c]=(0,b.useState)(!0),l=(0,b.useCallback)(e=>{i(e)},[]);return(0,b.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,b.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 x=864e5,S=Math.PI*2,C=.055,ie=.85,w=1e3,T=.72,E=2.6,ae=1.75,oe=30,se=1.1,D=.34,ce=6e3,le=[`decision`,`preference`,`fact`,`concept`,`risk`,`file`,`task`];function O(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}var ue=e=>O(e)/4294967296,k=e=>Math.min(1,Math.max(0,e));function A(e,t){let n=Date.parse(String(e||``));return Number.isNaN(n)?t:n}function de(e,t){let n=Math.max(1,e.end-e.start);return C+.945*k((t-e.start)/n)**ie}function fe(e,t){return t*(1+.046*(.62*Math.sin(3*e+1.1+1.9*t)+.28*Math.sin(5*e+4.2-2.7*t)+.1*Math.sin(11*e+2.3+5.1*t))*Math.min(1,t*2.2))}var j=.042,pe=-.03;function M(e,t){return fe(e,t)*Math.cos(e)+j*(1-t)}function N(e,t){return fe(e,t)*Math.sin(e)+pe*(1-t)}function me(e){let t=(e.end-e.start)/x;return t<=21?`day`:t<=120?`week`:t<=1e3?`month`:t<=3e3?`quarter`:`year`}function he(e,t){let n=new Date(e);if(t===`day`)return new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);if(t===`week`){let e=(8-n.getDay())%7||7;return new Date(n.getFullYear(),n.getMonth(),n.getDate()+e)}return t===`month`?new Date(n.getFullYear(),n.getMonth()+1,1):t===`quarter`?new Date(n.getFullYear(),Math.floor(n.getMonth()/3)*3+3,1):new Date(n.getFullYear()+1,0,1)}function ge(e,t){return t===`day`?new Date(e.getFullYear(),e.getMonth(),e.getDate()+1):t===`week`?new Date(e.getFullYear(),e.getMonth(),e.getDate()+7):t===`month`?new Date(e.getFullYear(),e.getMonth()+1,1):t===`quarter`?new Date(e.getFullYear(),e.getMonth()+3,1):new Date(e.getFullYear()+1,0,1)}function _e(e,t){return t===`day`?e.getDay()===1:t===`week`?e.getDate()<=7:t===`month`?e.getMonth()%3==0:t!==`quarter`||e.getMonth()===0}function ve(e,t,n){let r=[],i=he(e.start,t);for(;i.getTime()<e.end&&r.length<400;)r.push(i),i=ge(i,t);let a=Array(r.length).fill(0);for(let e of n){let t=0,n=r.length;for(;t<n;){let i=t+n>>1;r[i].getTime()<e?t=i+1:n=i}t<a.length&&(a[t]+=1)}let o=Math.max(1,...a);return r.map((n,r)=>{let i=n.getTime();return{at:i,rho:de(e,i),major:_e(n,t),activity:a[r]/o}})}var ye=new Set([`project`,`projects`,`user`,`users`,`global`,`repo`,`app`,`pisper`,`general`,`misc`,`title`]);function be(e){let t=String(e||``).split(`.`).filter(Boolean);for(;t.length>1&&ye.has(t[0]);)t.shift();return t[0]||``}function P(e,t){let n=A(e.createdAt,t),r=A(e.validFrom,n);return{created:n,valid:r,appear:Math.max(n,r)}}function xe(e,t){if(!e.length)return{start:t-180*x,end:t};let n=1/0,r=t;for(let i of e){let{valid:e,appear:a}=P(i,t);n=Math.min(n,e,a),a<=t&&(r=Math.max(r,a))}let i=Math.max(x,r-n);return{start:Math.min(n-Math.max(i*.02,x/4),r-7*x),end:r}}function Se(e){let t=new Map,n=e.map(e=>be(e.topicKey));e.forEach((e,r)=>{let i=`${e.spaceId}\u0000${n[r]}`,a=t.get(i);a?a.push(r):t.set(i,[r])});let r=Math.max(2,Math.ceil(e.length*.012)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Map,s=new Map,c=[...t.entries()].sort((e,t)=>t[1].length-e[1].length||e[0].localeCompare(t[0]));for(let[t,n]of c){let[i,c]=t.split(`\0`),l=s.get(i)||0;if(c&&n.length>=r&&l<16){s.set(i,l+1),a(i,{key:t,label:c,kind:`topic`,spaceId:i,members:n});continue}for(let t of n){let n=`${i}\u0000type:${e[t].type}`,r=o.get(n);r?r.push(t):o.set(n,[t])}}for(let[e,t]of o){let[n,r]=e.split(`\0`);a(n,{key:e,label:r.slice(5),kind:`type`,spaceId:n,members:t})}return i}function Ce(e,t,n){let r=Se(e),i=[...r.keys()].sort((e,t)=>e===`global`?-1:t===`global`?1:O(e)-O(t)),a=[],o=new Int16Array(e.length),s=new Float32Array(e.length),c=[],l=i.length>1?.09:0,u=i.reduce((e,t)=>e+(r.get(t)?.length||0),0),d=Math.min(.022,S*.25/Math.max(1,u)),f=e=>(r.get(e)||[]).reduce((e,t)=>e+Math.sqrt(t.members.length)+.6,0),p=i.reduce((e,t)=>e+f(t),0)||1,m=S-l*i.length-d*u,h=-Math.PI/2+l/2;for(let u of i){let i=[...r.get(u)||[]].sort((e,t)=>O(e.key)-O(t.key)),f=h;for(let n of i){let r=m*(Math.sqrt(n.members.length)+.6)/p,i=a.length;a.push({key:n.key.split(`\0`)[1],label:n.label,kind:n.kind,spaceId:u,start:h,end:h+r,count:n.members.length});let c=[...n.members].sort((n,r)=>t[n]-t[r]||e[n].id.localeCompare(e[r].id)),l=ue(n.key);c.forEach((e,t)=>{o[e]=i;let n=(l+t*.61803398875)%1;s[e]=h+r*(.05+.9*n)}),h+=r+d}c.push({spaceId:u,name:n.find(e=>e.id===u)?.name||u,start:f,end:h-d}),h+=l}return{sectors:a,sectorOf:o,theta:s,spaceArcs:i.length>1?c:[]}}function we(e){return Float64Array.from(e).sort()}function Te(e,{histogramBins:t=160}={}){let n=A(e.now,Date.now()),r=[...e.facts].sort((e,t)=>e.id.localeCompare(t.id)),i=r.length,a=xe(r,n),o=a.end-a.start,s=Math.max(x,o*.015),c=new Map(r.map((e,t)=>[e.id,t])),l=new Float64Array(i),u=new Float64Array(i),d=new Float64Array(i).fill(1/0),f=new Float64Array(i).fill(1/0),p=new Int32Array(i).fill(-1),m=new Uint8Array(i),h=new Uint8Array(i),g=new Map;r.forEach((e,t)=>{let{created:r,valid:i,appear:a}=P(e,n);l[t]=i,u[t]=a;let o=le.indexOf(e.type);h[t]=o>=0?o:le.indexOf(`concept`);let d=0;e.pinned&&(d|=1),e.tainted&&(d|=2),e.status===`stale`&&(d|=8),r-i>s&&(d|=4),m[t]=d;let f=e.supersededBy?c.get(e.supersededBy):void 0;if(f!==void 0&&f!==t){p[t]=f;let e=g.get(f);e?e.push(t):g.set(f,[t])}}),r.forEach((e,t)=>{let n=Math.max(A(e.supersededAt,-1/0),A(e.validTo,-1/0));if(Number.isFinite(n))d[t]=Math.max(n,u[t]);else if(e.status===`superseded`){let e=p[t]>=0?u[p[t]]:a.end;d[t]=Math.max(e,u[t])}let r=A(e.archivedAt,NaN)||(e.status===`archived`?a.end:NaN);Number.isFinite(r)&&(f[t]=Math.max(r,u[t]))});let{sectors:ee,sectorOf:te,theta:_,spaceArcs:v}=Ce(r,u,e.spaces),y=new Float32Array(i),ne=new Float32Array(i),b=new Float32Array(i),re=new Float32Array(i),C=new Float32Array(i),ie=new Float32Array(i),w=new Float32Array(i);r.forEach((e,t)=>{y[t]=de(a,l[t]),ne[t]=M(_[t],y[t]),b[t]=N(_[t],y[t]);let n=k(Number(e.importance)||0),r=k((Number(e.authority)||0)/100);C[t]=.16+.84*n**1.5,ie[t]=(.4+.22*r+.38*n)*(e.tainted?.6:1),re[t]=.016+.105*n**1.5+(e.pinned?.03:0),w[t]=ue(e.id)*S});let T=[];r.forEach((e,t)=>{Number.isFinite(d[t])&&T.push({at:d[t],from:t,to:p[t]})}),T.sort((e,t)=>e.at-t.at||e.from-t.from);let E=Math.max(1,t),ae=new Uint16Array(E),oe=new Uint16Array(E),se=e=>Math.min(E-1,Math.floor(k((e-a.start)/o)*E));for(let e=0;e<i;e+=1)u[e]<=a.end&&(ae[se(u[e])]+=1);for(let e of T)e.at<=a.end&&(oe[se(e.at)]+=1);let D=[...u],ce=[],O=[];for(let e=0;e<i;e+=1){let t=Math.min(d[e],f[e]);Number.isFinite(t)&&ce.push(t),Number.isFinite(f[e])&&O.push(f[e])}let fe=e.digests.map(e=>{let t=A(e.windowEnd,a.end),n=A(e.windowStart,t),r=v.find(t=>t.spaceId===e.spaceId),i=r?.start??-Math.PI,o=(r?.end??Math.PI)-i,s=o*(e.level===`month`?.16:e.level===`week`?.085:.045),c=i+ue(e.id)*Math.max(0,o-s);return{id:e.id,level:e.level,at:t,rho:de(a,(n+t)/2),start:c,end:c+s}}),j=me(a);return{facts:r,count:i,indexById:c,domain:a,unit:j,rings:ve(a,j,D),bornWindow:Math.max(o*.012,1),validAt:l,appearAt:u,replacedAt:d,archivedAt:f,theta:_,rho:y,x:ne,y:b,lift:re,size:C,brightness:ie,phase:w,typeIndex:h,sector:te,flags:m,successor:p,predecessors:g,replacements:T,sectors:ee,spaceArcs:v,digests:fe,histogram:ae,histogramReplacements:oe,truncated:!!e.truncated,sortedAppear:we(D),sortedEnded:we(ce),sortedArchived:we(O)}}function Ee(e,t,n){return n<e.appearAt[t]?0:n>=e.archivedAt[t]?3:n>=e.replacedAt[t]?2:1}function De(e,t,n,r=e.bornWindow){let i=Ee(e,t,n);return i===0?`hidden`:i===3?`archived`:i===2?`superseded`:n-e.appearAt[t]<r?`born`:`active`}function Oe(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function ke(e,t){let n=Oe(e.sortedAppear,t),r=Oe(e.sortedEnded,t),i=Oe(e.sortedArchived,t);return{active:n-r,superseded:r-i,archived:i,known:n}}function Ae(e,t){let n=new Set([t]),r=[],i=[t];for(;i.length;)for(let t of e.predecessors.get(i.pop())||[])n.has(t)||(n.add(t),r.push(t),i.push(t));let a=[],o=e.successor[t];for(;o>=0&&!n.has(o);)n.add(o),a.push(o),o=e.successor[o];return[...r,t,...a].sort((t,n)=>e.appearAt[t]-e.appearAt[n]||t-n)}function je(e){return Math.min(E,Math.max(T,e))}function Me(e,t){return e<720&&t>=oe?ae:1}function Ne(e){let t=k((e-1)/.5);return t*t*(3-2*t)}function Pe(e,t){return Math.max(1,e/t)*se}function F(e,t){let n=k(e/Math.max(t,.001));return D+.6599999999999999*n*n*(3-2*n)}function Fe(e,t,n){return je(e*n/Math.max(1,t))}function Ie(e,t){return e.start+(e.end-e.start)*k(t/w)}function Le(e,t){let n=Math.max(1,e.end-e.start);return Math.round(k((t-e.start)/n)*w)}function Re(e,t=ce){let n=k(e/t);return n<.5?4*n*n*n:1-(-2*n+2)**3/2}var I=Math.PI*2,ze=144,L=72,Be=.2,R=96,z=620,B=55e5,Ve=[{inner:.965,alpha:.05},{inner:.9,alpha:.032},{inner:.78,alpha:.018}],V=.0012,He=.6,Ue={decision:[255,196,92],preference:[186,164,255],fact:[176,214,255],concept:[104,176,255],risk:[255,104,158],file:[92,226,176],task:[92,222,240]},H=[255,96,44],U=[96,118,164],We=[156,164,178],W=[236,208,164],Ge=[255,232,192],Ke=[255,176,104],qe=[255,236,204],G=[255,206,138],K=[255,222,180],Je=[176,202,255],q=([e,t,n],r=1)=>`rgba(${e}, ${t}, ${n}, ${r})`;function J(e,t,n){let r=Math.min(1,Math.max(0,(e-t)/(n-t)));return r*r*(3-2*r)}function Y(e,t){let n=document.createElement(`canvas`);return n.width=Math.max(1,Math.round(e)),n.height=Math.max(1,Math.round(t)),n}function Ye([e,t,n]){let r=Y(R,R),i=r.getContext(`2d`);if(!i)return r;let a=R/2,o=i.createRadialGradient(a,a,0,a,a,a),s=r=>[255+(e-255)*r,255+(t-255)*r,255+(n-255)*r],c=(e,t)=>{let[n,r,i]=s(e);return`rgba(${n|0}, ${r|0}, ${i|0}, ${t})`};return o.addColorStop(0,c(.12,1)),o.addColorStop(.08,c(.5,.96)),o.addColorStop(.16,c(1,.62)),o.addColorStop(.3,c(1,.22)),o.addColorStop(.56,c(1,.06)),o.addColorStop(1,c(1,0)),i.fillStyle=o,i.fillRect(0,0,R,R),r}function Xe([e,t,n]){let r=Y(R,R),i=r.getContext(`2d`);if(!i)return r;let a=R/2,o=i.createRadialGradient(a,a,0,a,a,a);return o.addColorStop(0,`rgba(${e}, ${t}, ${n}, 0.55)`),o.addColorStop(.35,`rgba(${e}, ${t}, ${n}, 0.16)`),o.addColorStop(.7,`rgba(${e}, ${t}, ${n}, 0.035)`),o.addColorStop(1,`rgba(${e}, ${t}, ${n}, 0)`),i.fillStyle=o,i.fillRect(0,0,R,R),r}var Ze=class{canvas;ctx;camera={yaw:0,tilt:.92,zoom:1,rim:0};quality;scene=null;width=1;height=1;dpr=1;maxDpr=2;insets={top:0,right:0,bottom:0,left:0};targetInsets={top:0,right:0,bottom:0,left:0};typeSprites;emberSprite;archiveSprite;untrustedSprite;pulseSprite;coreSprite;discSprite;pinnedHalo;background=null;bloomA=null;bloomB=null;ringPaths=[];grainPaths=[];frontierPath=new Float32Array(288);rimPath=new Float32Array(288);bandPaths=Ve.map(()=>new Float32Array(288));screenX=new Float32Array;screenY=new Float32Array;screenR=new Float32Array;liftNow=new Float32Array;worldX=new Float32Array;worldY=new Float32Array;morphX=null;morphY=null;morphStart=0;slowWindows=0;chainMask=new Uint8Array;ringLabels=[];sectorOrder=[];selected=-1;selectedSector=-1;hovered=-1;ringFormatter=()=>``;dust;rippleQueue=new Int32Array(48);lateQueue=new Int32Array(24);typeCss;ambientPulses=[];nextAmbientPulse=0;frameTimes=0;frameCount=0;px=0;py=0;ps=1;cx=0;cy=0;unit=1;cosYaw=1;sinYaw=0;cosTilt=1;sinTilt=0;constructor(e,{quality:t=3}={}){this.canvas=e;let n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`canvas 2d unavailable`);this.ctx=n,this.quality=t,this.typeSprites=le.map(e=>Ye(Ue[e])),this.typeCss=le.map(e=>q(Ue[e])),this.emberSprite=Ye(H),this.archiveSprite=Ye(U),this.untrustedSprite=Ye(We),this.pulseSprite=Ye(qe),this.coreSprite=Xe(G),this.discSprite=Xe([206,158,104]),this.pinnedHalo=Xe(Ge),this.dust=new Float32Array(1e3);let r=20261105,i=()=>(r=Math.imul(r,1664525)+1013904223>>>0,r/4294967296);for(let e=0;e<200;e+=1){let t=i()*I,n=.08+Math.sqrt(i())*1.42;this.dust[e*5]=Math.cos(t)*n,this.dust[e*5+1]=Math.sin(t)*n,this.dust[e*5+2]=(i()-.35)*.42,this.dust[e*5+3]=i()*I,this.dust[e*5+4]=.15+i()*.55}}setRingFormatter(e){this.ringFormatter=e,this.refreshLabels()}setScene(e,{animate:t=!1,now:n=0}={}){let r=this.scene,i=this.worldX,a=this.worldY;if(this.scene=e,this.ambientPulses=[],this.morphX=null,this.morphY=null,!e)return!1;let o=!1;if(t&&r&&r.count&&e.count){let t=Float32Array.from(e.x),s=Float32Array.from(e.y),c=0;e.facts.forEach((e,n)=>{let o=r.indexById.get(e.id);o!==void 0&&(t[n]=i[o],s[n]=a[o],c+=1)}),c>=Math.max(1,e.count*.3)&&(this.morphX=t,this.morphY=s,this.morphStart=n,o=!0)}return this.worldX=Float32Array.from(this.morphX??e.x),this.worldY=Float32Array.from(this.morphY??e.y),this.screenX=new Float32Array(e.count),this.screenY=new Float32Array(e.count),this.screenR=new Float32Array(e.count),this.liftNow=new Float32Array(e.count),this.chainMask=new Uint8Array(e.count),this.ringPaths=e.rings.map(e=>{let t=new Float32Array(288);return this.fillRingPath(t,e.rho),t}),this.fillRingPath(this.rimPath,1),this.grainPaths=this.buildGrain(),this.sectorOrder=e.sectors.map((e,t)=>({sector:e,index:t})).filter(({sector:e})=>e.kind===`topic`).sort((e,t)=>t.sector.count-e.sector.count).slice(0,10).map(e=>e.index),this.refreshLabels(),this.setSelection(this.selected<e.count?this.selected:-1),this.hovered=-1,o}buildGrain(){let e=[],t=7;for(let n=.07;n<1;n+=.0115){t=Math.imul(t,1664525)+1013904223>>>0;let r=((t>>>8)/16777216-.5)*.006,i=new Float32Array(144);for(let e=0;e<L;e+=1){let t=e/L*I;i[e*2]=M(t,n+r),i[e*2+1]=N(t,n+r)}e.push({rho:n+r,path:i})}return e}refreshLabels(){this.ringLabels=this.scene?this.scene.rings.map(e=>this.ringFormatter(e.at)):[]}setSelection(e){let{scene:t}=this;if(this.selected=e,this.chainMask.fill(0),this.selectedSector=-1,!t||e<0||e>=t.count){this.selected=-1;return}for(let n of Ae(t,e))this.chainMask[n]=1;this.selectedSector=t.sector[e]}setHover(e){this.hovered=e}resize(e,t,n){let r=Math.max(1,e),i=Math.max(1,t);(r!==this.width||i!==this.height||n!==this.maxDpr)&&(this.width=r,this.height=i,this.maxDpr=n,this.applyResolution())}setInsets(e,{animate:t=!1}={}){this.targetInsets=e,t||(this.insets=e)}get settling(){let{insets:e,targetInsets:t}=this;return e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom||e.left!==t.left}stepInsets(){let e=(e,t)=>Math.abs(t-e)<.5?t:e+(t-e)*.14,{insets:t,targetInsets:n}=this;this.settling&&(this.insets={top:e(t.top,n.top),right:e(t.right,n.right),bottom:e(t.bottom,n.bottom),left:e(t.left,n.left)})}applyResolution(){let e=typeof devicePixelRatio==`number`?devicePixelRatio:1,t=this.quality===1?1:this.maxDpr,n=Math.sqrt(B/(this.width*this.height));this.dpr=Math.max(1,Math.min(e||1,t,n)),this.canvas.width=Math.max(1,Math.round(this.width*this.dpr)),this.canvas.height=Math.max(1,Math.round(this.height*this.dpr)),this.background=this.paintBackground(),this.bloomA=Y(this.canvas.width/4,this.canvas.height/4),this.bloomB=Y(this.canvas.width/10,this.canvas.height/10)}noteFrameInterval(e){if(this.frameTimes+=e,this.frameCount+=1,this.frameCount<45)return;let t=this.frameTimes/this.frameCount;this.frameTimes=0,this.frameCount=0,this.slowWindows=t>30?this.slowWindows+1:0,this.slowWindows>=2&&this.quality>1&&(this.slowWindows=0,--this.quality,this.applyResolution())}paintBackground(){let e=Y(Math.min(1024,this.width),Math.min(1024,this.height)),t=e.getContext(`2d`);if(!t)return e;let{width:n,height:r}=e;t.fillStyle=`#05060a`,t.fillRect(0,0,n,r);let i=this.layoutCenter(),a=t.createRadialGradient(i.x/this.width*n,i.y/this.height*r,0,i.x/this.width*n,i.y/this.height*r,Math.max(n,r)*.72);return a.addColorStop(0,`rgba(30, 27, 32, 0.8)`),a.addColorStop(.42,`rgba(10, 13, 22, 0.7)`),a.addColorStop(1,`rgba(3, 4, 8, 0)`),t.fillStyle=a,t.fillRect(0,0,n,r),e}layoutCenter(){let{top:e,bottom:t,left:n,right:r}=this.insets;return{x:n+(this.width-n-r)/2,y:e+(this.height-e-t)/2}}fillRingPath(e,t){for(let n=0;n<ze;n+=1){let r=n/ze*I;e[n*2]=M(r,t),e[n*2+1]=N(r,t)}}project(e,t,n){let r=e*this.cosYaw-t*this.sinYaw,i=e*this.sinYaw+t*this.cosYaw,a=1/(1-Be*(i*this.sinTilt+n*this.cosTilt));this.px=this.cx+this.unit*r*a,this.py=this.cy+this.unit*(i*this.cosTilt-n*this.sinTilt)*a,this.ps=a}traceRing(e){let{ctx:t}=this;for(let n=0;n<ze;n+=1)this.project(e[n*2],e[n*2+1],0),n===0?t.moveTo(this.px,this.py):t.lineTo(this.px,this.py);t.closePath()}applyCamera(e){let{camera:t}=this;this.stepInsets(),this.cosYaw=Math.cos(t.yaw),this.sinYaw=Math.sin(t.yaw),this.cosTilt=Math.cos(t.tilt),this.sinTilt=Math.sin(t.tilt);let{top:n,bottom:r,left:i,right:a}=this.insets,o=Math.max(40,this.width-i-a),s=Math.max(40,this.height-n-r),c=this.layoutCenter(),l=1+Be*this.sinTilt*.55,u=Math.min(o/(2.08*l),s/(2.08*Math.max(this.cosTilt,.34)*l+.14*this.sinTilt)),d=1+.72*(1-e)**2;this.unit=u*t.zoom*d,this.cx=c.x,this.cy=c.y+this.sinTilt*this.unit*.02;let f=J(e,.35,.75),p=t.rim*f;if(p>0){let t=this.unit*e*this.cosTilt/(1-Be*e*this.sinTilt),r=n+s*.94-t;this.cy+=(Math.min(this.cy,r)-this.cy)*p}}pick(e,t,n,r){let{scene:i}=this;if(!i)return-1;let a=-1,o=n*n;for(let n=0;n<i.count;n+=1){let s=this.screenX[n];if(Number.isNaN(s))continue;let c=s-e,l=this.screenY[n]-t,u=c*c+l*l;(r>=i.replacedAt[n]||r>=i.archivedAt[n])&&(u*=1.8),u<o&&(o=u,a=n)}return a}screenPosition(e){let t=this.screenX[e];return t===void 0||Number.isNaN(t)?null:{x:t,y:this.screenY[e]}}draw(e){let{ctx:t,scene:n,dpr:r}=this;t.setTransform(r,0,0,r,0,0),t.globalCompositeOperation=`source-over`,t.globalAlpha=1,this.background?t.drawImage(this.background,0,0,this.width,this.height):(t.fillStyle=`#05060a`,t.fillRect(0,0,this.width,this.height));let i=n?de(n.domain,e.at):1;this.applyCamera(i),t.globalCompositeOperation=`lighter`,t.lineCap=`round`,t.lineJoin=`round`,this.drawDust(e),n&&(this.stepMorph(n,e),this.drawDiscBody(n,e,i),this.drawNewestBand(e,i),this.drawDigests(n,e,i),this.computePositions(n,e),this.drawThreads(n,e,i),this.drawStems(n,e,i),this.drawFacts(n,e,i),this.drawPulses(n,e),this.drawFrontier(e,i)),this.applyBloom(),t.setTransform(r,0,0,r,0,0),t.globalCompositeOperation=`source-over`,t.globalAlpha=1,n&&this.drawLabels(n,e,i),e.fade<1&&(t.globalAlpha=1-e.fade,t.fillStyle=`#05060a`,t.fillRect(0,0,this.width,this.height),t.globalAlpha=1)}stepMorph(e,t){let{morphX:n,morphY:r}=this;if(!n||!r)return;let i=Math.min(1,Math.max(0,(t.wall-this.morphStart)/z)),a=i*i*(3-2*i);for(let t=0;t<e.count;t+=1)this.worldX[t]=n[t]+(e.x[t]-n[t])*a,this.worldY[t]=r[t]+(e.y[t]-r[t])*a;i>=1&&(this.morphX=null,this.morphY=null)}get morphing(){return this.morphX!==null}drawDust(e){let{ctx:t,dust:n}=this,r=this.quality===3?200:this.quality===2?110:40,i=e.ambient?e.wall*12e-6:0;for(let a=0;a<r;a+=1){let r=a*5,o=.55+a%7*.05,s=Math.cos(i*o),c=Math.sin(i*o),l=n[r]*s-n[r+1]*c,u=n[r]*c+n[r+1]*s;if(this.project(l,u,n[r+2]),this.px<-4||this.py<-4||this.px>this.width+4||this.py>this.height+4)continue;let d=e.ambient?.55+.45*Math.sin(e.wall*7e-4+n[r+3]):.7,f=(.7+n[r+4]*1.1)*this.ps;t.globalAlpha=n[r+4]*d*.5,t.fillStyle=q(a%3==0?Je:K),t.fillRect(this.px-f/2,this.py-f/2,f,f)}t.globalAlpha=1}drawDiscBody(e,t,n){let{ctx:r}=this,i=this.selected>=0?.55:1;this.project(M(0,0),N(0,0),0);let a=this.px,o=this.py,s=1-.72*J(n,.2,.7),c=this.unit*Math.max(n,.1)*1.32;if(r.globalAlpha=.5*s*i,r.drawImage(this.discSprite,this.cx-c,this.cy-c*this.cosTilt,c*2,c*2*this.cosTilt),n<.995&&(r.beginPath(),this.traceRing(this.rimPath),r.globalAlpha=.06,r.strokeStyle=q(W),r.lineWidth=.8,r.stroke()),this.quality>=2){let e=this.quality===3?1:2;r.strokeStyle=q(W),r.lineWidth=.5;let t=n*He;for(let a of[!1,!0]){r.globalAlpha=(a?.075:.03)*e*i,r.beginPath();for(let i=0;i<this.grainPaths.length;i+=e){let{rho:e,path:o}=this.grainPaths[i];if(e>n)break;if(e>=t===a){for(let e=0;e<L;e+=1)this.project(o[e*2],o[e*2+1],0),e===0?r.moveTo(this.px,this.py):r.lineTo(this.px,this.py);r.closePath()}}r.stroke()}}let{rings:l}=e,u=-1;for(let e=0;e<l.length&&!(l[e].at>t.at);e+=1)u=e;r.fillStyle=q(W);for(let e=0;e<=u;e+=2){let t=l[e];r.beginPath(),this.traceRing(this.ringPaths[e]),e>0&&this.traceRing(this.ringPaths[e-1]),r.globalAlpha=(.012+.03*t.activity)*i*F(t.rho,n),r.fill(`evenodd`)}r.strokeStyle=q(W);for(let e=0;e<=u;e+=1){let t=l[e];r.beginPath(),this.traceRing(this.ringPaths[e]),r.globalAlpha=(.11+.17*t.activity+(t.major?.13:0))*i*F(t.rho,n),r.lineWidth=t.major?1:.65,r.stroke()}let d=this.knownCount(e,t.at),f=t.ambient?1+.08*Math.sin(t.wall*.0011):1,p=this.unit*(.17+.028*Math.log1p(d))*f;r.globalAlpha=.62*s*i,r.drawImage(this.coreSprite,a-p,o-p,p*2,p*2),r.globalAlpha=1}drawNewestBand(e,t){let{ctx:n}=this,r=(e.ambient?.82+.18*Math.sin(e.wall*V):.9)*(e.moving?1.2:1)*(this.selected>=0?.35:1),i=this.quality===1?1:Ve.length;n.fillStyle=q(W),this.fillRingPath(this.frontierPath,t);for(let e=0;e<i;e+=1){let{inner:i,alpha:a}=Ve[e],o=this.bandPaths[e];this.fillRingPath(o,t*i),n.beginPath(),this.traceRing(this.frontierPath),this.traceRing(o),n.globalAlpha=a*r,n.fill(`evenodd`)}n.globalAlpha=1}knownCount(e,t){let n=0,r=e.sortedAppear.length;for(;n<r;){let i=n+r>>1;e.sortedAppear[i]<=t?n=i+1:r=i}return n}drawDigests(e,t,n){let{ctx:r}=this;if(!e.digests.length)return;r.strokeStyle=q(Ge),r.lineWidth=1.25;let i=n*He;for(let n of[!1,!0]){r.globalAlpha=this.selected>=0?.1:n?.34:.14,r.beginPath();for(let a of e.digests){if(a.at>t.at||a.rho>=i!==n)continue;let e=Math.max(4,Math.ceil((a.end-a.start)/I*ze));for(let t=0;t<=e;t+=1){let n=a.start+(a.end-a.start)*t/e;this.project(M(n,a.rho),N(n,a.rho),0),t===0?r.moveTo(this.px,this.py):r.lineTo(this.px,this.py)}}r.stroke()}r.globalAlpha=1}computePositions(e,t){let{at:n,effectWindow:r}=t,{appearAt:i,replacedAt:a,archivedAt:o,lift:s,count:c}=e,{worldX:l,worldY:u}=this;for(let e=0;e<c;e+=1){if(n<i[e]){this.screenX[e]=NaN;continue}let t=s[e],c=Math.min(a[e],o[e]);if(n>=c){let i=Math.min(1,(n-c)/(r*1.6)),a=i*i*(3-2*i);t=n>=o[e]?s[e]*(1-a)-.035*a:s[e]*(1-a)}this.liftNow[e]=t,this.project(l[e],u[e],t),this.screenX[e]=this.px,this.screenY[e]=this.py,this.screenR[e]=this.ps}}threadControl(e,t){let n=this.worldX[e],r=this.worldY[e],i=this.worldX[t],a=this.worldY[t],o=i-n,s=a-r,c=Math.sqrt(o*o+s*s);this.project((n+i)/2,(r+a)/2,(this.liftNow[e]+this.liftNow[t])/2+.018+c*.46)}drawThreads(e,t,n){let{ctx:r,selected:i,chainMask:a}=this,{at:o}=t;r.strokeStyle=q(Ke),r.lineWidth=.95;let s=n*He;for(let t of[!1,!0]){r.globalAlpha=i>=0?.06:t?.42:.16,r.beginPath();for(let n of e.replacements){if(n.at>o)break;n.to<0||o<e.appearAt[n.to]||i>=0&&a[n.from]&&a[n.to]||e.rho[n.to]>=s===t&&(this.threadControl(n.from,n.to),r.moveTo(this.screenX[n.from],this.screenY[n.from]),r.quadraticCurveTo(this.px,this.py,this.screenX[n.to],this.screenY[n.to]))}r.stroke()}if(i>=0){r.strokeStyle=q(Ge),r.lineWidth=1.5,r.globalAlpha=.8,r.beginPath();for(let t of e.replacements){if(t.at>o)break;t.to<0||o<e.appearAt[t.to]||!a[t.from]||!a[t.to]||(this.threadControl(t.from,t.to),r.moveTo(this.screenX[t.from],this.screenY[t.from]),r.quadraticCurveTo(this.px,this.py,this.screenX[t.to],this.screenY[t.to]))}r.stroke()}r.globalAlpha=1}drawStems(e,t,n){if(this.sinTilt<.2||this.quality<2||this.quality===2&&e.count>800)return;let{ctx:r,selected:i}=this,{at:a}=t,{appearAt:o,replacedAt:s,archivedAt:c,count:l}=e,{worldX:u,worldY:d}=this;r.strokeStyle=q(W),r.lineWidth=.6;let f=n*He;for(let t of[!1,!0]){r.globalAlpha=i>=0?.05:t?.3:.12,r.beginPath();for(let n=0;n<l;n+=1)a<o[n]||a>=s[n]||a>=c[n]||e.rho[n]>=f===t&&(this.project(u[n],d[n],0),r.moveTo(this.px,this.py),r.lineTo(this.screenX[n],this.screenY[n]));r.stroke()}if(this.quality===3&&l<=1500&&i<0){let t=Math.max(.2,this.cosTilt);for(let i=0;i<l;i+=1){if(a<o[i]||a>=s[i]||a>=c[i])continue;this.project(u[i],d[i],0);let l=12*(.5+e.size[i])*this.ps;r.globalAlpha=.2*F(e.rho[i],n),r.drawImage(this.typeSprites[e.typeIndex[i]],this.px-l/2,this.py-l*t/2,l,l*t)}}r.globalAlpha=1}drawFacts(e,t,n){let{ctx:r,selected:i,selectedSector:a,chainMask:o,hovered:s}=this,{at:c,effectWindow:l,wall:u,ambient:d}=t,{appearAt:f,replacedAt:p,archivedAt:m,size:h,brightness:g,phase:ee,typeIndex:te,flags:_,count:v}=e,y=Math.min(1.75,Math.max(.74,(420/Math.max(1,v))**.26)),ne=Math.min(1.35,Math.max(.7,this.unit/330))*y,b=this.quality===3?48:this.quality===2?24:8,re=v>2200||v>800&&this.quality<3?.34:this.quality===1&&v>300?.26:0,x=0,S=0;for(let y=0;y<v;y+=1){if(c<f[y])continue;let v=this.screenX[y],C=this.screenY[y],ie=this.screenR[y],w=1;i>=0&&(w=o[y]?1.3:e.sector[y]===a?.5:.11),y===s&&(w=Math.max(w,1.5)),w*=.62+.42*Math.min(1,Math.max(0,(ie-.84)/.3));let T=i>=0||y===s||_[y]&1?1:F(e.rho[y],n),E=(6+19*h[y])*ne*ie*(.72+.28*T),ae=Math.min(p[y],m[y]);if(c>=m[y]){let e=Math.min(1,(c-m[y])/(l*1.6)),t=E*(.62+.25*(1-e));r.globalAlpha=Math.min(1,(.2*T+.4*(1-e))*w),r.drawImage(this.archiveSprite,v-t/2,C-t/2,t,t);continue}if(c>=ae){let e=Math.min(1,(c-ae)/l),t=d?.82+.18*Math.sin(u*.0016+ee[y]):.9,n=E*(.86+.9*(1-e)*(1-e));if(e<1){r.globalAlpha=Math.min(1,(1-e)*g[y]*w);let t=this.spriteFor(y,te,_);r.drawImage(t,v-n/2,C-n/2,n,n)}r.globalAlpha=Math.min(1,(.62*T+.38*(1-e))*t*w),r.drawImage(this.emberSprite,v-n/2,C-n/2,n,n);continue}let oe=c-f[y],se=oe<l?(1-oe/l)*t.effectGain:0;if(h[y]<re&&se===0&&y!==s&&i<0){let e=1.7*ie;r.globalAlpha=Math.min(1,g[y]*w*T),r.fillStyle=this.typeCss[te[y]],r.fillRect(v-e/2,C-e/2,e,e);continue}let D=.08+.1*T,ce=d?1-D+D*Math.sin(u*.0013+ee[y]):.95,le=g[y]*ce*w*T;_[y]&8&&(le*=.72);let O=E*(1+2.4*se*se);r.globalAlpha=Math.min(1,le+se*.5);let ue=this.spriteFor(y,te,_);if(r.drawImage(ue,v-O/2,C-O/2,O,O),_[y]&1){let e=E*2.9;r.globalAlpha=Math.min(1,.5*w*ce),r.drawImage(this.pinnedHalo,v-e/2,C-e/2,e,e)}se>0&&(x<b&&(this.rippleQueue[x++]=y),_[y]&4&&S<this.lateQueue.length&&(this.lateQueue[S++]=y))}r.globalAlpha=1,this.drawRipples(e,t,x),this.drawLateBeams(e,t,S),this.drawSelectionMarks(e,t)}spriteFor(e,t,n){return n[e]&2?this.untrustedSprite:this.typeSprites[t[e]]}drawRipples(e,t,n){if(!n)return;let{ctx:r}=this;r.lineWidth=1;for(let i=0;i<n;i+=1){let n=this.rippleQueue[i],a=(t.at-e.appearAt[n])/t.effectWindow;if(a<0||a>=1)continue;this.project(this.worldX[n],this.worldY[n],0);let o=this.unit*(.006+.052*Math.sqrt(a))*this.ps;r.globalAlpha=(1-a)*(1-a)*.42*t.effectGain,r.strokeStyle=q(Ue[le[e.typeIndex[n]]]),r.beginPath(),r.ellipse(this.px,this.py,o,o*Math.max(.2,this.cosTilt),0,0,I),r.stroke()}r.globalAlpha=1}drawLateBeams(e,t,n){if(!n)return;let{ctx:r}=this,i=de(e.domain,t.at);r.strokeStyle=q(Ge),r.lineWidth=1.2;for(let a=0;a<n;a+=1){let n=this.lateQueue[a],o=(t.at-e.appearAt[n])/t.effectWindow;if(o<0||o>=1)continue;let s=e.theta[n];this.project(M(s,i),N(s,i),0),r.globalAlpha=(1-o)*.8*t.effectGain,r.beginPath(),r.moveTo(this.px,this.py),r.lineTo(this.screenX[n],this.screenY[n]),r.stroke()}r.globalAlpha=1}drawSelectionMarks(e,t){let{ctx:n,selected:r,hovered:i,chainMask:a}=this,o=(r,i,a)=>{r<0||r>=e.count||t.at<e.appearAt[r]||(n.globalAlpha=a,n.beginPath(),n.arc(this.screenX[r],this.screenY[r],i,0,I),n.stroke())};if(n.strokeStyle=q(Ge),n.lineWidth=1,r>=0)for(let t=0;t<e.count;t+=1)a[t]&&o(t,t===r?12:7,t===r?.95:.55);i>=0&&i!==r&&o(i,9,.7),n.globalAlpha=1}drawPulseAlong(e,t,n,r){let{ctx:i}=this;this.threadControl(e,t);let a=this.px,o=this.py,s=this.screenX[e],c=this.screenY[e],l=this.screenX[t],u=this.screenY[t],d=e=>{let t=1-e;this.px=t*t*s+2*t*e*a+e*e*l,this.py=t*t*c+2*t*e*o+e*e*u},f=Math.min(1,n*1.3),p=Math.max(0,f-.42),m=r*(n>.75?(1-n)/.25:1);i.strokeStyle=q(qe);for(let e=0;e<9;e+=1){let t=p+(f-p)*e/9,n=p+(f-p)*(e+1)/9;d(t);let r=this.px,a=this.py;d(n),i.globalAlpha=Math.min(1,((e+1)/9)**2*m),i.lineWidth=.7+1.5*((e+1)/9),i.beginPath(),i.moveTo(r,a),i.lineTo(this.px,this.py),i.stroke()}d(f);let h=20*Math.min(1.2,this.unit/300);i.globalAlpha=Math.min(1,m),i.drawImage(this.pulseSprite,this.px-h/2,this.py-h/2,h,h)}drawPulses(e,t){let{at:n,effectWindow:r,wall:i,ambient:a}=t,{replacements:o}=e;if(!o.length)return;let s=this.quality===3?36:this.quality===2?18:6,c=0,l=o.length;for(;c<l;){let e=c+l>>1;o[e].at<=n?c=e+1:l=e}let u=c,d=r*1.8,f=0;for(let r=u-1;r>=0&&f<s;--r){let i=o[r],a=(n-i.at)/d;if(a>=1)break;i.to<0||n<e.appearAt[i.to]||(t.effectGain>.02&&this.drawPulseAlong(i.from,i.to,a,t.effectGain),f+=1)}if(!a){this.ctx.globalAlpha=1;return}if(this.selected>=0){let e=0;for(let t of o){if(t.to<0||t.at>n||!this.chainMask[t.from]||!this.chainMask[t.to])continue;let r=((i*45e-5+e*.27)%1+1)%1;this.drawPulseAlong(t.from,t.to,r,.9),e+=1}}else if(u){if(i>=this.nextAmbientPulse&&this.ambientPulses.length<3){this.nextAmbientPulse=i+650+(Math.sin(i)+1)*500;let e=Math.floor(Math.abs(Math.sin(i*12.9898))*u)%u;this.ambientPulses.push({replacement:e,start:i})}for(let t=this.ambientPulses.length-1;t>=0;--t){let r=this.ambientPulses[t],a=(i-r.start)/1900,s=o[r.replacement];if(a>=1||!s||s.at>n){this.ambientPulses.splice(t,1);continue}s.to<0||n<e.appearAt[s.to]||this.drawPulseAlong(s.from,s.to,a,.55)}}this.ctx.globalAlpha=1}drawFrontier(e,t){let{ctx:n}=this,r=this.frontierPath;n.strokeStyle=q(Ge);let i=e.ambient?.78+.22*Math.sin(e.wall*V):.85,a=(e.moving?1.1:i)*(this.selected>=0?.5:1),o=this.quality===1?1:3;for(let e=0;e<o;e+=1)n.beginPath(),this.traceRing(r),e===o-1?(n.lineWidth=1.1,n.globalAlpha=.72*a):e===0?(n.lineWidth=9,n.globalAlpha=.035*a):(n.lineWidth=3.6,n.globalAlpha=.09*a),n.stroke();if(e.ambient&&this.quality>=2){let r=Math.min(46,this.unit*.11)*(e.moving?1.25:1);for(let i=0;i<3;i+=1){let o=e.wall*17e-5*(i===1?-1:1)+i*2.1;this.project(M(o,t),N(o,t),0),n.globalAlpha=(.32+.3*Math.max(0,Math.sin(e.wall*6e-4+i*2)))*a,n.drawImage(this.pulseSprite,this.px-r/2,this.py-r/2,r,r)}}n.globalAlpha=1}applyBloom(){let{ctx:e,canvas:t}=this;if(this.quality<2||!this.bloomA)return;let n=this.bloomA.getContext(`2d`);if(n){if(n.globalCompositeOperation=`copy`,n.imageSmoothingEnabled=!0,n.drawImage(t,0,0,this.bloomA.width,this.bloomA.height),e.setTransform(1,0,0,1,0,0),e.imageSmoothingEnabled=!0,e.globalCompositeOperation=`lighter`,e.globalAlpha=.34,e.drawImage(this.bloomA,0,0,t.width,t.height),this.quality>=3&&this.bloomB){let n=this.bloomB.getContext(`2d`);n&&(n.globalCompositeOperation=`copy`,n.imageSmoothingEnabled=!0,n.drawImage(this.bloomA,0,0,this.bloomB.width,this.bloomB.height),e.globalAlpha=.3,e.drawImage(this.bloomB,0,0,t.width,t.height))}e.globalAlpha=1}}drawLabels(e,t,n){let{ctx:r}=this;if(this.width<280||!e.count)return;r.textBaseline=`middle`,r.textAlign=`left`,r.font=`10.5px ui-sans-serif, system-ui, sans-serif`;let i=this.selected>=0?.45:1,a=Math.PI*.2-this.camera.yaw,o=1/0,s=1/0;for(let c=e.rings.length-1;c>=0;--c){let l=e.rings[c];if(l.at>t.at||!l.major||(this.project(M(a,l.rho),N(a,l.rho),0),Math.hypot(this.px-o,this.py-s)<34))continue;o=this.px,s=this.py,r.globalAlpha=.62*i*F(l.rho,n),r.fillStyle=q(W);let u=this.ringLabels[c]||``;r.fillText(u,Math.min(this.px+4,this.width-8-r.measureText(u).width),this.py)}let c=Math.min(1.09,n+.07),l=Math.min(1.14,n+.12);if(this.width>=560&&n>.32){r.textAlign=`center`;for(let t of this.sectorOrder){let i=e.sectors[t],a=(i.start+i.end)/2;if(e.spaceArcs.some(e=>e.name.includes(i.label)))continue;this.project(M(a,c),N(a,c),0);let o=(.14+.5*Math.min(1,Math.max(0,(this.ps-.86)/.24)))*Math.min(1,(n-.32)*4);this.selected>=0&&(o=t===this.selectedSector?.95:.1),r.globalAlpha=o,r.fillStyle=q(W),r.fillText(i.label.slice(0,18),this.px,this.py)}}if(e.spaceArcs.length){r.textAlign=`center`;for(let t of e.spaceArcs){let e=Math.max(6,Math.ceil((t.end-t.start)/I*ze));r.beginPath();for(let n=0;n<=e;n+=1){let i=t.start+(t.end-t.start)*n/e;this.project(M(i,l),N(i,l),0),n===0?r.moveTo(this.px,this.py):r.lineTo(this.px,this.py)}r.strokeStyle=q(W),r.lineWidth=1,r.globalAlpha=.34*i,r.stroke();let n=(t.start+t.end)/2;this.project(M(n,l+.035),N(n,l+.035),0),r.globalAlpha=.72*i,r.fillStyle=q(Ge),r.fillText(t.name.slice(0,22),this.px,this.py)}}r.globalAlpha=1}};function Qe(e,t,n,r,i){let a=e.getContext(`2d`);if(!a)return;let o=Math.min((typeof devicePixelRatio==`number`?devicePixelRatio:1)||1,2),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o));(e.width!==s||e.height!==c)&&(e.width=s,e.height=c),a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,r,i);let{histogram:l,histogramReplacements:u,domain:d}=t,f=l.length,p=Math.max(1,d.end-d.start),m=Math.min(1,Math.max(0,(n-d.start)/p))*r,h=1;for(let e=0;e<f;e+=1)h=Math.max(h,l[e]);let g=r/f,ee=i-5;for(let e=0;e<f;e+=1){let t=l[e],n=e*g,r=n+g/2<=m;if(t){let e=Math.max(1.5,Math.sqrt(t/h)*ee);a.fillStyle=r?q(W,.78):q(W,.2),a.fillRect(n+.5,i-e,Math.max(1,g-1),e)}if(u[e]){let t=Math.min(ee,3+u[e]*1.5);a.fillStyle=r?q(H,.95):q(H,.34),a.fillRect(n+g/2-.75,0,1.5,t)}}}var X=n(),$e=400,et=540,tt=880,nt=16,rt={colorScheme:`dark`,"--text":`rgba(246, 240, 228, 0.96)`,"--foreground":`rgba(246, 240, 228, 0.96)`,"--text-soft":`rgba(246, 240, 228, 0.86)`,"--text-secondary":`rgba(240, 232, 218, 0.74)`,"--text-muted":`rgba(232, 224, 208, 0.58)`,"--text-faint":`rgba(232, 224, 208, 0.38)`,"--surface-hover":`rgba(255, 244, 224, 0.1)`,"--surface-active":`rgba(255, 244, 224, 0.17)`,"--surface-muted":`rgba(255, 244, 224, 0.07)`,"--surface-subtle":`rgba(255, 244, 224, 0.1)`,"--stroke":`rgba(255, 244, 224, 0.13)`,"--stroke-soft":`rgba(255, 244, 224, 0.08)`,"--stroke-strong":`rgba(255, 244, 224, 0.22)`,"--solid":`rgba(255, 244, 224, 0.14)`,"--star":`rgba(255, 232, 192, 0.92)`,"--star-hover":`rgba(255, 240, 214, 1)`,"--key-bg":`rgba(255, 240, 214, 1)`,"--key-border":`rgba(255, 244, 224, 0.2)`,"--key-shadow":`0 0 14px rgba(255, 214, 150, 0.55)`,"--control-border":`rgba(255, 240, 214, 0.9)`,"--focus":`rgba(255, 222, 170, 1)`,"--focus-ring":`rgba(255, 222, 170, 0.32)`,"--danger":`rgba(255, 150, 130, 1)`,"--evo-panel":`rgba(13, 14, 19, 0.74)`,"--evo-line":`rgba(255, 244, 224, 0.13)`,"--evo-scrim":`rgba(5, 6, 10, 0.86)`,"--evo-scrim-clear":`rgba(5, 6, 10, 0)`,"--evo-base":`rgba(5, 6, 10, 1)`,"--evo-active":`rgba(255, 232, 192, 1)`},it=q(H),at=q(U),ot=24e3,st=[`0.5`,`1`,`2`],ct=-.38,lt=.94,ut=.68,dt=.24,ft=26e-6,pt=450,mt=2e4,ht=Math.PI*.62,gt=320,_t=30,vt=30,yt=7,bt=!1;function xt(e){let t=navigator.deviceMemory;return t!==void 0&&t<=2?1:e||t!==void 0&&t<=4?2:3}function St(e){let t=Math.min(1,Math.max(0,e));return t*t*(3-2*t)}var Ct=e=>e instanceof Error?e.message:String(e),wt=e=>e instanceof DOMException&&e.name===`AbortError`;function Tt({spaceId:e,refreshKey:t=0,selectedId:n=null,onSelect:i}){let{t:x,language:S}=r(),[C,ie]=(0,b.useState)(null),[w,T]=(0,b.useState)(!0),[E,ae]=(0,b.useState)(``),[oe,se]=(0,b.useState)(0),[D,ce]=(0,b.useState)(0),[O,ue]=(0,b.useState)(0),[k,A]=(0,b.useState)(!1),[de,fe]=(0,b.useState)(`1`),[j,pe]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),[me,he]=(0,b.useState)(null),[ge,_e]=(0,b.useState)(0),[ve,ye]=(0,b.useState)(0),be=(0,b.useRef)(null),P=(0,b.useRef)(null),xe=(0,b.useRef)(null),Se=(0,b.useRef)(null),Ce=(0,b.useRef)(null),we=(0,b.useRef)(null),Ee=(0,b.useRef)(null),Oe=(0,b.useRef)(null),F=(0,b.useRef)(null),I=(0,b.useRef)(null),ze=(0,b.useRef)(-1),L=(0,b.useRef)(-1),Be=(0,b.useRef)(`1`),R=(0,b.useRef)(0),z=(0,b.useRef)(0),B=(0,b.useRef)(`idle`),Ve=(0,b.useRef)(0),V=(0,b.useRef)(1),He=(0,b.useRef)(0),H=(0,b.useRef)(!0),U=(0,b.useRef)(0),We=(0,b.useRef)(!1),W=(0,b.useRef)(0),Ge=(0,b.useRef)(0),Ke=(0,b.useRef)(0),qe=(0,b.useRef)(0),G=(0,b.useRef)(ct),K=(0,b.useRef)(lt),Je=(0,b.useRef)(!1),J=(0,b.useRef)(null),Y=(0,b.useRef)(1),Ye=(0,b.useRef)(1),Xe=(0,b.useRef)(!1),Tt=(0,b.useRef)(null),Et=(0,b.useRef)(null),Dt=(0,b.useRef)(()=>{}),Ot=(0,b.useRef)(null),kt=(0,b.useRef)(!1),{ref:At,playing:jt}=re(),Mt=(0,b.useCallback)(e=>{P.current=e,At(e)},[At]),Nt=(0,b.useCallback)((e=!1)=>{if(!I.current)return;let t=performance.now();!e&&t-Ke.current<33||(Ke.current=t,ce(R.current))},[]),Pt=(0,b.useCallback)(e=>{U.current=0;let t=F.current;if(!t)return;let n=I.current,r=kt.current,i=W.current?Math.min(64,e-W.current):16;W.current=e;let a=!1;if(n){let{start:e,end:o}=n.domain,s=Math.max(1,o-e);if(B.current===`opening`){Ve.current+=i;let n=Re(Ve.current);R.current=e+s*n,t.camera.tilt=dt+(K.current-dt)*St(n*1.15),t.camera.yaw=G.current-1.3*(1-n)**2,a=!0,Ve.current>=6e3&&(R.current=o,B.current=`idle`,A(!1),Nt(!0))}else B.current===`play`&&(R.current+=i*s*Number(Be.current)/ot,a=!0,R.current>=o&&(R.current=o,B.current=`idle`,A(!1),Nt(!0)));let c=z.current,l=R.current-c;B.current!==`idle`||Math.abs(l)<s*2e-4?z.current=R.current:z.current=c+l*(1-Math.exp(-i/85)),z.current!==c&&(a=!0);let u=Math.abs(z.current-c)/Math.max(1,i),d=Math.min(s*.08,Math.max(s*.002,u*520)),f=d>V.current?90:420;r?V.current=s*.002:(V.current+=(d-V.current)*(1-Math.exp(-i/f)),Math.abs(d-V.current)>s*2e-4&&(a=!0))}let o=!!(Ot.current?.moved||Tt.current);if(!r&&!o&&B.current!==`opening`&&L.current<0&&ze.current<0&&(G.current+=i*ft),J.current!==null&&!o){let e=Math.atan2(Math.sin(J.current-G.current),Math.cos(J.current-G.current));Math.abs(e)<.002||r?(G.current=J.current,J.current=null):(G.current+=e*(1-Math.exp(-i/240)),a=!0)}let s=ze.current>=0,c=s?Pe(Y.current,Ye.current):Y.current,l=s?0:Ne(Y.current);if((Math.abs(t.camera.zoom-c)>.001||Math.abs(t.camera.rim-l)>.001)&&!r){let e=1-Math.exp(-i/(Tt.current?50:240));t.camera.zoom+=(c-t.camera.zoom)*e,t.camera.rim+=(l-t.camera.rim)*e,a=!0}else t.camera.zoom=c,t.camera.rim=l;t.settling&&(a=!0),B.current!==`opening`&&(t.camera.yaw=G.current);let u=Math.min(1,(e-He.current)/pt);(a||o)&&(qe.current=e);let d=e-qe.current>mt?66:t.quality===3?32:48;(a||H.current||o||u<1||t.morphing||!r&&e-Ge.current>=d)&&(t.draw({at:z.current,wall:e,effectWindow:V.current,effectGain:n?Math.min(1,Math.max(0,(V.current/(Math.max(1,n.domain.end-n.domain.start)*.002)-1.05)/1.6)):0,ambient:!r,fade:r?1:u,moving:B.current!==`idle`||o}),Ge.current=e,H.current=!1),r||t.noteFrameInterval(i),a&&Nt(),We.current&&(!r||a||u<1||H.current||t.morphing)?U.current=requestAnimationFrame(Pt):a||Nt(!0)},[Nt]),Z=(0,b.useCallback)(()=>{H.current=!0,We.current&&!U.current&&(U.current=requestAnimationFrame(Pt))},[Pt]),Ft=(0,b.useCallback)(()=>{let e=P.current;e&&(Ye.current=Me(e.clientWidth,I.current?.count??0),!Xe.current&&(Y.current=Ye.current,e.setAttribute(`data-zoom`,Y.current.toFixed(2))))},[]),It=(0,b.useCallback)(e=>{let t=je(e);Xe.current=!0,Y.current=t,P.current?.setAttribute(`data-zoom`,t.toFixed(2)),Z()},[Z]),Lt=(0,b.useCallback)(()=>{let e=F.current;B.current===`opening`&&e&&(e.camera.tilt=K.current,e.camera.yaw=G.current),B.current!==`idle`&&(B.current=`idle`,A(!1))},[]),Rt=(0,b.useCallback)(e=>{let t=I.current;t&&(Lt(),R.current=Math.min(t.domain.end,Math.max(t.domain.start,e)),Nt(!0),Z())},[Nt,Lt,Z]),zt=(0,b.useCallback)(()=>{let e=I.current;if(!e||!e.count)return;if(B.current!==`idle`){Lt(),Nt(!0),Z();return}let{start:t,end:n}=e.domain;R.current>=n-(n-t)*.002&&(R.current=t,z.current=t),B.current=`play`,A(!0),Z()},[Nt,Lt,Z]);(0,b.useLayoutEffect)(()=>{let e=be.current;if(!e)return;let t=e.closest(`[data-feature-scroller]`);if(!t)return;let n=()=>{let n=t.clientWidth,r=Math.min(n-(n<=650?0:24)*2,1280),i=e.clientWidth;he(r>i?{width:r,offset:(i-r)/2}:{width:i,offset:0});let a=P.current;if(a){let e=a.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop,r=t.clientHeight-e-nt;_e(Math.round(Math.min(tt,Math.max(n<=650?et:$e,r))))}};n();let r=new ResizeObserver(n);return r.observe(t),r.observe(e),()=>r.disconnect()},[]),(0,b.useLayoutEffect)(()=>{let e=xe.current;if(!e)return;let t=matchMedia(`(pointer: coarse)`).matches;kt.current=_();let n;try{n=new Ze(e,{quality:xt(t)})}catch{return}n.camera.yaw=G.current,F.current=n;let r=(e=!1)=>{let r=P.current;if(!r)return;let i=r.clientWidth,a=r.clientHeight,o=i>=720,s=Se.current?.offsetHeight??0,c=we.current?.offsetHeight??0;r.style.setProperty(`--evo-controls`,`${c}px`),Je.current||(K.current=o?lt:ut,B.current!==`opening`&&(n.camera.tilt=K.current)),Ft(),n.resize(i,a,t?1.5:2);let l=o?0:Ce.current?.offsetHeight??0;n.setInsets({top:o?18:s+10,bottom:c+4+(l?l+4:0),left:o?28:6,right:o?28:6},{animate:e&&!kt.current}),H.current=!0,We.current&&(U.current&&cancelAnimationFrame(U.current),U.current=0,Pt(performance.now()))};r(),Dt.current=r;let i=new ResizeObserver(()=>r());return P.current&&i.observe(P.current),Se.current&&i.observe(Se.current),we.current&&i.observe(we.current),()=>{i.disconnect(),F.current=null}},[Ft,Pt]),(0,b.useEffect)(()=>(We.current=jt,jt&&(W.current=0,Z()),()=>{We.current=!1,U.current&&cancelAnimationFrame(U.current),U.current=0}),[jt,Z]),(0,b.useEffect)(()=>{let e=xe.current;if(!e)return;let t=e=>{!e.ctrlKey&&!e.metaKey||(e.preventDefault(),F.current&&It(Y.current*Math.exp(-e.deltaY*.0022)))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[It]),(0,b.useEffect)(()=>{let e=xe.current;if(!e)return;let t=e=>{Tt.current=e.length>=2?{spread:Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY),zoom:Y.current}:null},n=e=>{e.targetTouches.length<2||e.cancelable&&(e.preventDefault(),Ot.current=null,t(e.targetTouches),B.current===`opening`&&Lt(),Z())},r=e=>{let t=Tt.current;if(!t||e.targetTouches.length<2)return;e.cancelable&&e.preventDefault();let[n,r]=[e.targetTouches[0],e.targetTouches[1]];It(Fe(t.zoom,t.spread,Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY)))},i=e=>{Tt.current&&t(e.targetTouches)},a=new AbortController,o={passive:!1,signal:a.signal};return e.addEventListener(`touchstart`,n,o),e.addEventListener(`touchmove`,r,o),e.addEventListener(`touchend`,i,{signal:a.signal}),e.addEventListener(`touchcancel`,i,{signal:a.signal}),()=>{a.abort(),Tt.current=null}},[It,Lt,Z]),(0,b.useEffect)(()=>{let t=new AbortController;return T(!0),ae(``),v(e,t.signal).then(e=>{t.signal.aborted||(ie(Te(e)),T(!1))}).catch(e=>{t.signal.aborted||wt(e)||(ae(Ct(e)),T(!1))}),()=>t.abort()},[e,t,oe]);let Bt=(0,b.useMemo)(()=>{let e=C?.unit===`day`||C?.unit===`week`?{month:`short`,day:`numeric`}:{year:`numeric`,month:`short`};return new Intl.DateTimeFormat(S,e)},[S,C?.unit]),Vt=(0,b.useMemo)(()=>new Intl.DateTimeFormat(S,{year:`numeric`,month:`long`,day:`numeric`}),[S]),Ht=(0,b.useMemo)(()=>new Intl.DateTimeFormat(S,{year:`numeric`,month:`2-digit`,day:`2-digit`}),[S]);(0,b.useEffect)(()=>{let e=F.current;e&&(e.setRingFormatter(e=>Bt.format(e)),H.current=!0)},[Bt]),(0,b.useEffect)(()=>{if(!C)return;let e=I.current,t=F.current,{start:n,end:r}=C.domain,i=r;if(e){let t=e.domain.end-e.domain.start;R.current>=e.domain.end-t*.002||(i=Math.min(r,Math.max(n,R.current))),B.current!==`idle`&&(B.current=`idle`,A(!1))}else!bt&&!kt.current&&C.count>0&&(bt=!0,B.current=`opening`,Ve.current=0,i=n,A(!0));I.current=C,R.current=i,z.current=i,V.current=(r-n)*.002;let a=performance.now();t?.setScene(C,{animate:!!e&&!kt.current,now:a})||(He.current=a),Ft(),!e&&t&&(t.camera.zoom=Y.current,t.camera.rim=Ne(Y.current)),ce(i),ue(i),pe(null),L.current=-1,Z()},[C,Ft,Z]);let Q=(0,b.useMemo)(()=>!C||!n?-1:C.indexById.get(n)??-1,[C,n]);(0,b.useEffect)(()=>{let e=F.current;ze.current=Q,e?.setSelection(Q);let t=I.current;t&&Q>=0?(J.current=ht-t.theta[Q],R.current<t.appearAt[Q]&&Rt(t.appearAt[Q])):J.current=null,Z()},[Rt,Q,Z]),(0,b.useEffect)(()=>{if(N(null),!n)return;let e=new AbortController;return y(n,e.signal).then(t=>{e.signal.aborted||N(t)}).catch(()=>{}),()=>e.abort()},[n,t]);let Ut=(0,b.useMemo)(()=>C&&Q>=0?Ae(C,Q):[],[C,Q]);(0,b.useLayoutEffect)(()=>{Dt.current(!0),Z()},[Ut,M,Z]),(0,b.useEffect)(()=>{if(!n)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[role="dialog"], [data-slot="popover-content"]`)||i(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i,n]),(0,b.useEffect)(()=>{if(k)return;let e=window.setTimeout(()=>ue(D),700);return()=>window.clearTimeout(e)},[D,k]),(0,b.useEffect)(()=>{let e=Oe.current;if(!e)return;let t=new ResizeObserver(()=>ye(e.clientWidth));return t.observe(e),ye(e.clientWidth),()=>t.disconnect()},[]),(0,b.useEffect)(()=>{let e=Ee.current;!e||!C||!ve||Qe(e,C,D,ve,vt)},[D,ve,C]);let Wt=(0,b.useMemo)(()=>C?ke(C,D):{active:0,superseded:0,archived:0,known:0},[D,C]),Gt=(0,b.useMemo)(()=>C?ke(C,O):Wt,[O,C,Wt]),$=!!C?.count,Kt=!C||D>=C.domain.end-(C.domain.end-C.domain.start)*.002,qt=C?Vt.format(D):``,Jt=x(`memory:memoryEvolution.stageLabel`,{date:C?Vt.format(O):``,active:Gt.active,superseded:Gt.superseded,archived:Gt.archived}),Yt=e=>x(e===`decision`?`memory:memoryEvolution.typeDecision`:e===`preference`?`memory:memoryEvolution.typePreference`:e===`fact`?`memory:memoryEvolution.typeFact`:e===`risk`?`memory:memoryEvolution.typeRisk`:e===`file`?`memory:memoryEvolution.typeFile`:e===`task`?`memory:memoryEvolution.typeTask`:`memory:memoryEvolution.typeConcept`),Xt=e=>x(e===`superseded`?`memory:memoryEvolution.superseded`:e===`archived`?`memory:memoryEvolution.archived`:e===`hidden`?`memory:memoryEvolution.notYet`:`memory:memoryEvolution.active`),Zt=e=>{let t=e.target,n=!!t.closest(`[data-slot="segmented-control"], [data-slot="popover-content"]`);if(e.key===` `){if(t.closest(`button, a, [role="radio"]`))return;e.preventDefault(),zt();return}let r=I.current;if(!r||!r.count||n)return;let i=(r.domain.end-r.domain.start)*(e.shiftKey?.05:.01),a=null;e.key===`ArrowLeft`?a=R.current-i:e.key===`ArrowRight`?a=R.current+i:e.key===`Home`?a=r.domain.start:e.key===`End`&&(a=r.domain.end),a!==null&&(e.preventDefault(),e.stopPropagation(),Rt(a))},Qt=e=>{e.button!==0||!e.isPrimary||(Ot.current={id:e.pointerId,x:e.clientX,y:e.clientY,lastX:e.clientX,lastY:e.clientY,moved:!1},e.currentTarget.setPointerCapture?.(e.pointerId))},$t=e=>{let t=F.current;if(!t)return;let n=Ot.current;if(n&&n.id===e.pointerId){let r=e.clientX-n.lastX,i=e.clientY-n.lastY;if(!n.moved&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<5)return;n.moved=!0,J.current=null,n.lastX=e.clientX,n.lastY=e.clientY,G.current+=r*.0062,e.pointerType===`mouse`&&(Je.current=!0,K.current=Math.min(1.16,Math.max(0,K.current-i*.0042)),t.camera.tilt=K.current),B.current===`opening`&&Lt(),L.current=-1,t.setHover(-1),pe(null),Z();return}if(e.pointerType!==`mouse`)return;let r=e.currentTarget.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top,o=t.pick(i,a,15,z.current);o!==L.current&&(L.current=o,t.setHover(o),Z()),pe(o>=0?{index:o,x:i,y:a}:null)},en=e=>{let t=Ot.current;Ot.current=null;let n=F.current;if(!n||!I.current||!t||t.moved)return;if(e.pointerType!==`mouse`){let t=Et.current,n=t!==null&&e.timeStamp-t.at<gt&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<_t;if(Et.current=n?null:{at:e.timeStamp,x:e.clientX,y:e.clientY},n){nn();return}}let r=e.currentTarget.getBoundingClientRect(),a=n.pick(e.clientX-r.left,e.clientY-r.top,e.pointerType===`mouse`?16:28,z.current);i(a>=0?I.current.facts[a].id:null)},tn=()=>{L.current>=0&&(L.current=-1,F.current?.setHover(-1),Z()),pe(null)},nn=()=>{let e=F.current;e&&(It(Ye.current),Xe.current=!1,Je.current=!1,K.current=(P.current?.clientWidth??800)>=720?lt:ut,e.camera.tilt=K.current,Z())},rn=j&&C?C.facts[j.index]:null,an=(0,b.useMemo)(()=>{let e=new Map;M?.item&&e.set(M.item.id,M.item.content);for(let t of M?.history||[])e.set(t.id,t.content);return e},[M]),on=e=>(0,X.jsx)(p,{size:`sm`,className:e,"aria-label":x(`memory:memoryEvolution.speed`),value:de,onValueChange:e=>{Be.current=e,fe(e)},options:st.map(e=>({value:e,label:`${e}×`}))}),sn=me?.width??null,cn=(()=>{if(!j)return;let e=P.current?.clientWidth??800,t=P.current?.clientHeight??600;return{left:Math.min(e-272,j.x+16),...j.y>t-150?{bottom:t-j.y+16}:{top:j.y+16}}})();return(0,X.jsx)(`div`,{ref:be,className:`min-w-0`,children:(0,X.jsxs)(`div`,{ref:Mt,role:`group`,"aria-label":x(`memory:memoryEvolution.regionLabel`),"data-memory-evolution":!0,"data-at":C?new Date(D).toISOString():void 0,"data-active-count":Wt.active,"data-playing":k||void 0,onKeyDownCapture:Zt,style:{...rt,...sn?{width:sn,marginLeft:me?.offset??0}:{},...ge?{height:ge}:{}},className:`@container relative isolate h-[clamp(560px,calc(100dvh-196px),880px)] overflow-hidden rounded-xl bg-[var(--evo-base)] text-content select-none max-[650px]:h-[clamp(540px,calc(100dvh-132px),780px)] max-[650px]:rounded-none`,children:[(0,X.jsx)(`canvas`,{ref:xe,role:`img`,"aria-label":Jt,tabIndex:0,onPointerDown:Qt,onPointerMove:$t,onPointerUp:en,onPointerCancel:()=>{Ot.current=null},onPointerLeave:tn,onDoubleClick:nn,className:`absolute inset-0 size-full cursor-grab touch-pan-y outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset active:cursor-grabbing`}),(0,X.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,role:`status`,children:C&&!k?Jt:``}),(0,X.jsxs)(`div`,{ref:Se,className:`pointer-events-none absolute top-5 left-6 z-10 flex max-w-[min(70%,420px)] flex-col gap-1.5 @max-[719px]:top-3.5 @max-[719px]:right-4 @max-[719px]:left-4 @max-[719px]:max-w-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2.5`,children:[$&&(0,X.jsx)(`span`,{"data-memory-evolution-date":!0,className:`text-[30px] leading-9 font-light tracking-[-0.015em] text-content tabular-nums @max-[719px]:text-2xl @max-[719px]:leading-8`,children:qt}),$&&Kt&&(0,X.jsx)(`span`,{className:`text-xs text-[var(--evo-active)]`,children:x(`memory:memoryEvolution.now`)})]}),$&&(0,X.jsxs)(`dl`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-content-muted tabular-nums`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-[var(--evo-active)] shadow-[0_0_8px_var(--evo-active)]`}),(0,X.jsx)(`dt`,{children:x(`memory:memoryEvolution.active`)}),(0,X.jsx)(`dd`,{"data-memory-evolution-active":!0,className:`font-medium text-content`,children:Wt.active})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full`,style:{backgroundColor:it,boxShadow:`0 0 8px ${it}`}}),(0,X.jsx)(`dt`,{children:x(`memory:memoryEvolution.superseded`)}),(0,X.jsx)(`dd`,{className:`font-medium text-content`,children:Wt.superseded})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full`,style:{backgroundColor:at}}),(0,X.jsx)(`dt`,{children:x(`memory:memoryEvolution.archived`)}),(0,X.jsx)(`dd`,{className:`font-medium text-content`,children:Wt.archived})]})]}),C?.truncated&&(0,X.jsx)(`p`,{className:`m-0 text-xs text-content-faint`,children:x(`memory:memoryEvolution.truncated`,{count:C.count})}),E&&C&&(0,X.jsx)(`p`,{className:`m-0 text-xs text-danger`,children:E})]}),$&&Q<0&&(0,X.jsx)(`ul`,{"aria-label":x(`memory:memoryEvolution.legend`),className:`pointer-events-none absolute top-1/2 right-6 z-10 hidden -translate-y-[62%] list-none flex-col gap-1.5 p-0 text-[11px] text-content-muted @min-[880px]:flex`,children:le.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-end gap-2`,children:[Yt(e),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full`,style:{backgroundColor:q(Ue[e]),boxShadow:`0 0 7px ${q(Ue[e])}`}})]},e))}),$&&(0,X.jsx)(`div`,{className:`absolute top-3.5 right-4 z-10 @max-[719px]:top-2.5 @max-[719px]:right-2.5`,children:(0,X.jsxs)(d,{children:[(0,X.jsx)(l,{asChild:!0,children:(0,X.jsx)(g,{variant:`ghost`,size:`icon-sm`,"aria-label":x(`memory:memoryEvolution.howToRead`),title:x(`memory:memoryEvolution.howToRead`),children:(0,X.jsx)(a,{"aria-hidden":`true`})})}),(0,X.jsxs)(u,{align:`end`,className:`w-80 gap-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`m-0 leading-relaxed`,children:x(`memory:memoryEvolution.howToReadBody`)}),(0,X.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-2 gap-x-3 gap-y-1 p-0`,children:le.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-content-secondary`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{backgroundColor:q(Ue[e])}}),Yt(e)]},e))}),(0,X.jsx)(`p`,{className:`m-0 leading-relaxed text-content-muted`,children:x(`memory:memoryEvolution.gestures`)})]})]})}),rn&&j&&C&&j.index!==Q&&(0,X.jsxs)(`div`,{role:`tooltip`,"data-memory-evolution-tooltip":!0,style:cn,className:`pointer-events-none absolute z-20 flex w-max max-w-64 flex-col gap-0.5 rounded-md border border-[var(--evo-line)] bg-[var(--evo-panel)] px-2.5 py-1.5 text-xs backdrop-blur-md`,children:[(0,X.jsx)(`strong`,{className:`line-clamp-2 font-medium text-content`,children:rn.title}),(0,X.jsxs)(`span`,{className:`text-content-muted tabular-nums`,children:[Yt(rn.type),` · `,Ht.format(C.validAt[j.index]),` ·`,` `,Xt(De(C,j.index,D))]}),!!(C.flags[j.index]&4)&&(0,X.jsx)(`span`,{className:`text-content-muted tabular-nums`,children:x(`memory:memoryEvolution.learnedLate`,{date:Ht.format(C.appearAt[j.index])})})]}),C&&Q>=0&&(0,X.jsxs)(`section`,{ref:Ce,"data-memory-evolution-card":!0,"aria-label":C.facts[Q].title,className:`absolute top-14 right-4 z-20 flex max-h-[calc(100%-230px)] w-[320px] flex-col gap-2 overflow-y-auto rounded-lg border border-[var(--evo-line)] bg-[var(--evo-panel)] p-3 backdrop-blur-md @max-[719px]:top-auto @max-[719px]:right-2.5 @max-[719px]:bottom-[calc(var(--evo-controls,160px)+4px)] @max-[719px]:left-2.5 @max-[719px]:max-h-[32%] @max-[719px]:w-auto`,children:[(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`m-0 min-w-0 text-[13px] leading-5 font-medium break-words text-content`,children:C.facts[Q].title}),(0,X.jsx)(g,{variant:`ghost`,size:`icon-sm`,className:`-mt-1 -mr-1 flex-none`,"aria-label":x(`memory:memoryEvolution.closeCard`),onClick:()=>i(null),children:(0,X.jsx)(c,{"aria-hidden":`true`})})]}),(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-2 text-[11px] text-content-muted`,children:[(0,X.jsx)(`span`,{children:Yt(C.facts[Q].type)}),!!(C.flags[Q]&1)&&(0,X.jsx)(`span`,{children:x(`memory:memoryEvolution.pinned`)}),!!(C.flags[Q]&2)&&(0,X.jsx)(`span`,{children:x(`memory:memoryEvolution.untrusted`)}),!!(C.flags[Q]&8)&&(0,X.jsx)(`span`,{children:x(`memory:memoryEvolution.stale`)})]}),(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:Ut.map(e=>{let t=C.facts[e],n=De(C,e,D),r=an.get(t.id);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,"aria-current":e===Q||void 0,onClick:()=>{Rt(C.appearAt[e]),i(t.id)},className:m(`flex w-full min-w-0 flex-col gap-0.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-focus focus-visible:outline-none pointer-coarse:min-h-11`,e===Q&&`bg-surface-muted`),children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] text-content-muted tabular-nums`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 flex-none rounded-full`,style:{backgroundColor:n===`superseded`?it:n===`archived`?at:q(Ue[t.type]??Ue.concept)}}),Ht.format(C.validAt[e]),` · `,Xt(n)]}),(0,X.jsx)(`span`,{className:`line-clamp-3 text-xs leading-[1.45] break-words text-content-soft`,children:r||t.title})]})},t.id)})})]}),C&&!$&&(0,X.jsx)(`div`,{className:`absolute inset-x-0 bottom-5 z-10 flex justify-center px-6`,children:(0,X.jsx)(te,{compact:!0,illustration:(0,X.jsx)(`span`,{}),title:x(`memory:memoryEvolution.emptyTitle`),description:x(`memory:memoryEvolution.emptyDescription`)})}),!C&&w&&(0,X.jsx)(`div`,{role:`status`,className:`absolute inset-0 z-10 grid place-items-center text-xs text-content-muted`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(h,{className:`size-4`}),x(`memory:memoryEvolution.loading`)]})}),!C&&!w&&E&&(0,X.jsx)(`div`,{className:`absolute inset-0 z-10 grid place-items-center`,children:(0,X.jsx)(ee,{kind:`error`,title:x(`memory:memoryEvolution.loadFailed`),description:E,action:(0,X.jsx)(g,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>se(e=>e+1),children:x(`memory:memoryEvolution.retry`)})})}),(0,X.jsx)(`div`,{ref:we,className:m(`absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-[var(--evo-scrim)] via-[var(--evo-scrim)] via-40% to-[var(--evo-scrim-clear)] px-5 pt-7 pb-3.5 @max-[719px]:px-3 @max-[719px]:pt-5 @max-[719px]:pb-3`,!$&&`invisible`),children:(0,X.jsxs)(`div`,{className:`flex items-end gap-3 @max-[719px]:flex-col @max-[719px]:items-stretch @max-[719px]:gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-none items-center gap-1 pb-1 @max-[719px]:order-2 @max-[719px]:justify-between @max-[719px]:pb-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(g,{variant:`ghost`,size:`icon`,"data-memory-evolution-play":!0,className:`max-[650px]:size-11`,"aria-label":x(k?`memory:memoryEvolution.pause`:`memory:memoryEvolution.play`),title:x(k?`memory:memoryEvolution.pause`:`memory:memoryEvolution.play`),disabled:!$,onClick:zt,children:k?(0,X.jsx)(o,{"aria-hidden":`true`}):(0,X.jsx)(s,{"aria-hidden":`true`})}),(0,X.jsxs)(g,{variant:`ghost`,size:`sm`,"data-memory-evolution-now":!0,className:`aria-disabled:opacity-50 max-[650px]:h-11`,"aria-disabled":!$||Kt&&!k,onClick:()=>{C&&!(Kt&&!k)&&Rt(C.domain.end)},children:[(0,X.jsx)(ne,{"aria-hidden":`true`}),x(`memory:memoryEvolution.backToNow`)]})]}),on(`hidden @max-[719px]:inline-flex`)]}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 @max-[719px]:order-1`,children:[(0,X.jsx)(`div`,{ref:Oe,"aria-hidden":`true`,style:{marginLeft:yt,marginRight:yt,height:vt},children:(0,X.jsx)(`canvas`,{ref:Ee,className:`block size-full`})}),C&&(0,X.jsx)(f,{"aria-label":x(`memory:memoryEvolution.timelineLabel`),valueText:qt,min:0,max:1e3,step:1,value:[Le(C.domain,D)],disabled:!$,className:`h-5 pointer-coarse:h-11 max-[650px]:h-11`,onValueChange:([e])=>Rt(Ie(C.domain,e))}),C&&(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`flex justify-between px-[7px] text-[11px] text-content-faint tabular-nums`,children:[(0,X.jsx)(`span`,{children:Ht.format(C.domain.start)}),(0,X.jsx)(`span`,{children:Ht.format(C.domain.end)})]})]}),on(`mb-1 flex-none @max-[719px]:hidden`)]})})]})})}export{Tt as MemoryEvolution,Tt as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryEvolution-D4d8ELda.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CsOCclo6.js","assets/i18n-DyMZgkZI.js","assets/vendor-router-CSN_DGvx.js","assets/index-CiyAfWLi.js","assets/index-j6s460ui.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/info-DATxy0fb.js","assets/pause-CYWpPg1R.js","assets/play-DNDjDNGn.js","assets/x-07u4-129.js","assets/popover-DGWRnOht.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/dialog-DldLiTwf.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/slider-De8rWVNs.js","assets/dist-DzGQ7sLi.js","assets/dist-BS3ekNDj.js","assets/segmented-control-xkrEOP_d.js","assets/dist-BaBySQmo.js","assets/PageState-Cz6vFMXv.js","assets/motion-DTR4ZVle.js","assets/memory-api-Cu3MEsQE.js","assets/api-D1flkoh7.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-DEs9jkgT.js","assets/event-stream-DRv0u06j.js","assets/http-B-XVZUum.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t,n,u as r}from"./vendor-router-CSN_DGvx.js";import{t as i}from"./index-CiyAfWLi.js";import{i as a,r as o}from"./vendor-react-DwNgTV1j.js";import{h as s}from"./routes-BYsK6aeM.js";import{t as c}from"./use-i18n-CsOCclo6.js";import{t as l}from"./storage-DtvZ_lEu.js";import{a as u}from"./http-response-DEs9jkgT.js";import"./http-B-XVZUum.js";import{t as d}from"./createLucideIcon-Cd-3GVxJ.js";import{t as f}from"./archive-ojKJT7Fp.js";import{t as p}from"./book-open-BuHHD9os.js";import{t as m}from"./ellipsis-CfGKfbq6.js";import{t as h}from"./file-code-corner-BnE1ljT0.js";import{n as g,t as _}from"./undo-2-ChaURM4t.js";import{t as v}from"./list-todo-hpikYm6Q.js";import{t as y}from"./message-square-text-C5MJw0FL.js";import{t as b}from"./pencil-U08v_vV9.js";import{t as x}from"./pin-off-BpRu_vrC.js";import{t as S}from"./pin-CU0FG0lI.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./refresh-cw-TbWxTY4K.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./rotate-ccw-C0v8V77_.js";import{t as D}from"./sliders-horizontal-Dryf1XyC.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as O}from"./triangle-alert-CE1q54ci.js";import{t as te}from"./x-07u4-129.js";import{t as ne}from"./more-pages-D_PnxLN0.js";import{c as re,i as k,p as A,r as ie,t as ae}from"./dropdown-menu-Ds0gD8S8.js";import{i as oe,n as j,r as se,t as ce}from"./tabs-DsgBuvJv.js";import{t as le}from"./segmented-control-xkrEOP_d.js";import{t as M}from"./utils-C8uzG5AZ.js";import{n as N,t as P}from"./button-CCcCN8tE.js";import{s as ue}from"./shortcuts-C6ddcUau.js";import{a as de,i as F,l as I,o as L,s as R,t as fe}from"./dialog-DldLiTwf.js";import{t as z}from"./input-CPw-zkYh.js";import{t as B}from"./textarea-DmATpOqT.js";import{n as V,t as pe}from"./PageState-Cz6vFMXv.js";import{a as me,i as he,n as ge,o as _e,r as ve,s as ye,t as be}from"./FeaturePage-DEjUrI25.js";import{n as H}from"./field-DoLEb0np.js";import{t as xe}from"./AppSelect-B15Hpk2W.js";import{t as Se}from"./badge-CWB3lj2H.js";import{i as U}from"./app-primitives-BskZ4ZJj.js";import{a as W,c as Ce,f as we,g as Te,h as G,i as Ee,l as K,m as De,n as Oe,o as ke,p as Ae,r as je,s as Me,t as Ne,u as Pe}from"./memory-api-Cu3MEsQE.js";var Fe=d(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Ie=d(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Le=d(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),Re=d(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ze=d(`milestone`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z`,key:`8gz4t4`}]]),Be=d(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),q=e(a(),1),Ve={concept:g,file:h,risk:O,preference:D,decision:ze,fact:p,task:v};function He(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 Ue(e,t){return t(e===`manual`?`memory:memoryPage.sourceManual`:e===`user_confirmed`?`memory:memoryPage.sourceUserRequest`:e===`agent`?`memory:memoryPage.sourceAgent`:e===`tool_verified`?`memory:memoryPage.sourceTool`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.sourceConversation`)}function We(e,t){return t(e===`assistant`?`memory:memoryPage.roleAssistant`:e===`tool`?`memory:memoryPage.roleTool`:e===`external`?`memory:memoryPage.roleExternal`:e===`manual`?`memory:memoryPage.roleManual`:`memory:memoryPage.roleUser`)}function Ge(e,t){return[e.pinned&&t(`memory:memoryPage.pinnedBadge`),e.status===`stale`&&t(`memory:memoryPage.staleBadge`),e.tainted&&t(`memory:memoryPage.taintedBadge`),e.status===`archived`&&t(`memory:memoryPage.archivedBadge`),e.status===`superseded`&&t(`memory:memoryPage.supersededBadge`)].filter(e=>!!e)}function J(e,t){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.kind===`chats`?t(`memory:memoryPage.projectlessChats`):e?.name||``}function Y(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 Ke(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`}).format(n)}function qe(e,t){let n={add:{icon:C,label:()=>t(`memory:memoryPage.eventAdd`)},supersede:{icon:Be,label:()=>t(`memory:memoryPage.eventSupersede`)},merge:{icon:Re,label:()=>t(`memory:memoryPage.eventMerge`)},archive:{icon:f,label:()=>t(`memory:memoryPage.eventArchive`)},expire:{icon:Ie,label:()=>t(`memory:memoryPage.eventExpire`)},stale:{icon:O,label:()=>t(`memory:memoryPage.eventStale`)},confirm:{icon:Fe,label:()=>t(`memory:memoryPage.eventConfirm`)},restore:{icon:E,label:()=>t(`memory:memoryPage.eventRestore`)},edit:{icon:b,label:()=>t(`memory:memoryPage.eventEdit`)},pin:{icon:S,label:()=>t(`memory:memoryPage.eventPin`)},unpin:{icon:x,label:()=>t(`memory:memoryPage.eventUnpin`)},delete:{icon:ee,label:()=>t(`memory:memoryPage.eventDelete`)},purge:{icon:Le,label:()=>t(`memory:memoryPage.eventPurge`)},undo:{icon:_,label:()=>t(`memory:memoryPage.eventUndo`)},reinforce:{icon:w,label:()=>t(`memory:memoryPage.eventReinforce`)},migrate:{icon:T,label:()=>t(`memory:memoryPage.eventMigrate`)},consolidate:{icon:Re,label:()=>t(`memory:memoryPage.eventConsolidate`)}}[e];return n?{icon:n.icon,label:n.label()}:{icon:T,label:t(`memory:memoryPage.eventGeneric`)}}function Je(e,t){return e===`user`||e===`manual`||e===`user_confirmed`?t(`memory:memoryPage.actorYou`):[`consolidator`,`reconcile`,`lifecycle`].includes(e)?t(`memory:memoryPage.actorConsolidator`):t(e===`conversation`?`memory:memoryPage.actorConversation`:e===`agent`||e===`tool_verified`?`memory:memoryPage.actorAgent`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.actorSystem`)}function Ye(e,t){if(e===`same_identity`)return t(`memory:memoryPage.reasonSameIdentity`);if(e===`lower_authority_conflict`)return t(`memory:memoryPage.reasonLowerAuthority`);if(e===`expired`||e===`retention_expired`)return t(`memory:memoryPage.reasonExpired`);if(e===`unused`||e===`low_utility`)return t(`memory:memoryPage.reasonLowUtility`);if(e===`user_deleted`)return t(`memory:memoryPage.reasonUserDeleted`);if(e===`user_requested`)return t(`memory:memoryPage.reasonUserRequested`);let n=/^digests:(\d+) merged:(\d+)$/.exec(e);if(n){let e=Number(n[1]),r=Number(n[2]);return e&&r?t(`memory:memoryPage.reasonConsolidatedBoth`,{digests:e,merged:r}):r?t(`memory:memoryPage.reasonConsolidatedMerged`,{merged:r}):t(`memory:memoryPage.reasonConsolidatedDigests`,{digests:e})}let r=/^promoted (\d+) pending candidates$/.exec(e);return r?t(`memory:memoryPage.reasonPromoted`,{count:Number(r[1])}):e}var X=o(),Xe=50;function Ze({spaceId:e,refreshKey:t,onChanged:n}){let{t:r,language:i}=c(),[a,o]=(0,q.useState)([]),[s,l]=(0,q.useState)(!0),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[v,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(``),S=(0,q.useRef)(0),C=e===`all`?``:e,w=(0,q.useCallback)(async()=>{let e=++S.current;l(!0),y(``);try{let t=await Pe({spaceId:C,limit:Xe});if(e!==S.current)return;o(t.events),m(t.events.length>=Xe),g(!1)}catch(t){if(e!==S.current)return;t instanceof u&&t.status===404?g(!0):y(t instanceof Error?t.message:String(t))}finally{e===S.current&&l(!1)}},[C]);(0,q.useEffect)(()=>(w(),()=>{S.current+=1}),[w,t]);let T=async()=>{let e=a.at(-1)?.at;if(!e||d)return;let t=S.current;f(!0);try{let n=await Pe({spaceId:C,before:e,limit:Xe});if(t!==S.current)return;o(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.events.filter(e=>!t.has(e.id))]}),m(n.events.length>=Xe)}catch(e){t===S.current&&y(e instanceof Error?e.message:String(e))}finally{f(!1)}},E=async e=>{if(!b){x(e.id),y(``);try{await G(e.id),await n(r(`memory:memoryPage.eventUndone`))}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(``)}}};return h?(0,X.jsx)(pe,{compact:!0,title:r(`memory:memoryPage.activityUnsupported`)}):s&&!a.length?(0,X.jsx)(V,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):v&&!a.length?(0,X.jsx)(V,{kind:`error`,title:r(`memory:memoryPage.activityLoadFailed`),description:v,action:(0,X.jsx)(P,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):a.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[v&&(0,X.jsx)(be,{className:`mt-0`,children:v}),(0,X.jsx)(ge,{children:a.map(e=>{let{icon:t,label:n}=qe(e.action,r),a=e.reason?Ye(e.reason,r):``;return(0,X.jsx)(he,{"data-memory-event":e.action,icon:(0,X.jsx)(t,{}),name:n,description:[...new Set(e.titles||[])].join(`、`)||void 0,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(e.at,i),` · `,Je(e.actor,r),a?` · ${a}`:``]}),status:e.undoneAt?r(`memory:memoryPage.undone`):void 0,actions:e.undoable?(0,X.jsxs)(P,{variant:`ghost`,size:`sm`,disabled:!!b,"aria-label":`${r(`memory:memoryPage.undo`)}: ${n}`,onClick:()=>void E(e),children:[(0,X.jsx)(_,{}),r(`memory:memoryPage.undo`)]}):void 0},e.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void T(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(pe,{compact:!0,title:r(`memory:memoryPage.noActivity`)})}var Z=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content [&>dt]:shrink-0 [&>dt]:text-content-muted`;function Qe({labels:e}){return(0,X.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map(e=>(0,X.jsx)(Se,{children:e},e))})}function $e({id:e,fallback:t=null,spaces:r,refreshKey:i=0,withHeading:a=!1,onClose:o,onEdit:l,onChanged:u,onDeleted:d,requestConfirm:f}){let{t:p,language:m}=c(),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!0),[y,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[ne,re]=(0,q.useState)(0);(0,q.useEffect)(()=>{let t=new AbortController;return v(!0),C(``),K(e,t.signal).then(e=>{t.signal.aborted||(g(e),v(!1))}).catch(e=>{t.signal.aborted||(C(e instanceof Error?e.message:String(e)),v(!1))}),()=>t.abort()},[e,i,ne]);let k=(0,q.useCallback)(async(e,t)=>{O(!0),T(``);try{await e(),await u(t)}catch(e){T(e instanceof Error?e.message:String(e))}finally{O(!1)}},[u]),A=h?.item?.id===e?h.item:t,ie=h?.item?.id===e?h.history:[],ae=h?.item?.id===e?h.sourceSession:void 0,oe=async()=>{if(A&&await f({title:p(`memory:memoryPage.deleteMemory`),message:p(`memory:memoryPage.deleteMemoryName`,{name:A.title}),confirmLabel:p(`memory:memoryPage.delete`)})){O(!0),T(``);try{await W(A.id),await d(p(`memory:memoryPage.memoryDeleted`))}catch(e){T(e instanceof Error?e.message:String(e)),O(!1)}}};if(!A)return(0,X.jsx)(`div`,{className:`flex min-h-16 items-center gap-2 text-xs text-content-muted`,children:_?(0,X.jsx)(N,{className:`size-4`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{className:`my-0`,children:y||p(`memory:memoryPage.detailLoadFailed`)}),(0,X.jsx)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>re(e=>e+1),children:p(`memory:memoryPage.retry`)})]})});let j=r.find(e=>e.id===A.spaceId),se=A.status===`active`||A.status===`stale`||!A.status,ce=Ge(A,p);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,"aria-busy":_||D||void 0,children:[a&&(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:A.title}),ce.length>0&&(0,X.jsx)(Qe,{labels:ce})]}),o&&(0,X.jsx)(P,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`-mt-0.5 flex-none max-[650px]:size-11`,"aria-label":p(`memory:memoryPage.closeDetail`),onClick:o,children:(0,X.jsx)(te,{})})]}),(0,X.jsx)(`p`,{className:`text-[13px] leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:A.content}),A.status===`stale`&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:p(`memory:memoryPage.staleHint`)}),A.tainted&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:p(`memory:memoryPage.taintedHint`)}),(0,X.jsxs)(`dl`,{className:`m-0`,children:[(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.memoryType`)}),(0,X.jsx)(`dd`,{children:He(A.type,p)})]}),j&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.memorySpace`)}),(0,X.jsx)(`dd`,{children:J(j,p)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.source`)}),(0,X.jsx)(`dd`,{children:Ue(A.sourceType,p)})]}),ae&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.sourceChat`)}),(0,X.jsx)(`dd`,{children:ae.sessionAvailable?(0,X.jsx)(P,{asChild:!0,variant:`link`,size:`sm`,className:`max-w-full`,children:(0,X.jsx)(n,{to:s(ae.sessionId),children:(0,X.jsx)(`span`,{className:`truncate`,children:ae.sessionName||p(`memory:memoryPage.sessionUntitled`)})})}):p(`memory:memoryPage.sourceChatUnavailable`)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.validFrom`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(A.validFrom,m)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.validTo`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:A.validTo?Y(A.validTo,m):p(`memory:memoryPage.stillValid`)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.created`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(A.createdAt,m)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.confirmCount`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:A.confirmCount??1})]}),A.expiresAt&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.expires`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(A.expiresAt,m)})]}),A.sourcePath&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.relatedFilePath`)}),(0,X.jsx)(`dd`,{className:`font-mono text-xs`,title:A.sourcePath,children:A.sourcePath})]}),A.archiveReason&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:p(`memory:memoryPage.archiveReason`)}),(0,X.jsx)(`dd`,{title:Ye(A.archiveReason,p),children:Ye(A.archiveReason,p)})]})]}),A.evidence&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":p(`memory:memoryPage.evidence`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted`,children:[p(`memory:memoryPage.evidenceFrom`),` · `,We(A.evidenceRole,p)]}),(0,X.jsx)(`blockquote`,{className:`m-0 border-l-2 border-stroke pl-2.5 text-xs leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:A.evidence})]}),ie.length>1&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":p(`memory:memoryPage.versionHistory`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[p(`memory:memoryPage.versionHistory`),` · `,ie.length]}),(0,X.jsx)(`ol`,{"data-memory-history":!0,className:`m-0 flex list-none flex-col p-0`,children:ie.map(e=>{let t=e.status===`active`||e.status===`stale`;return(0,X.jsxs)(`li`,{"aria-current":e.id===A.id||void 0,className:M(`flex min-w-0 flex-col gap-0.5 border-t border-stroke-soft py-1.5 text-xs leading-normal`,!t&&`text-content-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 tabular-nums`,children:[Ke(e.validFrom,m),t&&(0,X.jsx)(Se,{children:p(`memory:memoryPage.currentVersion`)})]}),(0,X.jsx)(`span`,{className:`break-words whitespace-pre-wrap`,children:e.content})]},e.id)})})]}),w&&(0,X.jsx)(U,{className:`my-0`,children:w}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,X.jsxs)(P,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:D,onClick:()=>void oe(),children:[(0,X.jsx)(ee,{}),p(`memory:memoryPage.delete`)]}),se?(0,X.jsxs)(X.Fragment,{children:[A.status===`stale`&&(0,X.jsxs)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:D,onClick:()=>void k(()=>Ae(A.id,`confirm`),p(`memory:memoryPage.confirmed`)),children:[(0,X.jsx)(Fe,{}),p(`memory:memoryPage.confirmStillValid`)]}),(0,X.jsxs)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:D,onClick:()=>void k(()=>Ae(A.id,A.pinned?`unpin`:`pin`),A.pinned?p(`memory:memoryPage.unpinned`):p(`memory:memoryPage.pinned`)),children:[A.pinned?(0,X.jsx)(x,{}):(0,X.jsx)(S,{}),A.pinned?p(`memory:memoryPage.unpin`):p(`memory:memoryPage.pin`)]}),(0,X.jsxs)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:D,onClick:()=>l(A),children:[(0,X.jsx)(b,{}),p(`memory:memoryPage.edit`)]})]}):(0,X.jsxs)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:D,onClick:()=>void k(()=>Ae(A.id,`restore`),p(`memory:memoryPage.restored`)),children:[(0,X.jsx)(E,{}),p(`memory:memoryPage.restore`)]})]})]})}var et=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],tt=[.3,.5,.8,1];function nt(e){let t=e??.5;return tt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function rt(e){return e instanceof Error?e.message:String(e)}function it({spaces:e,node:t,initialSpaceId:n,onClose:r,onSaved:i}){let{t:a}=c(),o=e.filter(e=>e.kind!==`chats`||e.id===t?.spaceId),s=o.find(e=>e.id===n),[l,u]=(0,q.useState)({spaceId:t?.spaceId||s?.id||o[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:nt(t?.importance)}),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(``),h=a(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),g=async e=>{if(e.preventDefault(),!d){f(!0),m(``);try{t?await Te(t.id,l):await je(l),await i(a(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){m(rt(e))}finally{f(!1)}}};return(0,X.jsx)(fe,{open:!0,busy:d,onOpenChange:e=>!e&&r(),children:(0,X.jsx)(F,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void g(e),children:[(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{children:h}),(0,X.jsx)(de,{children:a(!t&&n===`chats`?`memory:memoryPage.addFromProjectlessHint`:`memory:memoryPage.memoryDialogHint`)})]}),(0,X.jsxs)(H,{variant:`control`,children:[a(`memory:memoryPage.memoryTitle`),(0,X.jsx)(z,{value:l.title,onChange:e=>u({...l,title:e.target.value}),placeholder:a(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,X.jsxs)(H,{variant:`control`,children:[a(`memory:memoryPage.memoryContent`),(0,X.jsx)(B,{value:l.content,onChange:e=>u({...l,content:e.target.value}),placeholder:a(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,X.jsxs)(H,{variant:`control`,children:[a(`memory:memoryPage.memorySpace`),(0,X.jsx)(xe,{value:l.spaceId,onChange:e=>u({...l,spaceId:e.target.value}),children:o.map(e=>(0,X.jsx)(`option`,{value:e.id,children:J(e,a)},e.id))})]}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-x-2.5 gap-y-3 sm:grid-cols-2`,children:[(0,X.jsxs)(H,{variant:`control`,children:[a(`memory:memoryPage.memoryType`),(0,X.jsx)(xe,{value:l.type,onChange:e=>u({...l,type:e.target.value}),children:et.map(e=>(0,X.jsx)(`option`,{value:e,children:He(e,a)},e))})]}),(0,X.jsxs)(H,{variant:`control`,children:[a(`memory:memoryPage.importance`),(0,X.jsxs)(xe,{value:l.importance,onChange:e=>u({...l,importance:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:`0.3`,children:a(`memory:memoryPage.normal`)}),(0,X.jsx)(`option`,{value:`0.5`,children:a(`memory:memoryPage.common`)}),(0,X.jsx)(`option`,{value:`0.8`,children:a(`memory:memoryPage.important`)}),(0,X.jsx)(`option`,{value:`1`,children:a(`memory:memoryPage.strict`)})]})]})]}),(0,X.jsxs)(H,{variant:`control`,children:[a(`memory:memoryPage.relatedFilePath`),(0,X.jsx)(z,{value:l.sourcePath,onChange:e=>u({...l,sourcePath:e.target.value}),placeholder:a(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,X.jsx)(U,{children:p}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:r,children:a(`memory:memoryPage.cancel`)}),(0,X.jsxs)(P,{type:`submit`,size:`dialogAction`,disabled:d||!l.spaceId||!l.title.trim()||!l.content.trim(),children:[d&&(0,X.jsx)(N,{className:`text-current`}),a(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}function at({space:e,onClose:t,onSaved:n}){let{t:r}=c(),[i,a]=(0,q.useState)(e?.name||``),[o,s]=(0,q.useState)(!1),[l,u]=(0,q.useState)(``),d=r(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),f=async t=>{if(t.preventDefault(),!o){s(!0),u(``);try{await n(e?await De(e.id,i):await Ee(i),r(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){u(rt(e))}finally{s(!1)}}};return(0,X.jsx)(fe,{open:!0,busy:o,onOpenChange:e=>!e&&t(),children:(0,X.jsx)(F,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void f(e),children:[(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{children:d}),(0,X.jsx)(de,{children:r(`memory:memoryPage.memorySpaceHint`)})]}),(0,X.jsxs)(H,{variant:`control`,children:[r(`memory:memoryPage.memorySpaceName`),(0,X.jsx)(z,{value:i,onChange:e=>a(e.target.value),placeholder:r(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),l&&(0,X.jsx)(U,{children:l}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:o,onClick:t,children:r(`memory:memoryPage.cancel`)}),(0,X.jsxs)(P,{type:`submit`,size:`dialogAction`,disabled:o||!i.trim(),children:[o&&(0,X.jsx)(N,{className:`text-current`}),r(o?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}var ot=30;function st({digest:e}){let{t}=c(),n=r(),[i,a]=(0,q.useState)([]);return(0,q.useEffect)(()=>{let t=new AbortController;return K(e.id,t.signal).then(e=>a(e.children||[]),()=>a([])),()=>t.abort()},[e.id]),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`m-0 text-sm leading-relaxed break-words whitespace-pre-wrap`,children:e.text}),i.length>0&&(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`m-0 text-xs font-medium text-content-muted`,children:t(`memory:memoryPage.sessionFacts`)}),(0,X.jsx)(`ul`,{className:`m-0 mt-1 list-disc pl-4 text-sm leading-relaxed`,children:i.map(e=>(0,X.jsx)(`li`,{className:`break-words`,children:e.title},e.id))})]}),e.sessionAvailable&&(0,X.jsx)(`div`,{children:(0,X.jsx)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>n(s(e.sessionId)),children:t(`memory:memoryPage.openSession`)})})]})}function ct({spaceId:e,spaces:t,refreshKey:n}){let{t:r,language:i}=c(),[a,o]=(0,q.useState)([]),[s,l]=(0,q.useState)(!0),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[b,x]=(0,q.useState)(``),S=(0,q.useRef)(0),C=e===`all`?``:e,w=(0,q.useCallback)(async()=>{let e=++S.current;l(!0),v(``);try{let t=await we({spaceId:C,limit:ot});if(e!==S.current)return;o(t.sessions),m(t.sessions.length>=ot),g(!1)}catch(t){if(e!==S.current)return;t instanceof u&&t.status===404?g(!0):v(t instanceof Error?t.message:String(t))}finally{e===S.current&&l(!1)}},[C]);(0,q.useEffect)(()=>(w(),()=>{S.current+=1}),[w,n]);let T=async()=>{let e=a.at(-1)?.windowEnd;if(!e||d)return;let t=S.current;f(!0);try{let n=await we({spaceId:C,before:e,limit:ot});if(t!==S.current)return;o(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.sessions.filter(e=>!t.has(e.id))]}),m(n.sessions.length>=ot)}catch(e){t===S.current&&v(e instanceof Error?e.message:String(e))}finally{f(!1)}};return h?(0,X.jsx)(pe,{compact:!0,title:r(`memory:memoryPage.sessionsUnsupported`)}):s&&!a.length?(0,X.jsx)(V,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):_&&!a.length?(0,X.jsx)(V,{kind:`error`,title:r(`memory:memoryPage.sessionsLoadFailed`),description:_,action:(0,X.jsx)(P,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):a.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[_&&(0,X.jsx)(be,{className:`mt-0`,children:_}),(0,X.jsx)(ge,{children:a.map(n=>{let a=n.sessionName||r(`memory:memoryPage.sessionUntitled`),o=t.find(e=>e.id===n.spaceId);return(0,X.jsx)(he,{"data-memory-session":n.sessionId,icon:(0,X.jsx)(y,{}),name:a,description:b===n.id?void 0:n.text,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(n.windowEnd,i),e===`all`&&o?` · ${J(o,r)}`:``]}),expanded:b===n.id,onExpandedChange:e=>x(e?n.id:``),toggleLabel:a,detail:(0,X.jsx)(st,{digest:n})},n.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void T(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(pe,{compact:!0,title:r(`memory:memoryPage.noSessionDigests`)})}var lt=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate());function ut(e){let t=lt(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7)}function dt(e,t,n=Date.now()){let r=new Date(n),i=lt(r).getTime(),a=i-864e5,o=ut(r).getTime(),s=new Map,c=(e,t)=>{let n=s.get(e.key);n?n.items.push(t):s.set(e.key,{...e,items:[t]})};for(let n of e){let e=Date.parse(t(n)||``);if(Number.isNaN(e))c({key:`unknown`,kind:`unknown`},n);else if(e>=i)c({key:`today`,kind:`today`},n);else if(e>=a)c({key:`yesterday`,kind:`yesterday`},n);else if(e>=o)c({key:`week`,kind:`week`},n);else{let t=new Date(e);c({key:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}`,kind:`month`,month:new Date(t.getFullYear(),t.getMonth(),1)},n)}}return[...s.values()]}var ft=(0,q.lazy)(()=>t(()=>import(`./MemoryEvolution-D4d8ELda.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38]))),Q=`all`;function pt(){try{let e=i.getItem(l.memoryView);return e===`timeline`||e===`sessions`||e===`activity`?e:`evolution`}catch{return`evolution`}}function mt(e){try{i.setItem(l.memoryView,e)}catch{}}function $(e){return e instanceof Error?e.message:String(e)}var ht={spaces:[],selectedSpaceId:``,nodes:[]};function gt({notify:e,onBack:t,requestConfirm:n}){let{t:r,language:i}=c(),a=ue(`focusSearch`),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(pt),[d,f]=(0,q.useState)(Q),[p,h]=(0,q.useState)(`current`),[g,_]=(0,q.useState)(ht),[v,y]=(0,q.useState)(!0),[b,x]=(0,q.useState)(!1),[S,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(``),[ee,O]=(0,q.useState)(``),[te,M]=(0,q.useState)(null),[N,de]=(0,q.useState)(0),[F,I]=(0,q.useState)(null),[L,R]=(0,q.useState)(null),[fe,z]=(0,q.useState)(!1),B=(0,q.useRef)(0),H=(0,q.useCallback)(async()=>{let e=++B.current;y(!0),D(``);try{let t=await Ce({spaceId:d,query:o,status:p});if(e!==B.current)return;_(t),T(!0),t.selectedSpaceId&&t.selectedSpaceId!==d&&f(t.selectedSpaceId)}catch(t){e===B.current&&D($(t))}finally{e===B.current&&y(!1)}},[o,d,p]);(0,q.useEffect)(()=>(H(),()=>{B.current+=1}),[H,N]);let Se=async()=>{let e=g.nodes.at(-1),t=e?.validFrom||e?.createdAt;if(!t||b)return;let n=B.current;x(!0);try{let e=await Ce({spaceId:d,status:p,before:t});if(n!==B.current)return;_(t=>{let n=new Set(t.nodes.map(e=>e.id));return{...e,nodes:[...t.nodes,...e.nodes.filter(e=>!n.has(e.id))]}})}catch(e){n===B.current&&D($(e))}finally{x(!1)}},U=(0,q.useCallback)(()=>de(e=>e+1),[]),W=(0,q.useCallback)(t=>{e(t),U()},[e,U]),we=(0,q.useCallback)(e=>{O(``),M(null),W(e)},[W]),Te=(0,q.useMemo)(()=>[...g.spaces].sort((e,t)=>Number(t.kind===`global`)-Number(e.kind===`global`)),[g.spaces]),G=g.spaces.find(e=>e.id===d)||null,Ee=G?.kind===`chats`,K=!!o.trim(),De=(0,q.useMemo)(()=>dt(g.nodes,e=>e.validFrom||e.createdAt),[g.nodes]),Ae=e=>{let t=e;u(t),mt(t)},je=e=>{s(e),O(``),e.trim()&&l!==`timeline`&&u(`timeline`)},Pe=e=>{f(e),O(``),M(null)},Fe=async()=>{if(G&&await n({title:r(`memory:memoryPage.deleteMemorySpace`),message:r(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:J(G,r)}),confirmLabel:r(`memory:memoryPage.delete`)}))try{await ke(G.id),Pe(Q),W(r(`memory:memoryPage.memorySpaceDeleted`))}catch(e){D($(e))}},Ie=async()=>{try{let{markdown:t}=await Me(d===Q?``:d),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),i=document.createElement(`a`);i.href=n,i.download=`pisper-memory-${new Date().toISOString().slice(0,10)}.md`,i.click(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),e(r(`memory:memoryPage.exported`))}catch(e){D($(e))}},Le=async()=>{if(!fe){z(!0),D(``);try{let e=await Oe();W(e.ran?r(`memory:memoryPage.consolidated`):r(`memory:memoryPage.nothingToConsolidate`))}catch(e){D($(e))}finally{z(!1)}}},Re=async()=>{if(await n({title:r(`memory:memoryPage.clearEpisodes`),message:r(`memory:memoryPage.clearEpisodesConfirm`),confirmLabel:r(`memory:memoryPage.clearEpisodesAction`)}))try{let{cleared:e}=await Ne(d===Q?``:d);W(r(`memory:memoryPage.episodesCleared`,{count:e}))}catch(e){D($(e))}},ze=!!G&&G?.kind!==`global`&&!Ee,Be=e=>(0,X.jsx)($e,{id:e.id,fallback:e,spaces:g.spaces,refreshKey:N,onEdit:I,onChanged:W,onDeleted:we,requestConfirm:n}),We=e=>{let t=Ve[e.type]||Ve.concept,n=Ge(e,r),a=g.spaces.find(t=>t.id===e.spaceId);return(0,X.jsx)(he,{"data-memory-node":e.id,icon:(0,X.jsx)(t,{}),name:e.title,nameMeta:He(e.type,r),description:ee===e.id?void 0:e.content,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Ke(e.validFrom||e.createdAt,i),d===Q&&a?` · ${J(a,r)}`:``,` · ${Ue(e.sourceType,r)}`]}),status:n.length?(0,X.jsx)(Qe,{labels:n}):void 0,expanded:ee===e.id,onExpandedChange:t=>O(t?e.id:``),toggleLabel:e.title,detail:Be(e)},e.id)},Y=e=>e.kind===`today`?r(`memory:memoryPage.groupToday`):e.kind===`yesterday`?r(`memory:memoryPage.groupYesterday`):e.kind===`week`?r(`memory:memoryPage.groupThisWeek`):e.kind===`unknown`||!e.month?r(`memory:memoryPage.groupUnknown`):new Intl.DateTimeFormat(i,{year:`numeric`,month:`long`}).format(e.month),qe=r(K?`memory:memoryPage.noMatchingMemories`:p===`archived`?`memory:memoryPage.noArchivedMemories`:p===`history`?`memory:memoryPage.noHistoryVersions`:Ee?`memory:memoryPage.noProjectlessMemories`:`memory:memoryPage.noMemoriesInSpace`);return(0,X.jsx)(ce,{asChild:!0,value:l,onValueChange:Ae,className:`gap-0`,children:(0,X.jsxs)(ve,{title:r(`navigation:navigation.memory`),description:r(Ee?`memory:memoryPage.projectlessHint`:`memory:memoryPage.lede`),back:t&&{label:r(`navigation:sidebar.features`),ariaLabel:r(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,X.jsx)(ye,{search:(0,X.jsx)(me,{id:ne,value:o,onValueChange:je,placeholder:r(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:r(`navigation:more.clearSearch`)}),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(P,{type:`button`,className:`h-9`,disabled:!S,onClick:()=>I({spaceId:d===Q?`global`:d}),children:[(0,X.jsx)(C,{}),r(`memory:memoryPage.addMemory`)]}),(0,X.jsxs)(ae,{children:[(0,X.jsx)(A,{asChild:!0,children:(0,X.jsx)(P,{type:`button`,variant:`secondary`,size:`icon-lg`,className:`max-[650px]:max-w-11`,disabled:!S,"aria-label":r(`memory:memoryPage.moreActions`),title:r(`memory:memoryPage.moreActions`),children:(0,X.jsx)(m,{})})}),(0,X.jsxs)(ie,{align:`end`,children:[(0,X.jsx)(k,{onSelect:()=>R(`new`),children:r(`memory:memoryPage.newMemorySpace`)}),(0,X.jsx)(k,{disabled:!ze,onSelect:()=>G&&R(G),children:r(`memory:memoryPage.renameMemorySpace`)}),(0,X.jsx)(k,{variant:`destructive`,disabled:!ze,onSelect:()=>void Fe(),children:r(`memory:memoryPage.deleteMemorySpace`)}),(0,X.jsx)(re,{}),(0,X.jsx)(k,{onSelect:()=>void Ie(),children:r(`memory:memoryPage.exportMarkdown`)}),(0,X.jsx)(k,{disabled:fe,onSelect:()=>void Le(),children:r(`memory:memoryPage.consolidateNow`)}),(0,X.jsx)(k,{onSelect:()=>void Re(),children:r(`memory:memoryPage.clearEpisodes`)})]})]})]}),filters:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(se,{"aria-label":r(`memory:memoryPage.viewsLabel`),children:[(0,X.jsx)(oe,{value:`evolution`,children:r(`memory:memoryPage.evolutionView`)}),(0,X.jsx)(oe,{value:`timeline`,children:r(`memory:memoryPage.timelineView`)}),(0,X.jsx)(oe,{value:`sessions`,children:r(`memory:memoryPage.sessionsView`)}),(0,X.jsx)(oe,{value:`activity`,children:r(`memory:memoryPage.activityView`)})]}),(0,X.jsxs)(xe,{className:`w-[200px] max-w-full max-[650px]:w-full`,"aria-label":r(`memory:memoryPage.memorySpace`),value:d,disabled:!S,onChange:e=>Pe(e.target.value),children:[(0,X.jsx)(`option`,{value:Q,children:r(`memory:memoryPage.allSpaces`)}),Te.map(e=>(0,X.jsx)(`option`,{value:e.id,children:`${J(e,r)} · ${e.nodeCount}`},e.id))]})]}),l===`timeline`&&S&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[K?(0,X.jsxs)(`p`,{className:`m-0 text-[13px] font-medium text-content-muted tabular-nums`,children:[r(`memory:memoryPage.searchResults`),` · `,g.nodes.length]}):(0,X.jsx)(le,{"aria-label":r(`memory:memoryPage.statusFilterLabel`),value:p,onValueChange:e=>{h(e),O(``)},options:[{value:`current`,label:r(`memory:memoryPage.statusCurrent`),count:g.counts?.current},{value:`archived`,label:r(`memory:memoryPage.statusArchived`),count:g.counts?.archived},{value:`history`,label:r(`memory:memoryPage.statusHistory`),count:g.counts?.history}]}),(0,X.jsx)(P,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11`,loading:v,disabled:v,"aria-label":r(`memory:memoryPage.refresh`),title:r(`memory:memoryPage.refresh`),onClick:U,children:(0,X.jsx)(w,{})})]})]})}),children:[!S&&v?(0,X.jsx)(V,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):S?(0,X.jsxs)(X.Fragment,{children:[E&&(0,X.jsx)(be,{children:E}),(0,X.jsxs)(`div`,{className:`mt-5 min-w-0`,"aria-busy":v,children:[(0,X.jsxs)(j,{value:`evolution`,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(q.Suspense,{fallback:(0,X.jsx)(V,{kind:`loading`,title:r(`common:pageTemplate.loading`)}),children:(0,X.jsx)(ft,{spaceId:d,refreshKey:N,selectedId:te,onSelect:M})}),(0,X.jsx)(`div`,{role:`region`,"data-memory-detail":!0,"aria-label":r(`memory:memoryPage.selectedMemory`),className:`min-w-0 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:te?(0,X.jsx)($e,{id:te,spaces:g.spaces,refreshKey:N,withHeading:!0,onClose:()=>M(null),onEdit:I,onChanged:W,onDeleted:we,requestConfirm:n}):(0,X.jsx)(`p`,{className:`m-0 text-xs leading-normal text-content-muted`,children:r(`memory:memoryPage.selectAMemoryToViewDetails`)})})]}),(0,X.jsxs)(j,{value:`timeline`,className:`min-w-0`,"data-memory-timeline":!0,children:[g.nodes.length?K?(0,X.jsx)(ge,{children:g.nodes.map(We)}):De.map(e=>(0,X.jsx)(_e,{"data-memory-group":e.key,className:`mt-5 first:mt-0`,title:Y(e),count:e.items.length,children:(0,X.jsx)(ge,{children:e.items.map(We)})},e.key)):(0,X.jsx)(pe,{compact:!0,title:qe}),!K&&g.hasMore&&(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsx)(P,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:b,disabled:b,onClick:()=>void Se(),children:r(`memory:memoryPage.loadMore`)})})]}),(0,X.jsx)(j,{value:`sessions`,className:`min-w-0`,children:(0,X.jsx)(ct,{spaceId:d,spaces:g.spaces,refreshKey:N})}),(0,X.jsx)(j,{value:`activity`,className:`min-w-0`,children:(0,X.jsx)(Ze,{spaceId:d,refreshKey:N,onChanged:W})})]})]}):(0,X.jsx)(V,{kind:`error`,title:r(`memory:memoryPage.loadFailed`),description:E,action:(0,X.jsx)(P,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void H(),children:r(`common:pageTemplate.retry`)})}),F&&(0,X.jsx)(it,{spaces:Te,node:`id`in F?F:null,initialSpaceId:F.spaceId,onClose:()=>I(null),onSaved:e=>{I(null),W(e)}}),L&&(0,X.jsx)(at,{space:L===`new`?null:L,onClose:()=>R(null),onSaved:(e,t)=>{R(null),Pe(e.id),W(t)}})]})})}export{gt 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-47vsdOU3.js";import{t as i}from"./runtime-capabilities-store-BA14peh5.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-YxlR_1sv.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-CsOCclo6.js";import{t as i}from"./runtime-capabilities-store-MtXRlSIi.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-YxlR_1sv.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-47vsdOU3.js";import{t as i}from"./useQuery-DfOU-27z.js";import{t as a}from"./http-response-BHt8SJKV.js";import{n as o}from"./http-D4AhfBV1.js";import{a as s,n as c,t as l}from"./runtime-capabilities-ChJVNwRz.js";import{t as u}from"./runtime-capabilities-store-BA14peh5.js";import{m as d}from"./placements-Bca0DPqX.js";import{t as ee}from"./client-store-CQELNb0e.js";import{t as f}from"./usePhoneShell-Bn3ZlBYr.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-BgoXNekW.js";import{n as N,r as P}from"./config-search-CEVepeo_.js";import{s as F}from"./shortcuts-lvsdkhJa.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 a();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 o(`/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 a();return Math.floor(n)}function G(e){return o(`/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 a();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return o(`/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 a();return Math.floor(n)}function ae(e){return o(`/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-CsOCclo6.js";import{t as i}from"./useQuery-DfOU-27z.js";import{t as a}from"./http-response-DEs9jkgT.js";import{n as o}from"./http-B-XVZUum.js";import{a as s,n as c,t as l}from"./runtime-capabilities-ChJVNwRz.js";import{t as u}from"./runtime-capabilities-store-MtXRlSIi.js";import{m as d}from"./placements-9_rV4h0k.js";import{t as ee}from"./client-store-e4OXhDNK.js";import{t as f}from"./usePhoneShell-e-CScTJH.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-C8OUQmIW.js";import{n as N,r as P}from"./config-search-a0xjM1yz.js";import{s as F}from"./shortcuts-C6ddcUau.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 a();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 o(`/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 a();return Math.floor(n)}function G(e){return o(`/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 a();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return o(`/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 a();return Math.floor(n)}function ae(e){return o(`/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 +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-47vsdOU3.js";import{a as i}from"./http-response-BHt8SJKV.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-nax_z9Og.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-BeHwgRu7.js";import{r as S,t as C}from"./folder-paths-BxUl5vo9.js";import{n as w,t as T}from"./alert-DRIrgNI4.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
+ 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-CsOCclo6.js";import{a as i}from"./http-response-DEs9jkgT.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-DldLiTwf.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-D1GGkOTf.js";import{r as S,t as C}from"./folder-paths-CfRbR0Ik.js";import{n as w,t as T}from"./alert-DRIrgNI4.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-47vsdOU3.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-lvsdkhJa.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-CsOCclo6.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-C6ddcUau.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-47vsdOU3.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-QQPSgdSc.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-CsOCclo6.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-Bv_D4lVD.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-47vsdOU3.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-QQPSgdSc.js";import{t as a}from"./useSidebarModel-B9j6QP07.js";import"./public-CUh5RfpQ.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 justify-center gap-1.5 rounded-full bg-surface-muted 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 dark:bg-surface-active`,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 PhoneMenuButton};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CsOCclo6.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-Bv_D4lVD.js";import{t as a}from"./useSidebarModel-CShQi_Fw.js";import"./public-Dr8_scp5.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 justify-center gap-1.5 rounded-full bg-surface-muted 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 dark:bg-surface-active`,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 PhoneMenuButton};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-47vsdOU3.js";import{t as n}from"./search-D0mqDaf_.js";import{t as r}from"./square-pen-hYbjKh6A.js";import{PhoneMenuButton as i}from"./PhoneMenuButton-BtAGHyzX.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;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-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(i,{})}),(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 gap-2`,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)(n,{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)(r,{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-CsOCclo6.js";import{t as n}from"./search-D0mqDaf_.js";import{t as r}from"./square-pen-hYbjKh6A.js";import{PhoneMenuButton as i}from"./PhoneMenuButton-Coocnsrf.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;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-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(i,{})}),(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 gap-2`,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)(n,{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)(r,{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-47vsdOU3.js";import{t as i}from"./api-DMqZSAib.js";import{i as a}from"./runtime-capabilities-ChJVNwRz.js";import{t as o}from"./runtime-capabilities-store-BA14peh5.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,c as w,i as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./alert-dialog-DiUitBB0.js";import{t as se}from"./utils-C8uzG5AZ.js";import{n as ce,t as T}from"./button-CCcCN8tE.js";import{s as le}from"./shortcuts-lvsdkhJa.js";import{a as E,i as ue,l as D,o as O,s as de,t as k}from"./dialog-nax_z9Og.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./pick-system-directory-BeHwgRu7.js";import{n as fe,t as pe}from"./PageState-Cz6vFMXv.js";import{a as me,i as M,n as N,o as P,r as he,s as ge,t as F}from"./FeaturePage-DyRo_I02.js";import{t as I}from"./AppSelect-B15Hpk2W.js";import{c as _e,i as ve,s as ye}from"./app-primitives-BskZ4ZJj.js";import{a as L,i as be,n as xe,o as Se,r as Ce,s as we,t as Te}from"./tool-labels-D-3gybP7.js";var R=s(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),z=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`}]]),B=e(t(),1),V=n();function H(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ee({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,B.useState)(``),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``);return(0,B.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,V.jsx)(k,{open:e,onOpenChange:e=>!d&&t(e),children:(0,V.jsxs)(ue,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,V.jsxs)(de,{children:[(0,V.jsxs)(D,{className:`flex items-center gap-2`,children:[(0,V.jsx)(z,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,V.jsx)(E,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,V.jsxs)(`div`,{className:`grid gap-3`,children:[(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,V.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,V.jsx)(A,{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,V.jsx)(T,{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 j(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,V.jsx)(p,{})})]})]}),l&&(0,V.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,V.jsx)(c,{className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,V.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`),` · `,H(l.byteCount)]})]})]}),(0,V.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,V.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,V.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,V.jsx)(x,{className:`mt-0.5 shrink-0`,size:15}),(0,V.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,V.jsxs)(ve,{className:`m-0`,children:[(0,V.jsx)(x,{size:14}),(0,V.jsx)(`span`,{children:m})]})]}),(0,V.jsxs)(O,{children:[(0,V.jsx)(T,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,V.jsxs)(T,{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,V.jsx)(ce,{className:`text-current`}):l?(0,V.jsx)(z,{}):(0,V.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var U=[`tool`,`prompt`,`skill`];function W(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>U.includes(e)):[];return t.length?t:[`tool`]}function G(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var De=[`all`,`builtin`,`local`],Oe={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,computer_use:R,generate_visual:m};function K(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function ke(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function Ae(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 je(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function Me(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Ne(e,t){return L({id:e.name,name:e.label},t)}function q(e,t){return e.pluginSource===`pi`?e.pluginName:Ce(e.pluginName,t)}function Pe({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,V.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,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,V.jsxs)(I,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,V.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,V.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,V.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,V.jsxs)(I,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,V.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,V.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,V.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,V.jsx)(A,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,V.jsxs)(T,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,V.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function Fe({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,B.useState)(``),[l,d]=(0,B.useState)(null),[f,p]=(0,B.useState)([]),[m,g]=(0,B.useState)(!1),[_,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),S=(0,B.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,B.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(``)}}},te=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())},ne=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(``)}}},re=U.map(e=>({type:e,items:f.filter(t=>W(t).includes(e))})).filter(e=>e.items.length>0);return(0,V.jsxs)(V.Fragment,{children:[re.map(e=>(0,V.jsx)(P,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${G(e.type,o)}`,count:e.items.length,children:(0,V.jsx)(N,{children:e.items.map(t=>(0,V.jsx)(M,{icon:(0,V.jsx)(h,{}),name:(0,V.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,V.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void ne(t),children:[(0,V.jsx)(ee,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,V.jsxs)(P,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(T,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,V.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,V.jsxs)(T,{type:`button`,variant:`secondary`,size:`sm`,onClick:te,disabled:!!_,children:[(0,V.jsx)(z,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,V.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),S(s)},children:[(0,V.jsx)(A,{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,V.jsxs)(T,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,V.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),b&&(0,V.jsx)(F,{className:`mt-0 mb-3`,children:b}),C.length>0&&(0,V.jsx)(N,{children:C.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,V.jsx)(M,{icon:(0,V.jsx)(h,{}),name:(0,V.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,V.jsx)(T,{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 J({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=le(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?De:De.slice(0,2),[p,m]=(0,B.useState)(``),[h,v]=(0,B.useState)(null),[y,E]=(0,B.useState)([]),[ue,D]=(0,B.useState)(``),[O,de]=(0,B.useState)(`all`),[k,A]=(0,B.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[j,F]=(0,B.useState)(!1),[I,L]=(0,B.useState)(!1),[Ce,R]=(0,B.useState)(!1),[H,U]=(0,B.useState)(null),[W,G]=(0,B.useState)(!1),[J,Y]=(0,B.useState)(``),[Ie,Le]=(0,B.useState)(!1),X=(0,B.useCallback)(e=>{v(e),E(e.plugins),A(e.webSearch)},[]),Z=(0,B.useCallback)(async()=>{Y(``);try{X(await i(`/api/plugins`))}catch(e){Y(e instanceof Error?e.message:String(e))}},[X]);(0,B.useEffect)(()=>{Z()},[Z]);let Re=(0,B.useMemo)(()=>Ae(y),[y]),ze=(0,B.useMemo)(()=>ke(y),[y]),Q=h?!Me(ze,h.enabledTools)||JSON.stringify(je(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(k)!==JSON.stringify(h.webSearch):!1,Be=(0,B.useCallback)(async()=>{if(!j){if(!h||!Q){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}F(!0),Y(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:ze,webSearch:k,piExtensions:je(y)})});X(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[X,h,Q,y,ze,e,j,c,k]),Ve=async()=>{L(!0),Y(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(k)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);Y(n),e(n,`error`)}finally{L(!1)}},He=(e,t,n)=>{E(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)}}))},Ue=()=>!Q||(Y(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),We=async()=>{if(!(!H||W)){G(!0),Y(``);try{X(await i(`/api/plugins/${encodeURIComponent(H.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:H.pluginName})),D(``),U(null)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{G(!1)}}},Ge=c(`navigation:navigation.plugins`),Ke=p.trim().toLowerCase(),$=Re.filter(e=>O!==`all`&&e.pluginSource!==O?!1:[Ne(e,c),e.name,e.description,q(e,c),e.pluginId].join(` `).toLowerCase().includes(Ke));return(0,V.jsxs)(he,{title:Ge,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,V.jsx)(ge,{search:(0,V.jsx)(me,{id:S,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Ge}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,V.jsxs)(V.Fragment,{children:[d&&(0,V.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Ue()&&R(!0),children:[(0,V.jsx)(z,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,V.jsxs)(T,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:j,disabled:!h||j,onClick:()=>void Be(),children:[(0,V.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,V.jsx)(_e,{options:f.map(e=>K(e,c)),value:K(O,c),onChange:e=>de(f.find(t=>K(t,c)===e)||`all`)})}),children:[h?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,V.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[Re.filter(e=>e.enabled).length,`/`,Re.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:Q&&(0,V.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,V.jsx)(N,{className:`plugin-tool-grid`,children:$.map(e=>{let t=Oe[e.name]||g,n=Ne(e,c);return(0,V.jsx)(M,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,V.jsx)(t,{}),name:(0,V.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${q(e,c)} · ${Se(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,V.jsx)(ye,{value:e.enabled,onChange:t=>He(e.pluginId,e.name,t),ariaLabel:n}),expanded:ue===e.name,onExpandedChange:t=>D(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,V.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:be({id:e.name,description:e.description},c)}),(0,V.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,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,V.jsxs)(`dd`,{className:`tabular-nums`,children:[q(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,V.jsx)(`dd`,{className:se((Te(e.risk)||xe(e.risk))&&`font-medium text-content!`),children:Se(e.risk,c)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,V.jsx)(`dd`,{children:we({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,V.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,V.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,V.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,V.jsx)(Pe,{value:k,testing:I,onChange:A,onTest:Ve}),!e.pluginBuiltIn&&(0,V.jsxs)(T,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Ue()&&U(e),children:[(0,V.jsx)(ee,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,V.jsx)(pe,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,V.jsx)(Fe,{query:p,notify:e,requestText:n,requestConfirm:s})]}):J?(0,V.jsx)(fe,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:J,action:(0,V.jsx)(T,{variant:`secondary`,className:`max-[650px]:h-11`,loading:Ie,disabled:Ie,onClick:()=>{Le(!0),Z().finally(()=>Le(!1))},children:c(`common:pageTemplate.retry`)})}):(0,V.jsx)(fe,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,V.jsx)(Ee,{open:Ce,onOpenChange:R,onInstalled:Z}),(0,V.jsx)(oe,{open:!!H,onOpenChange:e=>!e&&!W&&U(null),children:(0,V.jsxs)(te,{className:`z-[220]`,children:[(0,V.jsxs)(ae,{children:[(0,V.jsx)(w,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,V.jsx)(C,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:H?.pluginName||``})})]}),(0,V.jsxs)(re,{children:[(0,V.jsx)(ie,{disabled:W,children:c(`common:ui.cancel`)}),(0,V.jsxs)(ne,{variant:`destructive`,disabled:W,onClick:We,children:[W&&(0,V.jsx)(ce,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),J&&h&&(0,V.jsxs)(ve,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,V.jsx)(x,{size:13}),J]})]})}export{J 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-CsOCclo6.js";import{t as i}from"./api-D1flkoh7.js";import{i as a}from"./runtime-capabilities-ChJVNwRz.js";import{t as o}from"./runtime-capabilities-store-MtXRlSIi.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,c as w,i as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./alert-dialog-DiUitBB0.js";import{t as se}from"./utils-C8uzG5AZ.js";import{n as ce,t as T}from"./button-CCcCN8tE.js";import{s as le}from"./shortcuts-C6ddcUau.js";import{a as E,i as ue,l as D,o as O,s as de,t as k}from"./dialog-DldLiTwf.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./pick-system-directory-D1GGkOTf.js";import{n as fe,t as pe}from"./PageState-Cz6vFMXv.js";import{a as me,i as M,n as N,o as P,r as he,s as ge,t as F}from"./FeaturePage-DEjUrI25.js";import{t as I}from"./AppSelect-B15Hpk2W.js";import{c as _e,i as ve,s as ye}from"./app-primitives-BskZ4ZJj.js";import{a as L,i as be,n as xe,o as Se,r as Ce,s as we,t as Te}from"./tool-labels-D-3gybP7.js";var R=s(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),z=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`}]]),B=e(t(),1),V=n();function H(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ee({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,B.useState)(``),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``);return(0,B.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,V.jsx)(k,{open:e,onOpenChange:e=>!d&&t(e),children:(0,V.jsxs)(ue,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,V.jsxs)(de,{children:[(0,V.jsxs)(D,{className:`flex items-center gap-2`,children:[(0,V.jsx)(z,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,V.jsx)(E,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,V.jsxs)(`div`,{className:`grid gap-3`,children:[(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,V.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,V.jsx)(A,{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,V.jsx)(T,{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 j(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,V.jsx)(p,{})})]})]}),l&&(0,V.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,V.jsx)(c,{className:`size-4`})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,V.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`),` · `,H(l.byteCount)]})]})]}),(0,V.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,V.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,V.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,V.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,V.jsx)(x,{className:`mt-0.5 shrink-0`,size:15}),(0,V.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,V.jsxs)(ve,{className:`m-0`,children:[(0,V.jsx)(x,{size:14}),(0,V.jsx)(`span`,{children:m})]})]}),(0,V.jsxs)(O,{children:[(0,V.jsx)(T,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,V.jsxs)(T,{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,V.jsx)(ce,{className:`text-current`}):l?(0,V.jsx)(z,{}):(0,V.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var U=[`tool`,`prompt`,`skill`];function W(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>U.includes(e)):[];return t.length?t:[`tool`]}function G(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var De=[`all`,`builtin`,`local`],Oe={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,computer_use:R,generate_visual:m};function K(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function ke(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function Ae(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 je(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function Me(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Ne(e,t){return L({id:e.name,name:e.label},t)}function q(e,t){return e.pluginSource===`pi`?e.pluginName:Ce(e.pluginName,t)}function Pe({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,V.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,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,V.jsxs)(I,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,V.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,V.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,V.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,V.jsxs)(I,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,V.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,V.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,V.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,V.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,V.jsx)(A,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,V.jsxs)(T,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,V.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function Fe({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,B.useState)(``),[l,d]=(0,B.useState)(null),[f,p]=(0,B.useState)([]),[m,g]=(0,B.useState)(!1),[_,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),S=(0,B.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,B.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(``)}}},te=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())},ne=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(``)}}},re=U.map(e=>({type:e,items:f.filter(t=>W(t).includes(e))})).filter(e=>e.items.length>0);return(0,V.jsxs)(V.Fragment,{children:[re.map(e=>(0,V.jsx)(P,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${G(e.type,o)}`,count:e.items.length,children:(0,V.jsx)(N,{children:e.items.map(t=>(0,V.jsx)(M,{icon:(0,V.jsx)(h,{}),name:(0,V.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,V.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void ne(t),children:[(0,V.jsx)(ee,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,V.jsxs)(P,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(T,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,V.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,V.jsxs)(T,{type:`button`,variant:`secondary`,size:`sm`,onClick:te,disabled:!!_,children:[(0,V.jsx)(z,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,V.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),S(s)},children:[(0,V.jsx)(A,{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,V.jsxs)(T,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,V.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),b&&(0,V.jsx)(F,{className:`mt-0 mb-3`,children:b}),C.length>0&&(0,V.jsx)(N,{children:C.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,V.jsx)(M,{icon:(0,V.jsx)(h,{}),name:(0,V.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,V.jsx)(T,{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 J({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=le(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?De:De.slice(0,2),[p,m]=(0,B.useState)(``),[h,v]=(0,B.useState)(null),[y,E]=(0,B.useState)([]),[ue,D]=(0,B.useState)(``),[O,de]=(0,B.useState)(`all`),[k,A]=(0,B.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[j,F]=(0,B.useState)(!1),[I,L]=(0,B.useState)(!1),[Ce,R]=(0,B.useState)(!1),[H,U]=(0,B.useState)(null),[W,G]=(0,B.useState)(!1),[J,Y]=(0,B.useState)(``),[Ie,Le]=(0,B.useState)(!1),X=(0,B.useCallback)(e=>{v(e),E(e.plugins),A(e.webSearch)},[]),Z=(0,B.useCallback)(async()=>{Y(``);try{X(await i(`/api/plugins`))}catch(e){Y(e instanceof Error?e.message:String(e))}},[X]);(0,B.useEffect)(()=>{Z()},[Z]);let Re=(0,B.useMemo)(()=>Ae(y),[y]),ze=(0,B.useMemo)(()=>ke(y),[y]),Q=h?!Me(ze,h.enabledTools)||JSON.stringify(je(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(k)!==JSON.stringify(h.webSearch):!1,Be=(0,B.useCallback)(async()=>{if(!j){if(!h||!Q){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}F(!0),Y(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:ze,webSearch:k,piExtensions:je(y)})});X(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[X,h,Q,y,ze,e,j,c,k]),Ve=async()=>{L(!0),Y(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(k)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);Y(n),e(n,`error`)}finally{L(!1)}},He=(e,t,n)=>{E(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)}}))},Ue=()=>!Q||(Y(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),We=async()=>{if(!(!H||W)){G(!0),Y(``);try{X(await i(`/api/plugins/${encodeURIComponent(H.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:H.pluginName})),D(``),U(null)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{G(!1)}}},Ge=c(`navigation:navigation.plugins`),Ke=p.trim().toLowerCase(),$=Re.filter(e=>O!==`all`&&e.pluginSource!==O?!1:[Ne(e,c),e.name,e.description,q(e,c),e.pluginId].join(` `).toLowerCase().includes(Ke));return(0,V.jsxs)(he,{title:Ge,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,V.jsx)(ge,{search:(0,V.jsx)(me,{id:S,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Ge}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,V.jsxs)(V.Fragment,{children:[d&&(0,V.jsxs)(T,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Ue()&&R(!0),children:[(0,V.jsx)(z,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,V.jsxs)(T,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:j,disabled:!h||j,onClick:()=>void Be(),children:[(0,V.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,V.jsx)(_e,{options:f.map(e=>K(e,c)),value:K(O,c),onChange:e=>de(f.find(t=>K(t,c)===e)||`all`)})}),children:[h?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,V.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[Re.filter(e=>e.enabled).length,`/`,Re.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:Q&&(0,V.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,V.jsx)(N,{className:`plugin-tool-grid`,children:$.map(e=>{let t=Oe[e.name]||g,n=Ne(e,c);return(0,V.jsx)(M,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,V.jsx)(t,{}),name:(0,V.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${q(e,c)} · ${Se(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,V.jsx)(ye,{value:e.enabled,onChange:t=>He(e.pluginId,e.name,t),ariaLabel:n}),expanded:ue===e.name,onExpandedChange:t=>D(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,V.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:be({id:e.name,description:e.description},c)}),(0,V.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,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,V.jsxs)(`dd`,{className:`tabular-nums`,children:[q(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,V.jsx)(`dd`,{className:se((Te(e.risk)||xe(e.risk))&&`font-medium text-content!`),children:Se(e.risk,c)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,V.jsx)(`dd`,{children:we({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,V.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,V.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,V.jsx)(b,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,V.jsx)(Pe,{value:k,testing:I,onChange:A,onTest:Ve}),!e.pluginBuiltIn&&(0,V.jsxs)(T,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Ue()&&U(e),children:[(0,V.jsx)(ee,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,V.jsx)(pe,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,V.jsx)(Fe,{query:p,notify:e,requestText:n,requestConfirm:s})]}):J?(0,V.jsx)(fe,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:J,action:(0,V.jsx)(T,{variant:`secondary`,className:`max-[650px]:h-11`,loading:Ie,disabled:Ie,onClick:()=>{Le(!0),Z().finally(()=>Le(!1))},children:c(`common:pageTemplate.retry`)})}):(0,V.jsx)(fe,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,V.jsx)(Ee,{open:Ce,onOpenChange:R,onInstalled:Z}),(0,V.jsx)(oe,{open:!!H,onOpenChange:e=>!e&&!W&&U(null),children:(0,V.jsxs)(te,{className:`z-[220]`,children:[(0,V.jsxs)(ae,{children:[(0,V.jsx)(w,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,V.jsx)(C,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:H?.pluginName||``})})]}),(0,V.jsxs)(re,{children:[(0,V.jsx)(ie,{disabled:W,children:c(`common:ui.cancel`)}),(0,V.jsxs)(ne,{variant:`destructive`,disabled:W,onClick:We,children:[W&&(0,V.jsx)(ce,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),J&&h&&(0,V.jsxs)(ve,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,V.jsx)(x,{size:13}),J]})]})}export{J as PluginsPage};
@@ -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-47vsdOU3.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-nax_z9Og.js";import{t as d}from"./safe-mode-instance-CpApZsNO.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-CsOCclo6.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-DldLiTwf.js";import{t as d}from"./safe-mode-instance-CpOBP8Nz.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};