@zzusp/ccsm 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +236 -232
- package/dist/assets/DiskUsage-BY6XwffG.js +2 -0
- package/dist/assets/DiskUsage-BY6XwffG.js.map +1 -0
- package/dist/assets/{ImportPage-b8NORa8b.js → ImportPage-Cwq5bx7G.js} +2 -2
- package/dist/assets/ImportPage-Cwq5bx7G.js.map +1 -0
- package/dist/assets/MarkdownContent-BFu7Nkk_.js +2 -0
- package/dist/assets/MarkdownContent-BFu7Nkk_.js.map +1 -0
- package/dist/assets/{ProjectMemory-aSV8UzQ9.js → ProjectMemory-CcE3KbUK.js} +2 -2
- package/dist/assets/ProjectMemory-CcE3KbUK.js.map +1 -0
- package/dist/assets/{charts-A5eNHLjX.js → charts-jxJqXXUr.js} +2 -2
- package/dist/assets/{charts-A5eNHLjX.js.map → charts-jxJqXXUr.js.map} +1 -1
- package/dist/assets/index-CrWxV6sb.css +1 -0
- package/dist/assets/index-DTbWl1jb.js +11 -0
- package/dist/assets/index-DTbWl1jb.js.map +1 -0
- package/dist/assets/markdown-Bag5rX3T.js +30 -0
- package/dist/assets/markdown-Bag5rX3T.js.map +1 -0
- package/dist/assets/{query-C1K1uQRu.js → query-CS7JQ86v.js} +2 -2
- package/dist/assets/{query-C1K1uQRu.js.map → query-CS7JQ86v.js.map} +1 -1
- package/dist/assets/{react-W0jzChlo.js → react-CPkiFScu.js} +10 -10
- package/dist/assets/{react-W0jzChlo.js.map → react-CPkiFScu.js.map} +1 -1
- package/dist/assets/{router-DfbutHY3.js → router-DwaHAh1G.js} +2 -2
- package/dist/assets/{router-DfbutHY3.js.map → router-DwaHAh1G.js.map} +1 -1
- package/dist/assets/vendor-Cs8vYp-N.js +27 -0
- package/dist/assets/vendor-Cs8vYp-N.js.map +1 -0
- package/dist/favicon.svg +7 -7
- package/dist/index.html +30 -30
- package/package.json +24 -11
- package/server/index.ts +4 -0
- package/server/lib/active-sessions.test.ts +119 -0
- package/server/lib/active-sessions.ts +95 -95
- package/server/lib/bundle.test.ts +182 -0
- package/server/lib/bundle.ts +86 -86
- package/server/lib/claude-paths.test.ts +126 -0
- package/server/lib/claude-paths.ts +43 -36
- package/server/lib/cleanup-suggestions.ts +131 -0
- package/server/lib/constants.ts +8 -7
- package/server/lib/delete-project.ts +100 -100
- package/server/lib/delete.test.ts +244 -0
- package/server/lib/delete.ts +192 -203
- package/server/lib/disk-usage.ts +81 -83
- package/server/lib/encode-cwd.ts +24 -24
- package/server/lib/export-bundle.ts +236 -236
- package/server/lib/export-import-bundle.test.ts +337 -0
- package/server/lib/fs-size.ts +38 -38
- package/server/lib/import-bundle.ts +488 -488
- package/server/lib/load-memory.ts +120 -120
- package/server/lib/load-session.ts +209 -209
- package/server/lib/modified-files.test.ts +280 -0
- package/server/lib/modified-files.ts +228 -0
- package/server/lib/open-folder.ts +47 -40
- package/server/lib/parse-jsonl.ts +160 -107
- package/server/lib/port.ts +23 -23
- package/server/lib/safe-id.test.ts +41 -0
- package/server/lib/safe-id.ts +6 -6
- package/server/lib/safe-remove.test.ts +73 -0
- package/server/lib/safe-remove.ts +25 -0
- package/server/lib/scan.ts +289 -183
- package/server/lib/search-all.ts +130 -130
- package/server/lib/search-session.ts +203 -203
- package/server/lib/system-tags.ts +20 -20
- package/server/lib/update.ts +67 -0
- package/server/lib/version.test.ts +39 -0
- package/server/lib/version.ts +117 -0
- package/server/routes/disk-cleanup.ts +54 -0
- package/server/routes/disk.ts +9 -9
- package/server/routes/import.ts +87 -87
- package/server/routes/projects.ts +104 -104
- package/server/routes/search.ts +79 -79
- package/server/routes/sessions.ts +130 -81
- package/server/routes/version.ts +34 -0
- package/server/types.ts +1 -1
- package/shared/constants.ts +7 -2
- package/shared/types.ts +513 -359
- package/dist/assets/DiskUsage-Bq4VaoUA.js +0 -2
- package/dist/assets/DiskUsage-Bq4VaoUA.js.map +0 -1
- package/dist/assets/ImportPage-b8NORa8b.js.map +0 -1
- package/dist/assets/ProjectMemory-aSV8UzQ9.js.map +0 -1
- package/dist/assets/index-DLATR3tZ.js +0 -5
- package/dist/assets/index-DLATR3tZ.js.map +0 -1
- package/dist/assets/index-DLDtbkux.css +0 -1
- package/dist/assets/vendor-CH80ylbS.js +0 -19
- package/dist/assets/vendor-CH80ylbS.js.map +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DiskUsage-Bq4VaoUA.js","assets/react-W0jzChlo.js","assets/query-C1K1uQRu.js","assets/vendor-CH80ylbS.js","assets/charts-A5eNHLjX.js","assets/router-DfbutHY3.js","assets/ProjectMemory-aSV8UzQ9.js","assets/ImportPage-b8NORa8b.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,r as l,a as st,R as nt}from"./react-W0jzChlo.js";import{u as ue,a as J,b as _,Q as at,c as it}from"./query-C1K1uQRu.js";import{u as Oe,a as lt,L as G,b as Ue,c as ct,R as dt,d as H,B as mt}from"./router-DfbutHY3.js";import{G as B}from"./vendor-CH80ylbS.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function o(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(n){if(n.ep)return;n.ep=!0;const a=o(n);fetch(n.href,a)}})();const ut="modulepreload",pt=function(t){return"/"+t},je={},pe=function(r,o,s){let n=Promise.resolve();if(o&&o.length>0){let i=function(p){return Promise.all(p.map(u=>Promise.resolve(u).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));n=i(o.map(p=>{if(p=pt(p),p in je)return;je[p]=!0;const u=p.endsWith(".css"),g=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":ut,u||(v.as="script"),v.crossOrigin="",v.href=p,m&&v.setAttribute("nonce",m),document.head.appendChild(v),u)return new Promise((h,c)=>{v.addEventListener("load",h),v.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(i){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=i,window.dispatchEvent(d),!d.defaultPrevented)throw i}return n.then(i=>{for(const d of i||[])d.status==="rejected"&&a(d.reason);return r().catch(a)})};function se({label:t,className:r}){return e.jsxs("div",{role:"status","aria-live":"polite",className:["flex flex-col gap-2.5",r].filter(Boolean).join(" "),children:[e.jsx("span",{className:"eyebrow tabular-nums",children:t}),e.jsx("span",{"aria-hidden":!0,className:"loading-rule"})]})}function xt({className:t}){return e.jsxs("span",{"aria-hidden":!0,className:["loading-dots",t].filter(Boolean).join(" "),children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}const le=1024,ce=le*1024,be=ce*1024;function E(t){return!Number.isFinite(t)||t<=0?"0 B":t>=be?`${(t/be).toFixed(2)} GB`:t>=ce?`${(t/ce).toFixed(1)} MB`:t>=le?`${(t/le).toFixed(1)} KB`:`${t} B`}function Y(t){if(!t)return"—";const r=new Date(t).getTime();if(Number.isNaN(r))return t;const o=Date.now()-r,s=Math.round(o/1e3);if(s<60)return`${s}s ago`;const n=Math.round(s/60);if(n<60)return`${n}m ago`;const a=Math.round(n/60);if(a<48)return`${a}h ago`;const i=Math.round(a/24);if(i<30)return`${i}d ago`;const d=Math.round(i/30);return d<12?`${d}mo ago`:`${Math.round(d/12)}y ago`}function xe(t){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?t:r.toLocaleString()}const Ke=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function ht(t,r){l.useEffect(()=>{function o(s){(Ke?s.metaKey:s.ctrlKey)&&(s.key!=="k"&&s.key!=="K"||(s.preventDefault(),r()))}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,r])}const qe=Ke?"⌘K":"Ctrl+K",We="locale",ke={en:{"app.brand.title":"Claude Sessions","app.brand.subtitle":"local archive","app.brand.footnote":"local · read-only by default","nav.workspace":"Workspace","nav.projects":"Projects","nav.disk":"Disk usage","nav.import":"Import","nav.theme":"Theme","nav.language":"Language","nav.toggleNav":"Toggle navigation","nav.closeNav":"Close navigation","common.loading":"loading","common.scanning":"scanning ~/.claude/projects/…","common.computing":"computing…","common.readingSessions":"reading sessions…","common.loadingSession":"loading session…","common.noData":"no data","common.entries":"entries","common.entry":"entry","common.selectAll":"select all","common.deselectAll":"deselect all","common.cancel":"Cancel","common.done":"Done","common.expand":"expand","common.collapse":"collapse","common.system":"system","common.onlyUser":"only me","common.missing":"missing","common.noSessions":"No sessions in this project.","common.noProjects":"No projects found.","common.noMessagesMatch":"No messages match.","common.failedProjects":"Failed to load projects","common.failedSessions":"Failed to load sessions","common.failedSession":"Failed to load","common.failedMemory":"Failed to load memory","common.failed":"Failed","common.searchPlaceholder":"Search this session…","common.loadEarlier":"Load earlier (+{{n}})","common.scrollToTop":"Jump to top","common.scrollToBottom":"Jump to bottom","projects.title":"Projects","projects.tagline":"Every directory you've touched with Claude Code, sorted by recency. Open one to inspect or prune its sessions.","projects.indexHeading":"Index","projects.stat.projects":"Projects","projects.stat.sessions":"Sessions","projects.stat.onDisk":"On disk","projects.card.eyebrow":"project","projects.card.sessions":"Sessions","projects.card.onDisk":"On disk","projects.card.lastSeen":"Last seen","projects.warn.rootMissing":"Claude root {{root}} doesn't exist on this machine — nothing to display.","project.eyebrow":"Project","project.warn.missingDir":"Directory missing on disk","project.action.openFolder":"Open folder","project.action.openFolderTooltipMissing":"Directory no longer exists on disk","project.action.openFolderFailed":"Failed to open folder: {{msg}}","project.action.delete":"Delete · {{n}}","project.meta.sessions":"Sessions","project.meta.onDisk":"On disk","project.meta.live":"Live","project.meta.recent":"Recent","project.heading":"Sessions","project.col.title":"Title","project.col.msgs":"Msgs","project.col.last":"Last","project.col.size":"Size","project.col.status":"Status","session.crumbProjects":"Projects","session.action.delete":"Delete","session.action.deleteTooltipBlocked":"Session metadata not available yet","session.action.rename":"Rename","session.action.renameTooltipLive":"Live PID {{pid}} owns this session — close the running claude first","session.tagline":"Started {{started}} · last touched {{lastTouched}}{{branchPart}}","session.tagline.branch":" · branch {{branch}}","session.meta.messages":"Messages","session.meta.size":"Size","session.meta.version":"Version","session.meta.started":"Started","session.truncated":"Session truncated to first {{n}} messages.","session.shown":"{{shown}} / {{total}}","message.role.you":"You","message.role.claude":"Claude","message.role.tool":"Tool","message.role.system":"system","tool.use":"tool","tool.result":"tool result","tool.error":"tool error","tool.thinking":"thinking","tool.thinkingEncrypted":"Content is encrypted, no readable text.","tool.image":"image","status.live":"live · pid {{pid}}","status.recent":"recent","status.idle":"idle","status.tooltip.live":"PID {{pid}} is alive and registered for this session","status.tooltip.recent":"jsonl modified within the last {{n}} minutes","status.tooltip.idle":"idle — safe to delete","disk.tagline":"How `~/.claude/` is using your disk: which projects carry the most weight, and which sessions are heaviest.","disk.title":"Disk usage","disk.meta.total":"Total","disk.meta.projects":"Projects","disk.meta.sessions":"Sessions","disk.stat.total":"Total on disk","disk.stat.acrossProjects":"across {{n}} projects","disk.stat.sessions":"Sessions","disk.stat.largest":"largest {{size}}","disk.stat.months":"Months tracked","disk.composition.title":"Composition","disk.composition.subtitle":"bytes per project","disk.composition.total":"Total","disk.cadence.title":"Cadence","disk.cadence.subtitle":"MB per month","disk.heaviest.title":"Heaviest sessions","disk.heaviest.top":"top {{n}}","disk.col.num":"#","disk.col.title":"Title","disk.col.project":"Project","disk.col.last":"Last","disk.col.size":"Size","memory.title":"Memory","memory.empty":"No memory recorded yet for this project.","memory.action.open":"Memory","memory.action.openCount":"Memory · {{n}}","memory.meta.entries":"Entries","memory.meta.types":"Types","memory.meta.lastUpdate":"Last update","memory.type.user":"User","memory.type.feedback":"Feedback","memory.type.project":"Project","memory.type.reference":"Reference","memory.type.other":"Untyped","memory.loading":"reading memory…","memory.search.placeholder":"Search title, hook, or body…","memory.search.hint":"Press {{hotkey}} to focus","memory.filter.all":"All","memory.sort.label":"Sort","memory.sort.index":"MEMORY.md order","memory.sort.recent":"Recent first","memory.sort.name":"Name A→Z","memory.sort.size":"Largest first","memory.list.noResults":"No entries match.","memory.list.count":"{{n}} of {{total}}","memory.cover.title":"Memory index","memory.cover.subtitle":"MEMORY.md","memory.cover.viewRaw":"view raw","memory.cover.showAll":"Show all ({{n}})","memory.cover.collapse":"Collapse","memory.cover.missingTooltip":"No matching entry file","memory.cover.orphan":"Not in index","memory.empty.title":"No memory yet","memory.empty.body":"Claude saves long-term notes here when you ask it to remember something or when it observes a stable preference. Memory files live under ~/.claude/projects/<id>/memory/.","memory.empty.orphanIndex":"The index references {{n}} entries, but none of them have memory files yet.","memory.section.untyped":"Untyped","memory.drawer.close":"Close","memory.drawer.indexHook":"Index hook","memory.drawer.notFound.title":"Entry not found","memory.drawer.notFound.body":"The selected memory file may have been removed. It might still appear in the curated index above.","memory.raw.title":"MEMORY.md","memory.raw.subtitle":"Curated index — raw source","delete.eyebrow.confirm":"Confirm deletion","delete.eyebrow.result":"Result","delete.title.confirm":"Delete sessions","delete.title.result":"Sessions removed","delete.summary":"{{n}} will be removed · {{skipped}} skipped · ~{{free}} to free","delete.skipped.heading":"These {{n}} will be skipped:","delete.skipped.reasonLive":"live PID {{pid}}","delete.skipped.reasonRecent":"modified within last {{n}} minutes","delete.skipped.reasonUnknown":"unknown","delete.success":"Deleted {{n}} session(s). {{free}} freed · {{lines}} history lines removed","delete.btn.confirm":"Delete {{n}} {{label}}","delete.btn.confirmPending":"Deleting…","delete.label.session":"session","delete.label.sessions":"sessions","delete.close":"Close","deleteProject.row.action":"Delete project","deleteProject.eyebrow.confirm":"Confirm deletion","deleteProject.eyebrow.result":"Result","deleteProject.title.confirm":"Delete project","deleteProject.title.result":"Project removed","deleteProject.summary":"{{n}} session(s) · ~{{free}} to free · directory will be removed","deleteProject.warning":"This removes every session in {{cwd}} along with its history.jsonl entries. Cannot be undone.","deleteProject.blocked.heading":"{{n}} session(s) are live or were modified in the last 5 minutes — nothing will be deleted. Try again later.","deleteProject.success":"Removed {{n}} session(s) and the project directory. {{free}} freed · {{lines}} history lines removed","deleteProject.successKept":"Removed {{n}} session(s). {{free}} freed · {{lines}} history lines removed · directory kept","deleteProject.btn.confirm":"Delete project","deleteProject.btn.confirmPending":"Deleting…","search.action.open":"Search sessions","search.placeholder":"Search across all sessions…","search.empty":"Type at least 2 characters to search across every session on disk.","search.refineQuery":"Type a longer query to refine the search.","search.scanning":"scanning…","search.noResults":"No matches.","search.error":"Search failed: {{msg}}","search.moreInSession":"+more in this session","search.moreSessions":"Showing first {{n}} sessions — refine your query for more.","search.summary":"{{matched}} session(s) · scanned {{scanned}} · {{ms}}ms","search.shortcut":"{{hint}} to open","search.escapeHint":"esc to close","search.kindText":"text","search.kindToolUse":"tool","search.kindToolResult":"tool result","search.kindThinking":"thinking","search.role.user":"You","search.role.assistant":"Claude","export.action":"Export","export.eyebrow.confirm":"Share across devices","export.eyebrow.result":"Result","export.title.confirm":"Export project","export.title.result":"Export complete","export.summary":"Bundle {{n}} session(s) + memory into a portable folder.","export.destLabel":"Destination folder","export.destPlaceholder":"e.g. D:\\sync\\claude-shared","export.destHint":"An absolute path outside ~/.claude. Drop it into a git repo or cloud drive to sync.","export.privacy":"This writes your conversations and memory outside the app. If you push the folder to a remote, those contents leave your machine.","export.btn.confirm":"Export","export.btn.pending":"Exporting…","export.success":"Exported {{sessions}} session(s) · {{memory}} memory file(s) · {{lines}} history line(s)","export.successDest":"Written to {{dest}}","export.close":"Close","import.title":"Import bundle","import.tagline":"Bring a project's sessions and memory from another device. Paths are remapped to this machine.","import.bundleLabel":"Bundle folder","import.bundlePlaceholder":"Path to an exported bundle","import.btn.load":"Load bundle","import.btn.recheck":"Re-check","import.btn.loading":"Loading…","import.source":"From {{platform}} · {{cwd}}","import.targetLabel":"Import into (this device)","import.targetHint":"Absolute path on this machine. Sessions are associated with this folder.","import.targetId":"Project id: {{id}}","import.suggestions":"Suggestions","import.suggestion.existing-project":"existing project","import.suggestion.original-path":"original path","import.suggestion.same-basename":"same folder name","import.policyLabel":"If a session already exists","import.policy.skip":"Skip","import.policy.overwrite-if-newer":"Overwrite if newer","import.policy.keep-both":"Keep both","import.sessions.heading":"Sessions","import.sessions.empty":"No sessions in this bundle.","import.action.create":"create","import.action.overwrite":"overwrite","import.action.keep-both":"keep both","import.action.skip":"skip","import.memory.heading":"Memory","import.memory.create":"create","import.memory.skip":"identical","import.memory.conflict":"conflict → {{name}}","import.history":"{{n}} history line(s) to add","import.btn.commit":"Import","import.btn.committing":"Importing…","import.result.title":"Import complete","import.result.summary":"Imported {{n}} session(s) · {{skipped}} skipped · {{memory}} memory file(s) · {{lines}} history line(s)","import.result.viewProject":"Open imported project","import.empty":"Enter a bundle folder path to begin."},zh:{"app.brand.title":"Claude 会话","app.brand.subtitle":"本地归档","app.brand.footnote":"本地 · 默认只读","nav.workspace":"工作区","nav.projects":"项目","nav.disk":"磁盘占用","nav.import":"导入","nav.theme":"主题","nav.language":"语言","nav.toggleNav":"切换导航","nav.closeNav":"关闭导航","common.loading":"加载中","common.scanning":"正在扫描 ~/.claude/projects/…","common.computing":"统计中…","common.readingSessions":"读取会话中…","common.loadingSession":"加载会话中…","common.noData":"暂无数据","common.entries":"项","common.entry":"项","common.selectAll":"全选","common.deselectAll":"取消全选","common.cancel":"取消","common.done":"完成","common.expand":"展开","common.collapse":"收起","common.system":"系统","common.onlyUser":"仅我","common.missing":"已不存在","common.noSessions":"该项目下暂无会话。","common.noProjects":"未发现项目。","common.noMessagesMatch":"没有匹配的消息。","common.failedProjects":"加载项目失败","common.failedSessions":"加载会话列表失败","common.failedSession":"加载失败","common.failedMemory":"加载记忆失败","common.failed":"失败","common.searchPlaceholder":"在此会话中搜索…","common.loadEarlier":"加载更早 (+{{n}})","common.scrollToTop":"回到顶部","common.scrollToBottom":"回到底部","projects.title":"项目","projects.tagline":"所有曾用 Claude Code 的工作目录,按最近活跃度排序。点击进入查看或清理其会话。","projects.indexHeading":"索引","projects.stat.projects":"项目数","projects.stat.sessions":"会话数","projects.stat.onDisk":"占用","projects.card.eyebrow":"项目","projects.card.sessions":"会话","projects.card.onDisk":"占用","projects.card.lastSeen":"最近","projects.warn.rootMissing":"Claude 根目录 {{root}} 在本机不存在 — 无可显示内容。","project.eyebrow":"项目","project.warn.missingDir":"目录已从磁盘删除","project.action.openFolder":"打开目录","project.action.openFolderTooltipMissing":"目录已不在本机磁盘上","project.action.openFolderFailed":"打开目录失败:{{msg}}","project.action.delete":"删除 · {{n}}","project.meta.sessions":"会话","project.meta.onDisk":"占用","project.meta.live":"运行中","project.meta.recent":"近期","project.heading":"会话","project.col.title":"标题","project.col.msgs":"消息","project.col.last":"最近","project.col.size":"大小","project.col.status":"状态","session.crumbProjects":"项目","session.action.delete":"删除","session.action.deleteTooltipBlocked":"暂无法获取该会话状态","session.action.rename":"重命名","session.action.renameTooltipLive":"运行中 PID {{pid}} 占用此会话 — 请先关闭对应的 claude","session.tagline":"开始于 {{started}} · 最后触达 {{lastTouched}}{{branchPart}}","session.tagline.branch":" · 分支 {{branch}}","session.meta.messages":"消息数","session.meta.size":"大小","session.meta.version":"版本","session.meta.started":"开始时间","session.truncated":"会话已截断至前 {{n}} 条消息。","session.shown":"{{shown}} / {{total}}","message.role.you":"我","message.role.claude":"Claude","message.role.tool":"工具","message.role.system":"系统","tool.use":"工具","tool.result":"工具返回","tool.error":"工具错误","tool.thinking":"思考","tool.thinkingEncrypted":"内容被加密,无可读文本。","tool.image":"图片","status.live":"运行中 · pid {{pid}}","status.recent":"近期","status.idle":"空闲","status.tooltip.live":"PID {{pid}} 仍在运行并绑定此会话","status.tooltip.recent":"jsonl 在过去 {{n}} 分钟内被修改","status.tooltip.idle":"空闲 — 可安全删除","disk.tagline":"`~/.claude/` 占用磁盘的全貌:哪些项目最沉,哪些会话最大。","disk.title":"磁盘占用","disk.meta.total":"总计","disk.meta.projects":"项目","disk.meta.sessions":"会话","disk.stat.total":"总占用","disk.stat.acrossProjects":"覆盖 {{n}} 个项目","disk.stat.sessions":"会话","disk.stat.largest":"最大 {{size}}","disk.stat.months":"月份覆盖","disk.composition.title":"构成","disk.composition.subtitle":"按项目占用","disk.composition.total":"合计","disk.cadence.title":"节奏","disk.cadence.subtitle":"每月 MB","disk.heaviest.title":"最沉的会话","disk.heaviest.top":"前 {{n}}","disk.col.num":"#","disk.col.title":"标题","disk.col.project":"项目","disk.col.last":"最近","disk.col.size":"大小","memory.title":"记忆","memory.empty":"该项目尚未沉淀任何记忆。","memory.action.open":"记忆","memory.action.openCount":"记忆 · {{n}}","memory.meta.entries":"条目数","memory.meta.types":"类型","memory.meta.lastUpdate":"最近更新","memory.type.user":"用户","memory.type.feedback":"反馈","memory.type.project":"项目","memory.type.reference":"外链","memory.type.other":"未分类","memory.loading":"读取记忆中…","memory.search.placeholder":"搜索标题、摘要或正文…","memory.search.hint":"按 {{hotkey}} 聚焦","memory.filter.all":"全部","memory.sort.label":"排序","memory.sort.index":"MEMORY.md 顺序","memory.sort.recent":"最近修改","memory.sort.name":"名称 A→Z","memory.sort.size":"体积大→小","memory.list.noResults":"没有匹配的条目。","memory.list.count":"{{n}} / {{total}}","memory.cover.title":"记忆索引","memory.cover.subtitle":"MEMORY.md","memory.cover.viewRaw":"查看原文","memory.cover.showAll":"展开全部({{n}})","memory.cover.collapse":"收起","memory.cover.missingTooltip":"未找到对应条目文件","memory.cover.orphan":"未列入索引","memory.empty.title":"尚未沉淀记忆","memory.empty.body":"Claude 会在你明确要求记住或观察到稳定偏好时,把记忆存到 ~/.claude/projects/<id>/memory/ 下。","memory.empty.orphanIndex":"索引中引用了 {{n}} 条记忆,但目前一条都不存在。","memory.section.untyped":"未分类","memory.drawer.close":"关闭","memory.drawer.indexHook":"在索引中的呈现","memory.drawer.notFound.title":"未找到条目","memory.drawer.notFound.body":"该记忆文件可能已被移除;如果索引里还有,会以灰化的形态出现在上方。","memory.raw.title":"MEMORY.md","memory.raw.subtitle":"精选索引 —— 原文","delete.eyebrow.confirm":"确认删除","delete.eyebrow.result":"结果","delete.title.confirm":"删除会话","delete.title.result":"已删除会话","delete.summary":"将删除 {{n}} 项 · 跳过 {{skipped}} 项 · 释放约 {{free}}","delete.skipped.heading":"将跳过这 {{n}} 项:","delete.skipped.reasonLive":"运行中 PID {{pid}}","delete.skipped.reasonRecent":"过去 {{n}} 分钟内有修改","delete.skipped.reasonUnknown":"未知","delete.success":"已删除 {{n}} 个会话。释放 {{free}} · 清理 {{lines}} 条历史记录","delete.btn.confirm":"删除 {{n}} {{label}}","delete.btn.confirmPending":"删除中…","delete.label.session":"个会话","delete.label.sessions":"个会话","delete.close":"关闭","deleteProject.row.action":"删除项目","deleteProject.eyebrow.confirm":"确认删除","deleteProject.eyebrow.result":"结果","deleteProject.title.confirm":"删除项目","deleteProject.title.result":"项目已删除","deleteProject.summary":"{{n}} 个会话 · 约释放 {{free}} · 项目目录将被删除","deleteProject.warning":"将删除 {{cwd}} 下的全部会话及其在 history.jsonl 的记录,操作不可撤销。","deleteProject.blocked.heading":"{{n}} 个会话正在运行或最近 5 分钟内被修改 — 本次不会删除任何内容,请稍后再试。","deleteProject.success":"已删除 {{n}} 个会话及项目目录。释放 {{free}} · 清理 {{lines}} 条历史记录","deleteProject.successKept":"已删除 {{n}} 个会话。释放 {{free}} · 清理 {{lines}} 条历史记录 · 项目目录已保留","deleteProject.btn.confirm":"删除项目","deleteProject.btn.confirmPending":"删除中…","search.action.open":"搜索会话","search.placeholder":"在所有会话中搜索…","search.empty":"至少输入 2 个字符,将在磁盘上的所有会话中搜索。","search.refineQuery":"请输入更长的关键词以缩小范围。","search.scanning":"扫描中…","search.noResults":"没有匹配项。","search.error":"搜索失败:{{msg}}","search.moreInSession":"该会话中还有更多","search.moreSessions":"仅显示前 {{n}} 个会话 — 请细化关键词。","search.summary":"{{matched}} 个会话 · 扫描 {{scanned}} 项 · {{ms}}ms","search.shortcut":"{{hint}} 唤起","search.escapeHint":"esc 关闭","search.kindText":"文本","search.kindToolUse":"工具","search.kindToolResult":"工具返回","search.kindThinking":"思考","search.role.user":"我","search.role.assistant":"Claude","export.action":"导出","export.eyebrow.confirm":"跨设备共享","export.eyebrow.result":"结果","export.title.confirm":"导出项目","export.title.result":"导出完成","export.summary":"将 {{n}} 个会话 + 记忆打包到可移植文件夹。","export.destLabel":"目标文件夹","export.destPlaceholder":"例如 D:\\sync\\claude-shared","export.destHint":"~/.claude 之外的绝对路径。放进 git 仓库或云盘即可同步。","export.privacy":"这会把你的对话与记忆写到应用之外。如果把该文件夹推送到远端,这些内容将离开本机。","export.btn.confirm":"导出","export.btn.pending":"导出中…","export.success":"已导出 {{sessions}} 个会话 · {{memory}} 个记忆文件 · {{lines}} 条历史","export.successDest":"写入到 {{dest}}","export.close":"关闭","import.title":"导入归档","import.tagline":"从另一台设备导入项目的会话与记忆。路径会被重映射到本机。","import.bundleLabel":"归档文件夹","import.bundlePlaceholder":"已导出归档的路径","import.btn.load":"加载归档","import.btn.recheck":"重新检查","import.btn.loading":"加载中…","import.source":"来自 {{platform}} · {{cwd}}","import.targetLabel":"导入到(本机)","import.targetHint":"本机绝对路径。会话将与该目录关联。","import.targetId":"项目 id:{{id}}","import.suggestions":"建议","import.suggestion.existing-project":"已有项目","import.suggestion.original-path":"原始路径","import.suggestion.same-basename":"同名目录","import.policyLabel":"当会话已存在时","import.policy.skip":"跳过","import.policy.overwrite-if-newer":"较新则覆盖","import.policy.keep-both":"两者都留","import.sessions.heading":"会话","import.sessions.empty":"此归档没有会话。","import.action.create":"新建","import.action.overwrite":"覆盖","import.action.keep-both":"另存","import.action.skip":"跳过","import.memory.heading":"记忆","import.memory.create":"新建","import.memory.skip":"相同","import.memory.conflict":"冲突 → {{name}}","import.history":"将新增 {{n}} 条历史","import.btn.commit":"导入","import.btn.committing":"导入中…","import.result.title":"导入完成","import.result.summary":"已导入 {{n}} 个会话 · 跳过 {{skipped}} · {{memory}} 个记忆文件 · {{lines}} 条历史","import.result.viewProject":"打开已导入项目","import.empty":"输入归档文件夹路径以开始。"}};function ft(){if(typeof window>"u")return"en";try{const t=localStorage.getItem(We);if(t==="en"||t==="zh")return t}catch{}return navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}let oe=typeof window<"u"?ft():"en";const de=new Set;function we(t){if(t!==oe){oe=t;try{localStorage.setItem(We,t)}catch{}document.documentElement.setAttribute("lang",t),de.forEach(r=>r(t))}}function he(){const[t,r]=l.useState(oe);l.useEffect(()=>{const n=a=>r(a);return de.add(n),()=>{de.delete(n)}},[]);const o=l.useCallback(n=>{we(n)},[]),s=l.useCallback(()=>{we(oe==="en"?"zh":"en")},[]);return{locale:t,setLocale:o,toggle:s}}function S(){const{locale:t}=he();return l.useCallback((r,o)=>re(t,r,o),[t])}function re(t,r,o){let n=ke[t][r]??ke.en[r]??r;if(o)for(const[a,i]of Object.entries(o))n=n.replaceAll(`{{${a}}}`,String(i));return n}async function*gt(t){const r=new URLSearchParams({q:t.query});t.perSession!==void 0&&r.set("perSession",String(t.perSession)),t.maxSessions!==void 0&&r.set("maxSessions",String(t.maxSessions));const o=await fetch(`/api/search?${r.toString()}`,{signal:t.signal,headers:{accept:"application/x-ndjson"}});if(!o.ok){const a=await o.text().catch(()=>"");throw new Error(`${o.status} ${o.statusText}${a?` — ${a}`:""}`)}if(!o.body)throw new Error("search stream returned no body");const s=o.body.pipeThrough(new TextDecoderStream).getReader();let n="";try{for(;;){const{value:a,done:i}=await s.read();if(i){if(n.trim()){const m=Ne(n);m&&(yield m)}return}n+=a;let d;for(;(d=n.indexOf(`
|
|
3
|
-
`))!==-1;){const m=n.slice(0,d);n=n.slice(d+1);const p=Ne(m);p&&(yield p)}}}finally{try{await s.cancel()}catch{}}}function Ne(t){const r=t.trim();if(!r)return null;try{return JSON.parse(r)}catch{return null}}const ne=2,vt=220;function yt({open:t,onClose:r}){const o=S(),s=Oe(),[n,a]=l.useState(""),[i,d]=l.useState([]),[m,p]=l.useState(null),[u,g]=l.useState(!1),[v,h]=l.useState(null),[c,f]=l.useState(0),L=l.useRef(null),w=l.useRef(null),A=l.useRef(null),D=l.useMemo(()=>{const j=[];let x=0;return i.forEach((N,C)=>{N.snippets.forEach((T,K)=>{j.push({hit:N,snippet:T,hitIndex:C,snippetIndex:K,flatIndex:x++})})}),j},[i]),R=n.trim();l.useEffect(()=>{if(!t)return;const j=window.setTimeout(()=>{W(R)},vt);return()=>window.clearTimeout(j)},[R,t]),l.useEffect(()=>{f(0)},[i.length]),l.useEffect(()=>{var N;if(!t){(N=A.current)==null||N.abort(),A.current=null,a(""),d([]),p(null),h(null),g(!1),f(0);return}let j=0;j=requestAnimationFrame(()=>{var C;(C=L.current)==null||C.focus()});function x(C){C.key==="Escape"&&(C.preventDefault(),r())}return window.addEventListener("keydown",x),()=>{cancelAnimationFrame(j),window.removeEventListener("keydown",x)}},[t,r]);const W=l.useCallback(j=>{var N;if((N=A.current)==null||N.abort(),j.length<ne){d([]),p(null),h(null),g(!1);return}const x=new AbortController;A.current=x,d([]),p(null),h(null),g(!0),(async()=>{try{for await(const C of gt({query:j,signal:x.signal})){if(x.signal.aborted)return;C.type==="session"?d(T=>[...T,C]):C.type==="done"&&p(C)}}catch(C){if(x.signal.aborted)return;h(C.message)}finally{x.signal.aborted||g(!1)}})()},[]),b=l.useCallback((j,x)=>{const N=new URLSearchParams({focus:x.uuid,q:R});s(`/projects/${encodeURIComponent(j.projectId)}/sessions/${encodeURIComponent(j.sessionId)}?${N.toString()}`),r()},[s,r,R]);function O(j){if(D.length!==0){if(j.key==="ArrowDown")j.preventDefault(),f(x=>Math.min(x+1,D.length-1));else if(j.key==="ArrowUp")j.preventDefault(),f(x=>Math.max(x-1,0));else if(j.key==="Home")j.preventDefault(),f(0);else if(j.key==="End")j.preventDefault(),f(D.length-1);else if(j.key==="Enter"){j.preventDefault();const x=D[c];x&&b(x.hit,x.snippet)}}}if(l.useEffect(()=>{if(!w.current)return;const j=w.current.querySelector(`[data-flat-index="${c}"]`);j==null||j.scrollIntoView({block:"nearest"})},[c]),!t)return null;const F=R.length===0,U=!F&&R.length<ne,$=!u&&!v&&R.length>=ne&&i.length===0&&m!==null;return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-start justify-center px-4 pt-[12vh] sm:px-6",children:[e.jsx("button",{type:"button","aria-label":o("delete.close"),onClick:r,className:"fixed inset-0 bg-[var(--color-canvas)]/65 backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":o("search.action.open"),className:"relative z-10 w-full max-w-2xl rounded-[var(--radius-panel)] border border-[var(--color-hairline)] bg-[var(--color-surface)] shadow-[var(--shadow-pop)]",onKeyDown:O,children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-[var(--color-hairline)] px-5 py-4",children:[e.jsx(kt,{className:"text-[var(--color-fg-muted)]"}),e.jsx("input",{ref:L,type:"search",autoFocus:!0,value:n,onChange:j=>a(j.target.value),placeholder:o("search.placeholder"),className:"flex-1 bg-transparent text-[15px] text-[var(--color-fg-primary)] placeholder:text-[var(--color-fg-faint)] focus:outline-none"}),u&&e.jsxs("span",{className:"inline-flex items-center gap-2 font-mono text-[10px] uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:[o("search.scanning"),e.jsx(xt,{})]})]}),e.jsxs("div",{ref:w,className:"max-h-[60vh] overflow-y-auto px-1 py-2",children:[F&&e.jsx(V,{children:o("search.empty")}),U&&e.jsx(V,{children:o("search.refineQuery")}),v&&e.jsx(V,{tone:"danger",children:o("search.error",{msg:v})}),$&&e.jsx(V,{children:o("search.noResults")}),i.map((j,x)=>e.jsx(jt,{hit:j,hitIndex:x,flatItems:D,activeIndex:c,query:R,onPick:b,onHover:f},`${j.projectId}/${j.sessionId}`)),(m==null?void 0:m.truncated)&&e.jsx(V,{children:o("search.moreSessions",{n:m.matched})})]}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-[var(--color-hairline)] px-5 py-2.5 font-mono text-[10px] uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:[e.jsxs("span",{children:[o("search.shortcut",{hint:qe})," · ",o("search.escapeHint")]}),m&&i.length>0&&e.jsx("span",{children:o("search.summary",{matched:m.matched,scanned:m.scanned,ms:m.durationMs})})]})]})]})}function jt({hit:t,hitIndex:r,flatItems:o,activeIndex:s,query:n,onPick:a,onHover:i}){const d=S(),m=t.customTitle??t.title,p=l.useMemo(()=>t.projectDecodedCwd.split(/[\\/]+/).filter(Boolean).at(-1)??t.projectDecodedCwd,[t.projectDecodedCwd]);return e.jsxs("div",{className:"px-2 pb-1 pt-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3 px-2",children:[e.jsxs("div",{className:"min-w-0 flex items-baseline gap-2",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-[var(--color-accent)]",children:p}),e.jsx("span",{className:"truncate font-display text-[13px] text-[var(--color-fg-primary)]",children:m})]}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-[var(--color-fg-muted)]",children:Y(t.lastAt)})]}),e.jsx("ul",{className:"mt-1.5 space-y-0.5",children:t.snippets.map((u,g)=>{const v=o.find(f=>f.hitIndex===r&&f.snippetIndex===g),h=(v==null?void 0:v.flatIndex)??-1,c=h===s;return e.jsx("li",{children:e.jsxs("button",{type:"button","data-flat-index":h,onMouseEnter:()=>i(h),onClick:()=>a(t,u),className:"block w-full rounded-[var(--radius-input)] px-3 py-2 text-left transition "+(c?"bg-[var(--color-accent-soft)] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]":"text-[var(--color-fg-secondary)] hover:bg-[var(--color-sunken)]"),children:[e.jsxs("div",{className:"flex items-baseline gap-2 font-mono text-[10px] uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:[e.jsx("span",{children:d(`search.role.${u.role}`)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:bt(u.blockKind,d)})]}),e.jsxs("p",{className:"mt-1 truncate text-[13px] leading-relaxed",children:[e.jsx("span",{className:"text-[var(--color-fg-faint)]",children:u.before}),e.jsx("mark",{className:"rounded-sm bg-[var(--color-accent-soft)] px-0.5 font-medium text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:u.match}),e.jsx("span",{className:"text-[var(--color-fg-faint)]",children:u.after})]})]})},`${u.uuid}-${g}`)})}),t.hasMore&&e.jsx("p",{className:"px-3 pt-1 font-mono text-[10px] uppercase tracking-[0.16em] text-[var(--color-fg-faint)]",children:d("search.moreInSession")})]})}function bt(t,r){switch(t){case"text":return r("search.kindText");case"tool_use":return r("search.kindToolUse");case"tool_result":return r("search.kindToolResult");case"thinking":return r("search.kindThinking")}}function V({children:t,tone:r="normal"}){const o=r==="danger"?"text-[var(--color-danger)]":"text-[var(--color-fg-muted)]";return e.jsx("p",{className:`px-5 py-6 text-center text-sm ${o}`,children:t})}function kt({className:t=""}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",className:t,"aria-hidden":!0,children:[e.jsx("circle",{cx:"11",cy:"11",r:"6.2"}),e.jsx("path",{d:"M20 20l-4.3-4.3"})]})}function wt({className:t=""}){const{locale:r,setLocale:o}=he();return e.jsxs("div",{role:"group","aria-label":"Language",className:"inline-flex h-9 items-center rounded-full border border-[var(--color-hairline)] bg-[var(--color-sunken)] p-0.5 text-[11px] font-medium "+t,children:[e.jsx(Se,{active:r==="en",onClick:()=>o("en"),label:"EN"}),e.jsx(Se,{active:r==="zh",onClick:()=>o("zh"),label:"中"})]})}function Se({active:t,onClick:r,label:o}){return e.jsx("button",{type:"button",onClick:r,"aria-pressed":t,className:"h-7 min-w-[2rem] rounded-full px-2 transition "+(t?"bg-[var(--color-surface)] text-[var(--color-fg-primary)] shadow-[var(--shadow-rise)]":"text-[var(--color-fg-muted)] hover:text-[var(--color-fg-primary)]"),children:o})}const Le="theme";function Nt(){return typeof document>"u"?"light":document.documentElement.classList.contains("dark")?"dark":"light"}function St(){const[t,r]=l.useState(Nt),o=l.useCallback(n=>{r(n),document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Le,n)}catch{}},[]),s=l.useCallback(()=>{o(t==="dark"?"light":"dark")},[t,o]);return l.useEffect(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)"),a=i=>{localStorage.getItem(Le)||o(i.matches?"dark":"light")};return n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[o]),{theme:t,setTheme:o,toggle:s}}function Lt({className:t=""}){const{theme:r,toggle:o}=St(),s=r==="dark";return e.jsxs("button",{type:"button",onClick:o,"aria-label":s?"Switch to light theme":"Switch to dark theme",title:s?"Light":"Dark",className:"group inline-flex h-9 w-16 items-center rounded-full border border-[var(--color-hairline)] bg-[var(--color-sunken)] px-1 transition hover:border-[var(--color-hairline-strong)] "+t,children:[e.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-[var(--color-surface)] text-[var(--color-fg-secondary)] shadow-[var(--shadow-rise)] transition-transform duration-300",style:{transform:s?"translateX(28px)":"translateX(0)"},children:s?e.jsx(Pt,{}):e.jsx(Ct,{})}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}function Ct(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"12",r:"3.6"}),e.jsx("path",{d:"M12 3v2.4M12 18.6V21M3 12h2.4M18.6 12H21M5.6 5.6l1.7 1.7M16.7 16.7l1.7 1.7M5.6 18.4l1.7-1.7M16.7 7.3l1.7-1.7"})]})}function Pt(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M20.5 14.4A8.5 8.5 0 1 1 9.6 3.5a7 7 0 0 0 10.9 10.9z"})})}const Mt=[{to:"/",labelKey:"nav.projects",icon:e.jsx(It,{}),match:t=>t==="/"||t.startsWith("/projects/")},{to:"/disk",labelKey:"nav.disk",icon:e.jsx(Rt,{}),match:t=>t==="/disk"||t.startsWith("/disk/")},{to:"/import",labelKey:"nav.import",icon:e.jsx(Dt,{}),match:t=>t==="/import"||t.startsWith("/import/")}];function Et({onSearchOpen:t}){const r=S(),{pathname:o}=lt(),[s,n]=l.useState(!1);return l.useEffect(()=>{const a=()=>n(!1);return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"topbar-glass sticky top-0 z-40 flex items-center justify-between border-b border-[var(--color-hairline)] px-4 py-3 lg:hidden",children:[e.jsx(Ce,{}),e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsx("button",{type:"button",onClick:t,"aria-label":r("search.action.open"),className:"inline-flex h-9 w-9 items-center justify-center rounded-xl border border-[var(--color-hairline)] text-[var(--color-fg-secondary)] hover:border-[var(--color-hairline-strong)] hover:text-[var(--color-accent)]",children:e.jsx(Pe,{})}),e.jsx("button",{type:"button",onClick:()=>n(a=>!a),"aria-label":r("nav.toggleNav"),className:"inline-flex h-9 w-9 items-center justify-center rounded-xl border border-[var(--color-hairline)] text-[var(--color-fg-secondary)] hover:border-[var(--color-hairline-strong)]",children:e.jsx(Bt,{open:s})})]})]}),s&&e.jsx("button",{type:"button","aria-label":r("nav.closeNav"),onClick:()=>n(!1),className:"fixed inset-0 z-40 bg-[var(--color-canvas)]/70 backdrop-blur-sm lg:hidden"}),e.jsxs("aside",{className:"fixed inset-y-0 left-0 z-50 flex w-72 flex-col border-r border-[var(--color-hairline)] bg-[var(--color-sunken)] transition-transform duration-300 lg:sticky lg:top-0 lg:h-dvh lg:translate-x-0 "+(s?"translate-x-0":"-translate-x-full"),children:[e.jsx("div",{className:"flex h-[68px] items-center px-5",children:e.jsx(Ce,{})}),t&&e.jsx("div",{className:"px-4 pb-2",children:e.jsxs("button",{type:"button",onClick:()=>{n(!1),t()},"aria-label":r("search.action.open"),className:"surface-card is-interactive flex w-full items-center gap-2.5 px-3 py-3 text-left",style:{borderRadius:"var(--radius-input)"},children:[e.jsx(Pe,{className:"text-[var(--color-fg-muted)]"}),e.jsx("span",{className:"flex-1 truncate text-[13px] text-[var(--color-fg-muted)]",children:r("search.action.open")}),e.jsx("kbd",{className:"rounded border border-[var(--color-hairline)] bg-[var(--color-sunken)] px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-[0.14em] text-[var(--color-fg-faint)]",children:qe})]})}),e.jsxs("nav",{className:"flex-1 overflow-y-auto px-4 py-3",children:[e.jsx("p",{className:"eyebrow px-2 pb-2",children:r("nav.workspace")}),e.jsx("ul",{className:"space-y-1",children:Mt.map(a=>{const i=a.match(o);return e.jsx("li",{children:e.jsxs(G,{to:a.to,"aria-current":i?"page":void 0,onClick:()=>n(!1),className:"group flex items-center gap-3 rounded-[var(--radius-input)] border px-4 py-3 text-sm transition "+(i?"border-[var(--color-hairline)] bg-[var(--color-surface)] text-[var(--color-fg-primary)] shadow-[var(--shadow-rise)]":"border-transparent text-[var(--color-fg-secondary)] hover:bg-[color-mix(in_oklch,var(--color-surface)_60%,transparent)] hover:text-[var(--color-fg-primary)]"),children:[e.jsx("span",{className:"transition-colors "+(i?"text-[var(--color-accent)]":"text-[var(--color-fg-muted)] group-hover:text-[var(--color-accent)]"),children:a.icon}),e.jsx("span",{className:"font-medium tracking-tight",children:r(a.labelKey)})]})},a.to)})})]}),e.jsxs("div",{className:"surface-card mx-4 mb-4 space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"eyebrow",children:r("nav.language")}),e.jsx(wt,{})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"eyebrow",children:r("nav.theme")}),e.jsx(Lt,{})]}),e.jsx("p",{className:"font-mono text-[10px] leading-snug text-[var(--color-fg-faint)]",children:r("app.brand.footnote")})]})]})]})}function Ce(){const t=S();return e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-[var(--color-hairline)] bg-[var(--color-surface)] text-[var(--color-accent)] shadow-[var(--shadow-rise)]",children:e.jsx(Tt,{})}),e.jsxs("span",{className:"flex flex-col leading-tight",children:[e.jsx("span",{className:"font-display text-[15px] font-medium tracking-tight text-[var(--color-fg-primary)]",children:t("app.brand.title")}),e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:t("app.brand.subtitle")})]})]})}function Tt(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M19 7.5A8 8 0 1 0 19 16.5"}),e.jsx("path",{d:"M15.5 9.5a4.5 4.5 0 1 0 0 5",opacity:"0.45"})]})}function It(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4.2a1.5 1.5 0 0 1 1.05.43l1.34 1.32A1.5 1.5 0 0 0 12.14 7.2H19.5A1.5 1.5 0 0 1 21 8.7v9.3a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18z"})})}function Rt(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("ellipse",{cx:"12",cy:"6.5",rx:"8",ry:"2.5"}),e.jsx("path",{d:"M4 6.5v5c0 1.4 3.6 2.5 8 2.5s8-1.1 8-2.5v-5"}),e.jsx("path",{d:"M4 11.5v5c0 1.4 3.6 2.5 8 2.5s8-1.1 8-2.5v-5"})]})}function Dt(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M12 14V3"}),e.jsx("path",{d:"M8 10l4 4 4-4"}),e.jsx("path",{d:"M4 15v3.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V15"})]})}function Pe({className:t=""}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",className:t,"aria-hidden":!0,children:[e.jsx("circle",{cx:"11",cy:"11",r:"6.2"}),e.jsx("path",{d:"M20 20l-4.3-4.3"})]})}function Bt({open:t}){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":!0,children:t?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M6 6l12 12"}),e.jsx("path",{d:"M18 6L6 18"})]}):e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M4 7h16"}),e.jsx("path",{d:"M4 12h16"}),e.jsx("path",{d:"M4 17h12"})]})})}const Me="inline-flex min-w-0 items-center gap-1.5 rounded-lg px-3 py-1";function He({items:t}){return e.jsx("nav",{"aria-label":"Breadcrumb",className:"inline-flex max-w-full items-center gap-1 overflow-hidden rounded-xl border border-[var(--color-accent)] bg-[var(--color-surface)] px-2 py-1.5 text-sm shadow-[var(--shadow-rise)]",children:t.map((r,o)=>{const s=o===t.length-1,n=r.mono?"font-mono":"font-sans",a=s?"text-[var(--color-fg-primary)]":"text-[var(--color-fg-secondary)]",i=e.jsxs(e.Fragment,{children:[r.icon&&e.jsx("span",{className:"shrink-0 text-[var(--color-accent)]",children:r.icon}),e.jsx("span",{className:"truncate",children:r.label})]});return e.jsxs(l.Fragment,{children:[r.to&&!s?e.jsx(G,{to:r.to,className:`${Me} ${n} ${a} transition-colors duration-150 hover:bg-[var(--color-accent-soft)] hover:text-[var(--color-accent-ink)]`,children:i}):e.jsx("span",{className:`${Me} ${n} ${a}`,"aria-current":s?"page":void 0,children:i}),!s&&e.jsx(At,{})]},`${r.label}-${o}`)})})}function At(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0 text-[var(--color-accent)]","aria-hidden":!0,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})})}function me(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4.2a1.5 1.5 0 0 1 1.05.43l1.34 1.32A1.5 1.5 0 0 0 12.14 7.2H19.5A1.5 1.5 0 0 1 21 8.7v9.3a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18z"})})}async function I(t,r){const o=await fetch(t,{...r,headers:{"content-type":"application/json",...(r==null?void 0:r.headers)??{}}});if(!o.ok){const s=await o.text().catch(()=>"");let n=s;if(s)try{const a=JSON.parse(s);typeof a.error=="string"&&(n=a.error)}catch{}throw new Error(`${o.status} ${o.statusText}${n?` — ${n}`:""}`)}return o.json()}const Qe=5,$t=5e3,P={health:()=>["health"],projects:()=>["projects"],projectSessions:t=>["project-sessions",t],projectMemory:t=>["project-memory",t],session:(t,r)=>["session",t,r],diskUsage:()=>["disk-usage"],search:t=>["search",t]};function Ye({projectId:t,selected:r,onClose:o,onDeleted:s}){const n=S(),{locale:a}=he(),i=ue(),d=r.filter(c=>c.isLivePid||c.isRecentlyActive),m=r.filter(c=>!c.isLivePid&&!c.isRecentlyActive),p=m.reduce((c,f)=>c+f.relatedBytes.jsonl+f.relatedBytes.subdir+f.relatedBytes.fileHistory+f.relatedBytes.sessionEnv,0),u=J({mutationFn:c=>I("/api/sessions",{method:"DELETE",body:JSON.stringify({items:c})}),onSuccess:c=>{if(c.deleted.length>0){const f=new Set(c.deleted.map(L=>L.sessionId));i.setQueryData(P.projectSessions(t),L=>L==null?void 0:L.filter(w=>!f.has(w.id)))}i.invalidateQueries({queryKey:P.projects()}),i.invalidateQueries({queryKey:P.projectSessions(t)}),i.invalidateQueries({queryKey:P.diskUsage()}),c.deleted.length>0&&(s==null||s(c.deleted.map(f=>f.sessionId)))}}),g=l.useRef(u.isPending);g.current=u.isPending,l.useEffect(()=>{function c(f){f.key==="Escape"&&!g.current&&o()}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[o]);const v=u.data,h=!!v;return e.jsx(B.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},className:"fixed inset-0 z-[60] flex items-start justify-center bg-[oklch(0.16_0.006_85_/_0.55)] backdrop-blur-[2px] px-4 py-12",onClick:()=>!u.isPending&&o(),children:e.jsxs(B.div,{initial:{y:8,opacity:0},animate:{y:0,opacity:1},transition:{duration:.24,ease:[.16,1,.3,1]},className:"w-full max-w-2xl overflow-hidden rounded-[var(--radius-panel)] border border-[var(--color-hairline)] bg-[var(--color-surface)] shadow-[var(--shadow-pop)]",onClick:c=>c.stopPropagation(),children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-[var(--color-hairline)] px-6 py-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow text-[var(--color-danger)]",children:n(h?"delete.eyebrow.result":"delete.eyebrow.confirm")}),e.jsx("h2",{className:"mt-1 font-display text-2xl font-light tracking-tight text-[var(--color-fg-primary)]",children:n(h?"delete.title.result":"delete.title.confirm")}),!h&&e.jsx("p",{className:"mt-1.5 text-sm text-[var(--color-fg-muted)]",children:n("delete.summary",{n:m.length,skipped:d.length,free:E(p)})})]}),e.jsx("button",{type:"button",onClick:o,disabled:u.isPending,"aria-label":n("delete.close"),className:"rounded-xl p-1.5 text-[var(--color-fg-muted)] hover:bg-[var(--color-sunken)] hover:text-[var(--color-fg-primary)] disabled:opacity-50",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:e.jsx("path",{d:"M6 6l12 12M18 6L6 18"})})})]}),!h&&e.jsxs("div",{className:"max-h-[50vh] space-y-2 overflow-auto px-6 py-4",children:[m.map(c=>e.jsxs("div",{className:"rounded-md border border-[var(--color-hairline)] bg-[var(--color-canvas)] px-3 py-2 text-xs",children:[e.jsx("div",{className:"font-medium text-[var(--color-fg-primary)]",children:c.title}),e.jsx("div",{className:"mt-0.5 truncate font-mono text-[10.5px] text-[var(--color-fg-faint)]",children:c.id}),e.jsxs("div",{className:"mt-1.5 grid grid-cols-2 gap-x-3 gap-y-0.5 font-mono text-[11px] text-[var(--color-fg-muted)] sm:grid-cols-4",children:[e.jsxs("span",{children:["jsonl ",e.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:E(c.relatedBytes.jsonl)})]}),e.jsxs("span",{children:["subdir ",e.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:E(c.relatedBytes.subdir)})]}),e.jsxs("span",{children:["file-history ",e.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:E(c.relatedBytes.fileHistory)})]}),e.jsxs("span",{children:["session-env ",e.jsx("span",{className:"text-[var(--color-fg-secondary)]",children:E(c.relatedBytes.sessionEnv)})]})]})]},c.id)),d.length>0&&e.jsxs("div",{className:"rounded-md border border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] px-3 py-2.5 text-xs",children:[e.jsx("div",{className:"mb-1.5 font-medium text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:n("delete.skipped.heading",{n:d.length})}),e.jsx("ul",{className:"space-y-0.5",children:d.map(c=>e.jsxs("li",{className:"font-mono text-[11px] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-secondary)]",children:[c.id," — ",_t(c,a)]},c.id))})]})]}),h&&v&&e.jsxs("div",{className:"max-h-[50vh] space-y-3 overflow-auto px-6 py-4 text-sm",children:[e.jsx("div",{className:"rounded-md border border-[var(--color-moss)]/40 bg-[var(--color-moss-soft)] px-3 py-2.5 text-[var(--color-fg-primary)]",children:n("delete.success",{n:v.deleted.length,free:E(v.deleted.reduce((c,f)=>c+f.freedBytes,0)),lines:v.historyLinesRemoved})}),v.skipped.length>0&&e.jsxs("div",{className:"rounded-md border border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] px-3 py-2.5 text-xs",children:[e.jsx("div",{className:"mb-1 font-medium text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:n("delete.skipped.heading",{n:v.skipped.length})}),e.jsx("ul",{className:"space-y-0.5",children:v.skipped.map(c=>e.jsxs("li",{className:"font-mono text-[11px] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-secondary)]",children:[c.sessionId," — ",c.reason]},c.sessionId))})]})]}),u.error&&e.jsx("p",{className:"mx-6 mb-3 rounded-md border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-3 py-2 text-sm text-[var(--color-danger)]",children:u.error.message}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-[var(--color-hairline)] px-6 py-4",children:h?e.jsx("button",{type:"button",onClick:o,className:"rounded-[var(--radius-control)] bg-[var(--color-fg-primary)] px-4 py-1.5 text-sm font-medium text-[var(--color-canvas)] hover:opacity-90",children:n("common.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:o,disabled:u.isPending,className:"rounded-[var(--radius-control)] border border-[var(--color-hairline-strong)] px-4 py-1.5 text-sm text-[var(--color-fg-secondary)] hover:bg-[var(--color-sunken)] disabled:opacity-50",children:n("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>u.mutate(r.map(c=>({projectId:t,sessionId:c.id}))),disabled:u.isPending||m.length===0,className:"rounded-[var(--radius-control)] bg-[var(--color-danger)] px-4 py-1.5 text-sm font-medium text-white shadow-[var(--shadow-rise)] hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:u.isPending?n("delete.btn.confirmPending"):n("delete.btn.confirm",{n:m.length,label:m.length===1?n("delete.label.session"):n("delete.label.sessions")})})]})})]})})}function _t(t,r){return t.isLivePid?re(r,"delete.skipped.reasonLive",{pid:t.livePid??"?"}):t.isRecentlyActive?re(r,"delete.skipped.reasonRecent",{n:Qe}):re(r,"delete.skipped.reasonUnknown")}function Ft({projectId:t,sessions:r,onClose:o}){const s=S(),[n,a]=l.useState(""),i=J({mutationFn:()=>I(`/api/projects/${encodeURIComponent(t)}/export`,{method:"POST",body:JSON.stringify({sessionIds:r.map(g=>g.id),destDir:n.trim()})})}),d=l.useRef(i.isPending);d.current=i.isPending,l.useEffect(()=>{function g(v){v.key==="Escape"&&!d.current&&o()}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[o]);const m=i.data,p=!!m,u=n.trim()!==""&&!i.isPending;return e.jsx(B.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},className:"fixed inset-0 z-[60] flex items-start justify-center bg-[oklch(0.16_0.006_85_/_0.55)] px-4 py-12 backdrop-blur-[2px]",onClick:()=>!i.isPending&&o(),children:e.jsxs(B.div,{initial:{y:8,opacity:0},animate:{y:0,opacity:1},transition:{duration:.24,ease:[.16,1,.3,1]},className:"w-full max-w-xl overflow-hidden rounded-[var(--radius-panel)] border border-[var(--color-hairline)] bg-[var(--color-surface)] shadow-[var(--shadow-pop)]",onClick:g=>g.stopPropagation(),children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-[var(--color-hairline)] px-6 py-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow text-[var(--color-accent-ink)] dark:text-[var(--color-accent)]",children:s(p?"export.eyebrow.result":"export.eyebrow.confirm")}),e.jsx("h2",{className:"mt-1 font-display text-2xl font-light tracking-tight text-[var(--color-fg-primary)]",children:s(p?"export.title.result":"export.title.confirm")}),!p&&e.jsx("p",{className:"mt-1.5 text-sm text-[var(--color-fg-muted)]",children:s("export.summary",{n:r.length})})]}),e.jsx("button",{type:"button",onClick:o,disabled:i.isPending,"aria-label":s("export.close"),className:"rounded-xl p-1.5 text-[var(--color-fg-muted)] hover:bg-[var(--color-sunken)] hover:text-[var(--color-fg-primary)] disabled:opacity-50",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:e.jsx("path",{d:"M6 6l12 12M18 6L6 18"})})})]}),!p&&e.jsxs("div",{className:"space-y-4 px-6 py-5",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"eyebrow",children:s("export.destLabel")}),e.jsx("input",{type:"text",value:n,onChange:g=>a(g.target.value),placeholder:s("export.destPlaceholder"),spellCheck:!1,autoFocus:!0,className:"mt-1.5 w-full rounded-[var(--radius-input)] border border-[var(--color-hairline-strong)] bg-[var(--color-canvas)] px-3 py-2 font-mono text-sm text-[var(--color-fg-primary)] outline-none focus:border-[var(--color-accent)]"}),e.jsx("span",{className:"mt-1.5 block text-xs text-[var(--color-fg-muted)]",children:s("export.destHint")})]}),e.jsx("p",{className:"rounded-[var(--radius-card)] border border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] px-3 py-2.5 text-xs leading-relaxed text-[var(--color-accent-ink)] dark:text-[var(--color-fg-secondary)]",children:s("export.privacy")})]}),p&&m&&e.jsxs("div",{className:"space-y-3 px-6 py-5 text-sm",children:[e.jsx("div",{className:"rounded-[var(--radius-card)] border border-[var(--color-moss)]/40 bg-[var(--color-moss-soft)] px-3 py-2.5 text-[var(--color-fg-primary)]",children:s("export.success",{sessions:m.sessionsExported,memory:m.memoryFilesExported,lines:m.historyLinesExported})}),e.jsx("p",{className:"break-all font-mono text-xs text-[var(--color-fg-muted)]",children:s("export.successDest",{dest:m.destDir})})]}),i.error&&e.jsx("p",{className:"mx-6 mb-3 rounded-md border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-3 py-2 text-sm text-[var(--color-danger)]",children:i.error.message}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-[var(--color-hairline)] px-6 py-4",children:p?e.jsx("button",{type:"button",onClick:o,className:"rounded-[var(--radius-control)] bg-[var(--color-fg-primary)] px-4 py-1.5 text-sm font-medium text-[var(--color-canvas)] hover:opacity-90",children:s("common.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:o,disabled:i.isPending,className:"rounded-[var(--radius-control)] border border-[var(--color-hairline-strong)] px-4 py-1.5 text-sm text-[var(--color-fg-secondary)] hover:bg-[var(--color-sunken)] disabled:opacity-50",children:s("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>i.mutate(),disabled:!u,className:"rounded-[var(--radius-control)] bg-[var(--color-fg-primary)] px-4 py-1.5 text-sm font-medium text-[var(--color-canvas)] shadow-[var(--shadow-rise)] hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:i.isPending?s("export.btn.pending"):s("export.btn.confirm")})]})})]})})}function zt({eyebrow:t,title:r,actions:o,meta:s,editableValue:n,onTitleEdit:a}){return e.jsxs("header",{className:"relative",children:[t&&e.jsx("div",{className:"eyebrow mb-1",children:t}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-6 gap-y-2",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(Ot,{title:r,editableValue:n,onTitleEdit:a})}),o&&e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:o})]}),s&&e.jsx("div",{className:"mt-2 flex flex-wrap items-baseline gap-x-3 gap-y-1 text-xs",children:s})]})}const ae="font-display text-[clamp(1.375rem,2.4vw,1.75rem)] font-light leading-[1.15] tracking-[-0.015em] text-[var(--color-fg-primary)]";function Ot({title:t,editableValue:r,onTitleEdit:o}){const[s,n]=l.useState(!1),[a,i]=l.useState(r??""),[d,m]=l.useState(!1),[p,u]=l.useState(null),g=l.useRef(null);if(l.useEffect(()=>{!s&&r!==void 0&&i(r)},[s,r]),l.useEffect(()=>{var c;s&&((c=g.current)==null||c.select())},[s]),!o)return e.jsx("h1",{className:ae,children:t});function v(){i(r??""),u(null),n(!0)}async function h(){const c=a.trim();if(!o||!c||c===(r??"")){n(!1);return}m(!0),u(null);try{await o(c),n(!1)}catch(f){u(f.message)}finally{m(!1)}}return s?e.jsxs("div",{children:[e.jsx("input",{ref:g,value:a,disabled:d,onChange:c=>i(c.target.value),onKeyDown:c=>{c.key==="Enter"?(c.preventDefault(),h()):c.key==="Escape"&&(c.preventDefault(),n(!1),u(null))},onBlur:()=>{d||(n(!1),u(null))},maxLength:200,className:ae+" w-full bg-transparent border-b border-[var(--color-accent)] outline-none focus:outline-none disabled:opacity-60"}),p&&e.jsx("p",{className:"mt-1 text-xs text-[var(--color-danger)]",children:p})]}):e.jsxs("div",{className:"group flex items-center gap-3",children:[e.jsx("h1",{className:ae,children:t}),e.jsx("button",{type:"button",onClick:v,"aria-label":"Rename",title:"Rename",className:"flex-shrink-0 rounded-xl p-1.5 text-[var(--color-fg-muted)] opacity-0 transition hover:bg-[var(--color-sunken)] hover:text-[var(--color-fg-primary)] focus:opacity-100 group-hover:opacity-100",children:e.jsx(Ut,{})})]})}function Ut(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function z({label:t,value:r}){return e.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[e.jsx("span",{className:"eyebrow",children:t}),e.jsx("span",{className:"font-mono text-[13px] tabular-nums text-[var(--color-fg-primary)]",children:r})]})}function Q(){return e.jsx("span",{"aria-hidden":!0,className:"text-[var(--color-fg-faint)]",children:"·"})}function Kt(t){return t.isLivePid?"live":t.isRecentlyActive?"recent":"idle"}function qt({session:t,withLabel:r=!0}){const o=S(),s=Kt(t),n=s==="live"?o("status.tooltip.live",{pid:t.livePid??"?"}):s==="recent"?o("status.tooltip.recent",{n:Qe}):o("status.tooltip.idle"),a=s==="live"?o("status.live",{pid:t.livePid??"?"}):o(s==="recent"?"status.recent":"status.idle");return e.jsxs("span",{title:n,className:"inline-flex items-center gap-2 text-xs",children:[e.jsx(Wt,{variant:s}),r&&e.jsx("span",{className:s==="idle"?"font-mono uppercase tracking-[0.14em] text-[var(--color-fg-faint)]":s==="live"?"font-mono uppercase tracking-[0.14em] text-[var(--color-accent-ink)] dark:text-[var(--color-accent)]":"font-mono uppercase tracking-[0.14em] text-[var(--color-fg-secondary)]",children:a})]})}function Wt({variant:t}){return t==="live"?e.jsxs("span",{"aria-hidden":!0,className:"relative inline-flex h-2.5 w-2.5",children:[e.jsx("span",{className:"absolute inset-0 rounded-full bg-[var(--color-accent)] pulse-amber"}),e.jsx("span",{className:"absolute inset-0 rounded-full bg-[var(--color-accent)]"})]}):t==="recent"?e.jsx("span",{"aria-hidden":!0,className:"inline-block h-2.5 w-2.5 rounded-full bg-[var(--color-accent)]"}):e.jsx("span",{"aria-hidden":!0,className:"inline-block h-2.5 w-2.5 rounded-full border border-[var(--color-hairline-strong)]"})}const fe={hidden:{},show:{transition:{staggerChildren:.035,delayChildren:.04}}},ge={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.36,ease:[.16,1,.3,1]}}};function Ht(){var j;const t=S(),{projectId:r}=Ue(),o=r??"",[s,n]=l.useState(new Set),[a,i]=l.useState(!1),[d,m]=l.useState(!1),p=_({queryKey:P.projectSessions(o),queryFn:()=>I(`/api/projects/${encodeURIComponent(o)}/sessions`),enabled:!!o}),u=_({queryKey:P.projects(),queryFn:()=>I("/api/projects")}),v=((j=_({queryKey:P.projectMemory(o),queryFn:()=>I(`/api/projects/${encodeURIComponent(o)}/memory`),enabled:!!o}).data)==null?void 0:j.entries.length)??0,h=J({mutationFn:()=>I(`/api/projects/${encodeURIComponent(o)}/reveal`,{method:"POST"}),onError:x=>{window.alert(t("project.action.openFolderFailed",{msg:x.message}))}}),c=l.useMemo(()=>{var x;return(x=u.data)==null?void 0:x.find(N=>N.id===o)},[u.data,o]),f=p.data??[],L=l.useMemo(()=>f.filter(x=>s.has(x.id)),[f,s]),w=s.size>0?L:f,A=l.useMemo(()=>f.reduce((x,N)=>x+Ee(N),0),[f]),D=l.useMemo(()=>f.filter(x=>x.isLivePid).length,[f]),R=l.useMemo(()=>f.filter(x=>x.isRecentlyActive&&!x.isLivePid).length,[f]);function W(x){const N=new Set(s);N.has(x)?N.delete(x):N.add(x),n(N)}function b(){s.size===f.length?n(new Set):n(new Set(f.map(x=>x.id)))}const O=(c==null?void 0:c.decodedCwd)??o,F=O.split(/[\\/]+/).filter(Boolean),U=F.at(-1)??O,$=F.slice(0,-1).join("/");return e.jsxs("section",{children:[e.jsx(He,{items:[{label:t("session.crumbProjects"),to:"/"},{label:U,mono:!0,icon:e.jsx(me,{})}]}),e.jsx("div",{className:"surface-card mt-6 p-6",children:e.jsx(zt,{eyebrow:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[$?e.jsxs("span",{className:"font-mono normal-case tracking-normal",children:[$,"/"]}):t("project.eyebrow"),(c==null?void 0:c.cwdResolved)===!1&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.14em] text-[var(--color-danger)]",children:[e.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-[var(--color-danger)]"}),t("project.warn.missingDir")]})]}),title:e.jsx("span",{className:"font-mono",children:U}),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>h.mutate(),disabled:h.isPending||(c==null?void 0:c.cwdResolved)===!1,title:(c==null?void 0:c.cwdResolved)===!1?t("project.action.openFolderTooltipMissing"):O,className:"inline-flex items-center gap-2 rounded-[var(--radius-control)] border border-[var(--color-hairline)] bg-[var(--color-surface)] px-4 py-1.5 text-xs font-medium uppercase tracking-[0.14em] text-[var(--color-fg-secondary)] transition hover:border-[var(--color-accent)] hover:text-[var(--color-accent-ink)] disabled:cursor-not-allowed disabled:opacity-40 dark:hover:text-[var(--color-accent)]",children:[e.jsx(Gt,{}),t("project.action.openFolder")]}),e.jsxs(G,{to:`/projects/${encodeURIComponent(o)}/memory`,className:"inline-flex items-center gap-2 rounded-[var(--radius-control)] border border-[var(--color-hairline)] bg-[var(--color-surface)] px-4 py-1.5 text-xs font-medium uppercase tracking-[0.14em] text-[var(--color-fg-secondary)] transition hover:border-[var(--color-accent)] hover:text-[var(--color-accent-ink)] dark:hover:text-[var(--color-accent)]",children:[e.jsx(Jt,{}),v>0?t("memory.action.openCount",{n:v}):t("memory.action.open")]}),e.jsxs("button",{type:"button",onClick:()=>m(!0),disabled:f.length===0,title:s.size>0?`${s.size}`:void 0,className:"inline-flex items-center gap-2 rounded-[var(--radius-control)] border border-[var(--color-hairline)] bg-[var(--color-surface)] px-4 py-1.5 text-xs font-medium uppercase tracking-[0.14em] text-[var(--color-fg-secondary)] transition hover:border-[var(--color-accent)] hover:text-[var(--color-accent-ink)] disabled:cursor-not-allowed disabled:opacity-40 dark:hover:text-[var(--color-accent)]",children:[e.jsx(Vt,{}),s.size>0?`${t("export.action")} · ${s.size}`:t("export.action")]}),e.jsxs("button",{type:"button",onClick:()=>i(!0),disabled:s.size===0,className:"inline-flex items-center gap-2 rounded-[var(--radius-control)] border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-4 py-1.5 text-xs font-medium uppercase tracking-[0.14em] text-[var(--color-danger)] transition hover:border-[var(--color-danger)] disabled:cursor-not-allowed disabled:opacity-40",children:[e.jsx(Yt,{})," ",t("project.action.delete",{n:s.size})]})]}),meta:f.length>0?e.jsxs(e.Fragment,{children:[e.jsx(z,{label:t("project.meta.sessions"),value:f.length}),e.jsx(Q,{}),e.jsx(z,{label:t("project.meta.onDisk"),value:E(A)}),e.jsx(Q,{}),e.jsx(z,{label:t("project.meta.live"),value:D>0?e.jsx("span",{className:"text-[var(--color-accent-ink)] dark:text-[var(--color-accent)]",children:D}):0}),e.jsx(Q,{}),e.jsx(z,{label:t("project.meta.recent"),value:R})]}):null})}),p.isLoading&&e.jsx(se,{label:t("common.readingSessions"),className:"mt-10"}),p.error&&e.jsxs("p",{className:"mt-10 rounded-md border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-4 py-3 text-sm text-[var(--color-danger)]",children:[t("common.failedSessions"),": ",p.error.message]}),p.data&&p.data.length===0&&e.jsx("p",{className:"mt-10 text-sm text-[var(--color-fg-muted)]",children:t("common.noSessions")}),f.length>0&&e.jsxs("div",{className:"surface-card mt-6 p-6",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("h2",{className:"font-display text-xl font-light tracking-tight text-[var(--color-fg-primary)]",children:t("project.heading")}),e.jsx("button",{type:"button",onClick:b,className:"font-mono text-[11px] uppercase tracking-[0.16em] text-[var(--color-fg-muted)] hover:text-[var(--color-fg-primary)]",children:s.size===f.length?t("common.deselectAll"):t("common.selectAll")})]}),e.jsx("div",{className:"rule-dotted mt-3","aria-hidden":!0}),e.jsx("div",{className:"mt-4 -mx-6 overflow-x-auto px-6",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left",children:[e.jsx("th",{className:"w-9 px-2 py-3"}),e.jsx("th",{className:"px-2 py-3 eyebrow",children:t("project.col.title")}),e.jsx("th",{className:"px-2 py-3 eyebrow text-right",children:t("project.col.msgs")}),e.jsx("th",{className:"px-2 py-3 eyebrow text-right",children:t("project.col.last")}),e.jsx("th",{className:"px-2 py-3 eyebrow text-right",children:t("project.col.size")}),e.jsx("th",{className:"px-2 py-3 eyebrow",children:t("project.col.status")})]})}),e.jsx(B.tbody,{initial:"hidden",animate:"show",variants:fe,className:"border-t border-[var(--color-hairline)]",children:f.map(x=>{const N=s.has(x.id),C=x.customTitle??x.title;return e.jsxs(B.tr,{variants:ge,"data-active":N?"true":void 0,className:"ribbon-row border-b border-[var(--color-hairline)] transition-colors "+(N?"bg-[var(--color-accent-soft)]/40":"hover:bg-[var(--color-sunken)]"),children:[e.jsx("td",{className:"px-2 py-3 align-top",children:e.jsx("input",{type:"checkbox","aria-label":C,checked:N,onChange:()=>W(x.id),className:"mt-0.5 h-3.5 w-3.5 cursor-pointer accent-[var(--color-accent)]"})}),e.jsxs("td",{className:"px-2 py-3 align-top",children:[e.jsx(G,{to:`/projects/${encodeURIComponent(o)}/sessions/${x.id}`,className:"block max-w-md truncate font-medium text-[var(--color-fg-primary)] hover:text-[var(--color-accent-ink)] dark:hover:text-[var(--color-accent)]",title:C,children:C}),e.jsx("div",{className:"mt-1 truncate font-mono text-[10.5px] tracking-[0.04em] text-[var(--color-fg-faint)]",children:x.id})]}),e.jsx("td",{className:"px-2 py-3 text-right align-top font-mono tabular-nums text-[var(--color-fg-secondary)]",children:x.messageCount.toLocaleString()}),e.jsx("td",{className:"px-2 py-3 text-right align-top font-mono text-[12.5px] text-[var(--color-fg-secondary)]",children:Y(x.lastAt)}),e.jsx("td",{className:"px-2 py-3 text-right align-top font-mono tabular-nums text-[var(--color-fg-secondary)]",title:Qt(x),children:E(Ee(x))}),e.jsx("td",{className:"px-2 py-3 align-top",children:e.jsx(qt,{session:x})})]},x.id)})})]})})]}),a&&e.jsx(Ye,{projectId:o,selected:L,onClose:()=>{i(!1),n(new Set)}}),d&&e.jsx(Ft,{projectId:o,sessions:w,onClose:()=>m(!1)})]})}function Ee(t){const r=t.relatedBytes;return r.jsonl+r.subdir+r.fileHistory+r.sessionEnv}function Qt(t){const r=t.relatedBytes;return[`jsonl ${E(r.jsonl)}`,`subdir ${E(r.subdir)}`,`file-history ${E(r.fileHistory)}`,`session-env ${E(r.sessionEnv)}`].join(" · ")}function Yt(){return e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M8 6V4.5A1.5 1.5 0 0 1 9.5 3h5A1.5 1.5 0 0 1 16 4.5V6"}),e.jsx("path",{d:"M5.5 6l1.1 13.2A1.5 1.5 0 0 0 8.1 20.5h7.8a1.5 1.5 0 0 0 1.5-1.3L18.5 6"})]})}function Vt(){return e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M12 3v12"}),e.jsx("path",{d:"M8 7l4-4 4 4"}),e.jsx("path",{d:"M4 15v3.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V15"})]})}function Gt(){return e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M3 7.5A1.5 1.5 0 0 1 4.5 6h4.4a1.5 1.5 0 0 1 1.06.44l1.1 1.1a1.5 1.5 0 0 0 1.06.44H19.5A1.5 1.5 0 0 1 21 9.48"}),e.jsx("path",{d:"M3.2 9.5h17.6a1 1 0 0 1 .98 1.2l-1.5 7.5a1.5 1.5 0 0 1-1.47 1.2H5.2a1.5 1.5 0 0 1-1.47-1.2l-1.5-7.5A1 1 0 0 1 3.2 9.5z"})]})}function Jt(){return e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M9 4.5a3 3 0 0 0-3 3v.4a3 3 0 0 0-1.5 5.2A3 3 0 0 0 6 18.5a3 3 0 0 0 6 0V4.5a3 3 0 0 0-3 0z"}),e.jsx("path",{d:"M15 4.5a3 3 0 0 1 3 3v.4a3 3 0 0 1 1.5 5.2A3 3 0 0 1 18 18.5a3 3 0 0 1-6 0"})]})}function Xt({project:t,onClose:r}){const o=S(),s=ue(),n=_({queryKey:P.projectSessions(t.id),queryFn:()=>I(`/api/projects/${encodeURIComponent(t.id)}/sessions`)}),i=(n.data??[]).filter(h=>h.isLivePid||h.isRecentlyActive),d=i.length>0,m=J({mutationFn:()=>I(`/api/projects/${encodeURIComponent(t.id)}`,{method:"DELETE"}),onSuccess:()=>{s.invalidateQueries({queryKey:P.projects()}),s.invalidateQueries({queryKey:P.projectSessions(t.id)}),s.invalidateQueries({queryKey:P.diskUsage()})}}),p=l.useRef(m.isPending);p.current=m.isPending,l.useEffect(()=>{function h(c){c.key==="Escape"&&!p.current&&r()}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r]);const u=m.data,g=!!u,v=(u==null?void 0:u.deleted.reduce((h,c)=>h+c.freedBytes,0))??0;return e.jsx(B.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18},className:"fixed inset-0 z-[60] flex items-start justify-center bg-[oklch(0.16_0.006_85_/_0.55)] backdrop-blur-[2px] px-4 py-12",onClick:()=>!m.isPending&&r(),children:e.jsxs(B.div,{initial:{y:8,opacity:0},animate:{y:0,opacity:1},transition:{duration:.24,ease:[.16,1,.3,1]},className:"w-full max-w-2xl overflow-hidden rounded-[var(--radius-panel)] border border-[var(--color-hairline)] bg-[var(--color-surface)] shadow-[var(--shadow-pop)]",onClick:h=>h.stopPropagation(),children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 border-b border-[var(--color-hairline)] px-6 py-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"eyebrow text-[var(--color-danger)]",children:o(g?"deleteProject.eyebrow.result":"deleteProject.eyebrow.confirm")}),e.jsx("h2",{className:"mt-1 font-display text-2xl font-light tracking-tight text-[var(--color-fg-primary)]",children:o(g?"deleteProject.title.result":"deleteProject.title.confirm")}),e.jsx("p",{className:"mt-1.5 truncate font-mono text-[12px] text-[var(--color-fg-muted)]",title:t.decodedCwd,children:t.decodedCwd}),!g&&e.jsx("p",{className:"mt-2 text-sm text-[var(--color-fg-muted)]",children:o("deleteProject.summary",{n:t.sessionCount,free:E(t.totalBytes)})})]}),e.jsx("button",{type:"button",onClick:r,disabled:m.isPending,"aria-label":o("delete.close"),className:"rounded-xl p-1.5 text-[var(--color-fg-muted)] hover:bg-[var(--color-sunken)] hover:text-[var(--color-fg-primary)] disabled:opacity-50",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:e.jsx("path",{d:"M6 6l12 12M18 6L6 18"})})})]}),!g&&e.jsxs("div",{className:"space-y-3 px-6 py-4 text-sm",children:[e.jsx("p",{className:"rounded-md border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-3 py-2.5 text-[var(--color-danger)]",children:o("deleteProject.warning",{cwd:t.decodedCwd})}),d&&e.jsxs("div",{className:"rounded-md border border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] px-3 py-2.5 text-xs",children:[e.jsx("div",{className:"mb-1.5 font-medium text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:o("deleteProject.blocked.heading",{n:i.length})}),e.jsx("ul",{className:"space-y-0.5",children:i.map(h=>e.jsxs("li",{className:"font-mono text-[11px] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-secondary)]",children:[h.id," — ",h.isLivePid?`live PID ${h.livePid??"?"}`:"recent"]},h.id))})]})]}),g&&u&&e.jsxs("div",{className:"max-h-[50vh] space-y-3 overflow-auto px-6 py-4 text-sm",children:[u.projectDirRemoved?e.jsx("div",{className:"rounded-md border border-[var(--color-moss)]/40 bg-[var(--color-moss-soft)] px-3 py-2.5 text-[var(--color-fg-primary)]",children:o("deleteProject.success",{n:u.deleted.length,free:E(v),lines:u.historyLinesRemoved})}):u.deleted.length>0?e.jsx("div",{className:"rounded-md border border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] px-3 py-2.5 text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:o("deleteProject.successKept",{n:u.deleted.length,free:E(v),lines:u.historyLinesRemoved})}):null,u.skipped.length>0&&e.jsxs("div",{className:"rounded-md border border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] px-3 py-2.5 text-xs",children:[e.jsx("div",{className:"mb-1 font-medium text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:o("deleteProject.blocked.heading",{n:u.skipped.length})}),e.jsx("ul",{className:"space-y-0.5",children:u.skipped.map(h=>e.jsxs("li",{className:"font-mono text-[11px] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-secondary)]",children:[h.sessionId||"(project)"," — ",h.reason]},`${h.sessionId}-${h.reason}`))})]})]}),m.error&&e.jsx("p",{className:"mx-6 mb-3 rounded-md border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-3 py-2 text-sm text-[var(--color-danger)]",children:m.error.message}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-[var(--color-hairline)] px-6 py-4",children:g?e.jsx("button",{type:"button",onClick:r,className:"rounded-[var(--radius-control)] bg-[var(--color-fg-primary)] px-4 py-1.5 text-sm font-medium text-[var(--color-canvas)] hover:opacity-90",children:o("common.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:r,disabled:m.isPending,className:"rounded-[var(--radius-control)] border border-[var(--color-hairline-strong)] px-4 py-1.5 text-sm text-[var(--color-fg-secondary)] hover:bg-[var(--color-sunken)] disabled:opacity-50",children:o("common.cancel")}),e.jsx("button",{type:"button",onClick:()=>m.mutate(),disabled:m.isPending||n.isLoading||d,className:"rounded-[var(--radius-control)] bg-[var(--color-danger)] px-4 py-1.5 text-sm font-medium text-white shadow-[var(--shadow-rise)] hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:m.isPending?o("deleteProject.btn.confirmPending"):o("deleteProject.btn.confirm")})]})})]})})}function Zt(){const t=S(),[r,o]=l.useState(null),s=_({queryKey:P.health(),queryFn:()=>I("/api/health")}),n=_({queryKey:P.projects(),queryFn:()=>I("/api/projects")}),a=n.data??[],i=a.reduce((p,u)=>p+u.totalBytes,0),d=a.reduce((p,u)=>p+u.sessionCount,0),m=a.map(p=>p.lastActiveAt).filter(p=>!!p).sort().at(-1)??null;return e.jsxs("section",{children:[e.jsx("div",{className:"surface-card p-6",children:e.jsx(er,{title:t("projects.title"),tagline:t("projects.tagline"),stats:a.length>0?{totalBytes:i,totalSessions:d,projectCount:a.length,lastActive:m}:null})}),s.data&&!s.data.claudeRootExists&&e.jsx(Te,{tone:"warn",className:"mt-6",children:t("projects.warn.rootMissing",{root:s.data.claudeRoot})}),n.isLoading&&e.jsx(se,{label:t("common.scanning"),className:"mt-10"}),n.error&&e.jsxs(Te,{tone:"danger",className:"mt-6",children:[t("common.failedProjects"),": ",n.error.message]}),n.data&&n.data.length===0&&e.jsx("p",{className:"mt-10 text-sm text-[var(--color-fg-muted)]",children:t("common.noProjects")}),a.length>0&&e.jsxs("div",{className:"surface-card mt-6 p-6",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("h2",{className:"font-display text-xl font-light tracking-tight text-[var(--color-fg-primary)]",children:t("projects.indexHeading")}),e.jsxs("span",{className:"font-mono text-[11px] uppercase tracking-[0.16em] tabular-nums text-[var(--color-fg-muted)]",children:[String(a.length).padStart(2,"0")," ",a.length===1?t("common.entry"):t("common.entries")]})]}),e.jsx("div",{className:"rule-dotted mt-3","aria-hidden":!0}),e.jsx(tr,{projects:a,onRequestDelete:p=>o(p)})]}),r&&e.jsx(Xt,{project:r,onClose:()=>o(null)})]})}function er({title:t,tagline:r,stats:o}){const s=S();return e.jsxs("header",{className:"relative",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-4 gap-y-1",children:[e.jsxs("h1",{className:"font-display text-[clamp(1.75rem,3.5vw,2.25rem)] font-light leading-[1.1] tracking-[-0.02em] text-[var(--color-fg-primary)]",children:[t,e.jsx("span",{className:"text-[var(--color-accent)]",children:"."})]}),e.jsx("p",{className:"min-w-0 flex-1 font-display text-[13px] italic leading-snug text-[var(--color-fg-muted)]",children:r})]}),o&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-baseline gap-x-3 gap-y-1 text-xs",children:[e.jsx(z,{label:s("projects.stat.onDisk"),value:E(o.totalBytes)}),e.jsx(Q,{}),e.jsx(z,{label:s("projects.stat.projects"),value:o.projectCount}),e.jsx(Q,{}),e.jsx(z,{label:s("projects.stat.sessions"),value:o.totalSessions.toLocaleString()}),e.jsx(Q,{}),e.jsx(z,{label:s("projects.card.lastSeen"),value:Y(o.lastActive)})]})]})}function tr({projects:t,onRequestDelete:r}){const o=S();return e.jsxs(B.ol,{initial:"hidden",animate:"show",variants:fe,className:"mt-4",children:[e.jsxs("li",{"aria-hidden":!0,className:"grid grid-cols-[2.5rem_minmax(0,1fr)_5rem_5.5rem_5rem_3.5rem] items-center gap-x-4 border-b border-[var(--color-hairline)] py-3 sm:grid-cols-[3rem_minmax(0,1fr)_6rem_6rem_6rem_4rem]",children:[e.jsx("span",{className:"eyebrow text-right",children:"№"}),e.jsx("span",{className:"eyebrow",children:o("projects.card.eyebrow")}),e.jsx("span",{className:"eyebrow text-right",children:o("projects.card.sessions")}),e.jsx("span",{className:"eyebrow text-right",children:o("projects.card.onDisk")}),e.jsx("span",{className:"eyebrow text-right",children:o("projects.card.lastSeen")}),e.jsx("span",{className:"eyebrow"})]}),t.map((s,n)=>e.jsx(B.li,{variants:ge,children:e.jsx(rr,{project:s,index:n,onRequestDelete:r})},s.id))]})}function rr({project:t,index:r,onRequestDelete:o}){const s=S(),n=t.decodedCwd,a=n.split(/[\\/]+/).filter(Boolean),i=a.slice(-2).join("/"),d=a.slice(0,-2).join("/");return e.jsxs("div",{className:"ribbon-row group relative grid grid-cols-[2.5rem_minmax(0,1fr)_5rem_5.5rem_5rem_3.5rem] items-center gap-x-4 border-b border-[var(--color-hairline)] py-3 pl-3 transition-colors hover:bg-[var(--color-sunken)] sm:grid-cols-[3rem_minmax(0,1fr)_6rem_6rem_6rem_4rem]",children:[e.jsx(G,{to:`/projects/${encodeURIComponent(t.id)}`,"aria-label":n,className:"absolute inset-0 z-[1] rounded-[inherit] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--color-accent)]",children:e.jsx("span",{className:"sr-only",children:n})}),e.jsx("span",{className:"pointer-events-none text-right font-mono text-[11px] uppercase tracking-[0.16em] tabular-nums text-[var(--color-fg-faint)] group-hover:text-[var(--color-accent)]",children:String(r+1).padStart(2,"0")}),e.jsx("div",{className:"pointer-events-none min-w-0",children:e.jsxs("div",{className:"flex items-baseline gap-2 truncate font-mono text-[13px] text-[var(--color-fg-primary)]",title:n,children:[d&&e.jsxs("span",{className:"text-[var(--color-fg-faint)]",children:[d,"/"]}),e.jsx("span",{className:"font-medium",children:i}),!t.cwdResolved&&e.jsx("span",{className:"ml-1 shrink-0 rounded-full border border-[var(--color-hairline-strong)] px-1.5 py-px font-mono text-[9px] uppercase tracking-[0.16em] text-[var(--color-fg-muted)]",children:s("common.missing")})]})}),e.jsx("span",{className:"pointer-events-none text-right font-mono text-sm tabular-nums text-[var(--color-fg-primary)]",children:t.sessionCount.toLocaleString()}),e.jsx("span",{className:"pointer-events-none text-right font-mono text-sm tabular-nums text-[var(--color-fg-secondary)]",children:E(t.totalBytes)}),e.jsx("span",{className:"pointer-events-none text-right font-mono text-[12.5px] tabular-nums text-[var(--color-fg-secondary)]",children:Y(t.lastActiveAt)}),e.jsxs("div",{className:"relative z-[2] flex items-center justify-end gap-1 pr-1",children:[e.jsx("button",{type:"button",onClick:m=>{m.preventDefault(),m.stopPropagation(),o(t)},"aria-label":s("deleteProject.row.action"),title:s("deleteProject.row.action"),className:"rounded-md border border-transparent p-1.5 text-[var(--color-fg-faint)] transition-colors hover:border-[var(--color-danger)]/40 hover:bg-[var(--color-danger-soft)] hover:text-[var(--color-danger)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-danger)]",children:e.jsx(or,{})}),e.jsx("span",{"aria-hidden":!0,className:"pointer-events-none text-[var(--color-fg-faint)] transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-[var(--color-accent)]",children:e.jsx(sr,{})})]})]})}function or(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M8 6V4.5A1.5 1.5 0 0 1 9.5 3h5A1.5 1.5 0 0 1 16 4.5V6"}),e.jsx("path",{d:"M5.5 6l1.1 13.2A1.5 1.5 0 0 0 8.1 20.5h7.8a1.5 1.5 0 0 0 1.5-1.3L18.5 6"})]})}function sr(){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M9 6l6 6-6 6"})})}function Te({tone:t,className:r="",children:o}){const s=t==="warn"?"border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]":"border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] text-[var(--color-danger)]";return e.jsx("div",{className:`rounded-[10px] border px-4 py-3 text-sm ${s} ${r}`,children:o})}function nr(t,r){if(!r)return[{text:t,match:!1}];const o=t.toLowerCase(),s=r.toLowerCase(),n=[];let a=0;for(;a<t.length;){const i=o.indexOf(s,a);if(i===-1){n.push({text:t.slice(a),match:!1});break}i>a&&n.push({text:t.slice(a,i),match:!1}),n.push({text:t.slice(i,i+r.length),match:!0}),a=i+r.length}return n}function X({text:t,query:r,className:o}){const s=nr(t,r);return e.jsx("span",{className:o,children:s.map((n,a)=>n.match?e.jsx("mark",{className:"rounded-sm bg-[var(--color-accent-soft)] px-0.5 text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:n.text},a):e.jsx("span",{children:n.text},a))})}const Ie=280;function ar({block:t,query:r}){const[o,s]=l.useState(!1),n=JSON.stringify(t.input,null,2);return e.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--color-hairline)] bg-[var(--color-sunken)] text-sm",children:[e.jsxs("button",{type:"button",onClick:()=>s(!o),className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left transition hover:bg-[var(--color-canvas)]",children:[e.jsxs("span",{className:"flex items-center gap-2 font-mono text-[11.5px] font-medium uppercase tracking-[0.06em] text-[var(--color-fg-secondary)]",children:[e.jsx(ve,{kind:"tool"})," ",t.name]}),e.jsx(Ve,{open:o})]}),o&&e.jsx("pre",{className:"overflow-x-auto border-t border-[var(--color-hairline)] bg-[var(--color-surface)] px-3 py-2 font-mono text-[11.5px] text-[var(--color-fg-primary)]",children:e.jsx(X,{text:n,query:r})})]})}function ir({block:t,query:r}){const o=S(),[s,n]=l.useState(!1),a=t.content.length>Ie,i=s||!a?t.content:t.content.slice(0,Ie)+"…",d=t.isError?"border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] text-[var(--color-danger)]":"border-[var(--color-hairline)] bg-[var(--color-sunken)] text-[var(--color-fg-primary)]";return e.jsxs("div",{className:`overflow-hidden rounded-xl border text-sm ${d}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[e.jsxs("span",{className:"flex items-center gap-2 font-mono text-[11.5px] font-medium uppercase tracking-[0.06em]",children:[e.jsx(ve,{kind:t.isError?"error":"result"}),t.isError?o("tool.error"):o("tool.result")]}),a&&e.jsx("button",{type:"button",onClick:()=>n(!s),className:"font-mono text-[10.5px] uppercase tracking-[0.16em] underline-offset-2 hover:underline",children:o(s?"common.collapse":"common.expand")})]}),e.jsx("pre",{className:`overflow-x-auto whitespace-pre-wrap break-words border-t px-3 py-2 font-mono text-[11.5px] ${t.isError?"border-[var(--color-danger)]/30":"border-[var(--color-hairline)] bg-[var(--color-surface)]"}`,children:e.jsx(X,{text:i,query:r})})]})}function lr({block:t,query:r}){const o=S(),[s,n]=l.useState(!1),a=t.text.trim()!=="";return e.jsxs("div",{className:"overflow-hidden rounded-xl border border-[var(--color-hairline-strong)] bg-[var(--color-sunken)] text-sm text-[var(--color-fg-secondary)]",children:[e.jsxs("button",{type:"button",onClick:()=>n(!s),className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left",children:[e.jsxs("span",{className:"flex items-center gap-2 font-mono text-[11.5px] font-medium uppercase tracking-[0.06em]",children:[e.jsx(ve,{kind:"thinking"})," ",o("tool.thinking")]}),e.jsx(Ve,{open:s})]}),s&&(a?e.jsx("div",{className:"whitespace-pre-wrap break-words border-t border-[var(--color-hairline-strong)] bg-[var(--color-surface)] px-3 py-2 text-[13px] leading-relaxed text-[var(--color-fg-secondary)]",children:e.jsx(X,{text:t.text,query:r})}):e.jsx("p",{className:"border-t border-[var(--color-hairline-strong)] bg-[var(--color-surface)] px-3 py-2 text-[12px] italic text-[var(--color-fg-muted)]",children:o("tool.thinkingEncrypted")}))]})}function Ve({open:t}){return e.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-[var(--color-fg-muted)] transition-transform",style:{transform:t?"rotate(90deg)":"rotate(0)"},"aria-hidden":!0,children:e.jsx("path",{d:"M9 6l6 6-6 6"})})}function ve({kind:t}){const r={width:11,height:11,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};return t==="tool"?e.jsx("svg",{...r,children:e.jsx("path",{d:"M14.7 5.3a3 3 0 1 0 4 4l-2.5 2.5 5 5-2.7 2.7-5-5-2.5 2.5a3 3 0 1 0-4-4z"})}):t==="result"?e.jsxs("svg",{...r,children:[e.jsx("path",{d:"M5 12h13"}),e.jsx("path",{d:"M13 7l5 5-5 5"})]}):t==="error"?e.jsxs("svg",{...r,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 8v4.5"}),e.jsx("path",{d:"M12 16h.01"})]}):e.jsxs("svg",{...r,children:[e.jsx("path",{d:"M9 18h6"}),e.jsx("path",{d:"M10 21h4"}),e.jsx("path",{d:"M12 3a6 6 0 0 0-3.6 10.8c.8.6 1.1 1.6 1.1 2.7v.5h5v-.5c0-1.1.3-2.1 1.1-2.7A6 6 0 0 0 12 3z"})]})}function cr({message:t,query:r}){return t.isMeta?e.jsx(mr,{message:t,query:r}):t.type==="user"&&t.blocks.length>0&&t.blocks.every(o=>o.type==="tool_result")?e.jsx(Re,{message:t,query:r,variant:"tool"}):t.type==="user"?e.jsx(dr,{message:t,query:r}):e.jsx(Re,{message:t,query:r})}function Re({message:t,query:r,variant:o="assistant"}){const s=S(),n=o==="tool",a=s(n?"message.role.tool":"message.role.claude"),i=n?"border-l-[var(--color-hairline-strong)]":"border-l-[var(--color-accent)]";return e.jsxs("div",{className:"flex items-start gap-3","data-uuid":t.uuid,children:[e.jsx(Xe,{role:"assistant"}),e.jsxs("div",{className:"min-w-0 flex-1 max-w-[min(54rem,calc(100%-3rem))]",children:[e.jsx(Ge,{align:"left",label:a,model:t.model,ts:t.ts,accent:!n}),e.jsx("article",{className:"mt-1.5 rounded-2xl rounded-tl-sm border border-l-[3px] border-[var(--color-hairline)] bg-[var(--color-surface)] px-4 py-3 shadow-[0_1px_0_0_var(--color-hairline)] "+i,children:e.jsx(Je,{blocks:t.blocks,query:r})})]})]})}function dr({message:t,query:r}){const o=S();return e.jsxs("div",{className:"flex items-start justify-end gap-3","data-uuid":t.uuid,children:[e.jsxs("div",{className:"min-w-0 max-w-[min(46rem,calc(100%-3rem))]",children:[e.jsx(Ge,{align:"right",label:o("message.role.you"),model:t.model,ts:t.ts}),e.jsx("article",{className:"mt-1.5 rounded-2xl rounded-tr-sm bg-[var(--color-accent-soft)] px-4 py-3 text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]",children:e.jsx(Je,{blocks:t.blocks,query:r})})]}),e.jsx(Xe,{role:"user"})]})}function mr({message:t,query:r}){const o=S();return e.jsxs("div",{className:"my-2 flex items-center gap-3 px-4","data-uuid":t.uuid,children:[e.jsx("span",{className:"h-px flex-1 bg-[var(--color-hairline)]"}),e.jsxs("div",{className:"max-w-2xl text-center",children:[e.jsxs("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-[var(--color-fg-muted)]",children:[o("message.role.system")," · ",xe(t.ts)]}),e.jsx("div",{className:"mt-1 space-y-1 text-xs italic text-[var(--color-fg-muted)]",children:t.blocks.map((s,n)=>{if(s.type==="text"){const a=s.text.length>200?s.text.slice(0,200)+"…":s.text;return e.jsx("p",{className:"whitespace-pre-wrap break-words",children:e.jsx(X,{text:a,query:r})},n)}return s.type==="tool_use"?e.jsxs("p",{children:[o("tool.use")," · ",s.name]},n):s.type==="tool_result"?e.jsx("p",{children:o("tool.result")},n):null})})]}),e.jsx("span",{className:"h-px flex-1 bg-[var(--color-hairline)]"})]})}function Ge({align:t,label:r,model:o,ts:s,accent:n}){return e.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] "+(t==="right"?"flex-row-reverse text-right":""),children:[e.jsx("span",{className:"font-display text-[14px] font-medium tracking-tight "+(n?"text-[var(--color-accent-ink)] dark:text-[var(--color-accent)]":"text-[var(--color-fg-primary)]"),children:r}),o&&e.jsx("span",{className:"truncate font-mono text-[10px] uppercase tracking-[0.14em] text-[var(--color-fg-faint)]",children:o}),e.jsx("time",{className:"font-mono tabular-nums text-[var(--color-fg-muted)]",children:xe(s)})]})}function Je({blocks:t,query:r}){const o=S();return e.jsx("div",{className:"space-y-2.5",children:t.map((s,n)=>{switch(s.type){case"text":return e.jsx("p",{className:"whitespace-pre-wrap break-words text-[14.5px] leading-relaxed",children:e.jsx(X,{text:s.text,query:r})},n);case"tool_use":return e.jsx(ar,{block:s,query:r},n);case"tool_result":return e.jsx(ir,{block:s,query:r},n);case"thinking":return e.jsx(lr,{block:s,query:r},n);case"image":return e.jsxs("div",{className:"rounded-xl border border-[var(--color-hairline)] bg-[var(--color-sunken)] px-3 py-2 font-mono text-[11px] text-[var(--color-fg-muted)]",children:[o("tool.image"),s.mediaType?` · ${s.mediaType}`:""]},n);default:return e.jsx("pre",{className:"overflow-x-auto rounded-xl border border-[var(--color-hairline)] bg-[var(--color-sunken)] px-3 py-2 font-mono text-xs text-[var(--color-fg-secondary)]",children:JSON.stringify(s.raw,null,2)},n)}})})}function Xe({role:t}){return t==="assistant"?e.jsx("span",{"aria-hidden":!0,className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-[var(--color-hairline-strong)] bg-[var(--color-surface)] text-[var(--color-accent)]",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M19 7.5A8 8 0 1 0 19 16.5"}),e.jsx("path",{d:"M15.5 9.5a4.5 4.5 0 1 0 0 5",opacity:"0.45"})]})}):e.jsx("span",{"aria-hidden":!0,className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-[var(--color-fg-primary)] font-display text-sm font-medium text-[var(--color-canvas)]",children:"Y"})}const De=50,Be=50;function ur(){const t=S(),r=Oe(),{projectId:o,sessionId:s}=Ue(),[n]=ct(),a=o??"",i=s??"",d=n.get("focus"),m=n.get("q"),[p,u]=l.useState(!1),[g,v]=l.useState(!1),[h,c]=l.useState(""),f=l.useDeferredValue(h),[L,w]=l.useState(De),[A,D]=l.useState(!1),R=l.useRef(null),W=l.useRef(null);l.useEffect(()=>{w(De)},[a,i]);const{data:b,isLoading:O,error:F}=_({queryKey:P.session(a,i),queryFn:()=>I(`/api/sessions/${encodeURIComponent(a)}/${encodeURIComponent(i)}`),enabled:!!a&&!!i}),U=_({queryKey:P.projects(),queryFn:()=>I("/api/projects")}),$=l.useMemo(()=>{var y;return(y=U.data)==null?void 0:y.find(k=>k.id===a)},[U.data,a]),j=_({queryKey:P.projectSessions(a),queryFn:()=>I(`/api/projects/${encodeURIComponent(a)}/sessions`),enabled:!!a}),x=l.useMemo(()=>{var y;return((y=j.data)==null?void 0:y.find(k=>k.id===i))??null},[j.data,i]),N=x?void 0:j.isLoading?t("common.loading"):t("session.action.deleteTooltipBlocked"),C=l.useMemo(()=>b?b.messages.map(y=>({message:y,haystack:vr(y)})):[],[b]),T=l.useMemo(()=>{let y=C;if(p||(y=y.filter(k=>!k.message.isMeta)),g&&(y=y.filter(k=>gr(k.message))),f){const k=f.toLowerCase();y=y.filter(M=>M.haystack.includes(k))}return y},[C,p,g,f]),K=!!f||g,q=l.useMemo(()=>K?T:T.slice(-L),[T,K,L]),et=!K&&q.length<T.length;l.useEffect(()=>{if(!b)return;const y=`${i}|${d??""}|${m??""}`;if(R.current!==y&&(R.current=y,m&&c(m),d)){const k=b.messages.find(M=>M.uuid===d);k!=null&&k.isMeta&&u(!0)}},[b,i,d,m]),l.useEffect(()=>{if(!d||!b||K)return;const y=T.findIndex(M=>M.message.uuid===d);if(y===-1)return;const k=T.length-y;k>L&&w(k)},[d,T,L,K,b]),l.useEffect(()=>{if(!d||!b)return;const y=`${i}|${d}`;if(W.current===y||!q.some(M=>M.message.uuid===d))return;W.current=y;const k=requestAnimationFrame(()=>{const M=document.querySelector(`[data-uuid="${CSS.escape(d)}"]`);if(!M)return;M.scrollIntoView({block:"center",behavior:"smooth"});const ye=M.closest("li")??M;ye.classList.add("flash-focus"),window.setTimeout(()=>ye.classList.remove("flash-focus"),1300)});return()=>cancelAnimationFrame(k)},[d,q,b,i]);const tt=l.useMemo(()=>{const y=$==null?void 0:$.decodedCwd;return y?y.split(/[\\/]+/).filter(Boolean).at(-1)??y:a.slice(-12)},[$,a]),Z=l.useMemo(()=>b?b.meta.customTitle??b.meta.title:null,[b]),ee=ue(),rt=J({mutationFn:y=>I(`/api/sessions/${encodeURIComponent(a)}/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({customTitle:y})}),onSuccess:({customTitle:y})=>{ee.setQueryData(P.session(a,i),k=>k&&{...k,meta:{...k.meta,customTitle:y}}),ee.setQueryData(P.projectSessions(a),k=>k==null?void 0:k.map(M=>M.id===i?{...M,customTitle:y}:M)),ee.invalidateQueries({queryKey:P.session(a,i)}),ee.invalidateQueries({queryKey:P.projectSessions(a)})}}),ot=b!=null&&b.meta.gitBranch?t("session.tagline.branch",{branch:b.meta.gitBranch}):"";return e.jsxs("section",{children:[e.jsx(He,{items:[{label:t("session.crumbProjects"),to:"/"},{label:tt,to:`/projects/${encodeURIComponent(a)}`,mono:!0,icon:e.jsx(me,{})},{label:Z??i.slice(0,8),mono:!Z,icon:e.jsx(me,{})}]}),b&&e.jsx("div",{className:"surface-card mt-4 p-6",children:e.jsx(pr,{sid:i,title:Z,tagline:t("session.tagline",{started:Y(b.meta.firstAt),lastTouched:Y(b.meta.lastAt),branchPart:ot}),firstAt:b.meta.firstAt,messageCount:b.meta.messageCount,bytes:b.meta.bytes,version:b.meta.version,branch:b.meta.gitBranch,editableValue:Z??"",onTitleEdit:async y=>{await rt.mutateAsync(y)},renameDisabled:(x==null?void 0:x.isLivePid)===!0,renameTooltip:(x==null?void 0:x.isLivePid)===!0?t("session.action.renameTooltipLive",{pid:x.livePid??"?"}):void 0,onDelete:x?()=>D(!0):void 0,deleteDisabled:!x,deleteTooltip:N,deleteLabel:t("session.action.delete")})}),A&&x&&e.jsx(Ye,{projectId:a,selected:[x],onClose:()=>D(!1),onDeleted:y=>{y.includes(i)&&(D(!1),r(`/projects/${encodeURIComponent(a)}`,{replace:!0}))}}),e.jsx(fr,{query:h,onQuery:c,showMeta:p,onShowMeta:u,onlyUser:g,onOnlyUser:v,shown:q.length,total:T.length,hasData:!!b}),e.jsxs("div",{className:"mt-6",children:[(b==null?void 0:b.truncated)&&e.jsx(_e,{tone:"warn",className:"mb-6",children:t("session.truncated",{n:$t.toLocaleString()})}),O&&e.jsx(se,{label:t("common.loadingSession")}),F&&e.jsxs(_e,{tone:"danger",children:[t("common.failedSession"),": ",F.message]}),b&&T.length===0&&e.jsx("p",{className:"mt-2 max-w-2xl font-display text-[15px] italic text-[var(--color-fg-muted)]",children:t("common.noMessagesMatch")}),b&&T.length>0&&e.jsxs("ol",{className:"border-t border-[var(--color-hairline-strong)]",children:[et&&e.jsx("li",{className:"flex justify-center border-b border-[var(--color-hairline)] py-3",children:e.jsx("button",{type:"button",onClick:()=>w(y=>Math.min(y+Be,T.length)),className:"rounded-[var(--radius-control)] border border-[var(--color-hairline)] bg-[var(--color-surface)] px-4 py-1.5 font-mono text-[11px] uppercase tracking-[0.14em] text-[var(--color-fg-secondary)] transition hover:border-[var(--color-accent)] hover:text-[var(--color-accent-ink)] dark:hover:text-[var(--color-accent)]",children:t("common.loadEarlier",{n:Math.min(Be,T.length-q.length)})})}),e.jsx(B.div,{initial:"hidden",animate:"show",variants:fe,children:q.map((y,k)=>{const M=y.message.isMeta;return e.jsx(B.li,{variants:ge,className:M?"py-2":"py-3",children:e.jsx(cr,{message:y.message,query:f})},y.message.uuid||y.message.ts||String(k))})},q.length===0?"empty":"list")]})]}),b&&e.jsx(wr,{})]})}function pr({sid:t,title:r,tagline:o,firstAt:s,messageCount:n,bytes:a,version:i,branch:d,editableValue:m,onTitleEdit:p,renameDisabled:u,renameTooltip:g,onDelete:v,deleteDisabled:h,deleteTooltip:c,deleteLabel:f}){const L=S(),w=hr(s);return e.jsxs("header",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-[var(--color-hairline)] pb-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3 font-mono text-[10px] uppercase tracking-[0.22em] text-[var(--color-fg-muted)]",children:[e.jsx("span",{className:"text-[var(--color-accent)]",children:"●"}),e.jsx("span",{children:"§ SESSION"}),e.jsx("span",{className:"hidden h-3 w-px bg-[var(--color-hairline-strong)] sm:inline-block"}),e.jsx("span",{className:"hidden truncate normal-case tracking-[0.05em] text-[var(--color-fg-faint)] sm:inline",children:t}),d&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden h-3 w-px bg-[var(--color-hairline-strong)] md:inline-block"}),e.jsx("span",{className:"hidden truncate md:inline",children:d})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.22em] tabular-nums text-[var(--color-fg-muted)]",children:w}),(v||h)&&e.jsxs("button",{type:"button",onClick:v,disabled:h||!v,title:c,"aria-label":f,className:"inline-flex items-center gap-1.5 rounded-[var(--radius-control)] border border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] px-3 py-1 text-[11px] font-medium uppercase tracking-[0.14em] text-[var(--color-danger)] transition hover:border-[var(--color-danger)] disabled:cursor-not-allowed disabled:opacity-40",children:[e.jsx(br,{})," ",f]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-x-10 gap-y-6 pt-5 pb-2 lg:grid-cols-12",children:[e.jsx("div",{className:"lg:col-span-8",children:e.jsx(xr,{title:r??t.slice(0,12)+"…",editableValue:m,onTitleEdit:p,isFallback:!r,disabled:u,disabledTooltip:g})}),e.jsx("div",{className:"lg:col-span-4 lg:pt-3",children:e.jsx("p",{className:"border-l-2 border-[var(--color-accent)] pl-4 font-display text-[15px] italic leading-[1.55] text-[var(--color-fg-secondary)]",children:o})})]}),e.jsx("div",{className:"rule-dotted mt-6","aria-hidden":!0}),e.jsxs("dl",{className:"mt-3 flex flex-wrap items-baseline gap-x-8 gap-y-2",children:[e.jsx(te,{label:L("session.meta.messages"),value:n.toLocaleString()}),e.jsx(te,{label:L("session.meta.size"),value:E(a)}),i&&e.jsx(te,{label:L("session.meta.version"),value:i}),e.jsx(te,{label:L("session.meta.started"),value:xe(s)})]})]})}const Ae="font-display text-[clamp(1.5rem,3vw,2rem)] font-light leading-[1.15] tracking-[-0.018em] text-[var(--color-fg-primary)]";function xr({title:t,editableValue:r,onTitleEdit:o,isFallback:s,disabled:n,disabledTooltip:a}){const[i,d]=l.useState(!1),[m,p]=l.useState(r),[u,g]=l.useState(!1),[v,h]=l.useState(null),c=l.useRef(null);l.useEffect(()=>{i||p(r)},[i,r]),l.useEffect(()=>{var w;i&&((w=c.current)==null||w.select())},[i]);function f(){p(r),h(null),d(!0)}async function L(){const w=m.trim();if(!w||w===r){d(!1);return}g(!0),h(null);try{await o(w),d(!1)}catch(A){h(A.message)}finally{g(!1)}}return i?e.jsxs("div",{children:[e.jsx("input",{ref:c,value:m,disabled:u,onChange:w=>{p(w.target.value),v&&h(null)},onKeyDown:w=>{w.key==="Enter"?(w.preventDefault(),L()):w.key==="Escape"&&(w.preventDefault(),d(!1),h(null))},onBlur:()=>{!u&&!v&&d(!1)},maxLength:200,className:Ae+" w-full bg-transparent border-b border-[var(--color-accent)] outline-none focus:outline-none disabled:opacity-60"}),v&&e.jsx("p",{className:"mt-1 text-xs text-[var(--color-danger)]",children:v})]}):e.jsxs("div",{className:"group flex items-baseline gap-3",children:[e.jsxs("h1",{className:Ae+(s?" font-mono":""),children:[t,e.jsx("span",{className:"text-[var(--color-accent)]",children:"."})]}),e.jsx("button",{type:"button",onClick:f,"aria-label":"Rename",title:n?a??"Rename unavailable":"Rename",disabled:n,className:"flex-shrink-0 rounded-md p-1.5 text-[var(--color-fg-muted)] opacity-0 transition hover:bg-[var(--color-sunken)] hover:text-[var(--color-fg-primary)] focus:opacity-100 group-hover:opacity-100 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-[var(--color-fg-muted)] disabled:opacity-40 disabled:group-hover:opacity-40",children:e.jsx(kr,{})})]})}function te({label:t,value:r}){return e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("dt",{className:"eyebrow",children:t}),e.jsx("dd",{className:"font-mono text-[12px] tabular-nums text-[var(--color-fg-primary)]",children:r})]})}function hr(t){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?"—":r.toLocaleDateString("en-GB",{weekday:"short",day:"2-digit",month:"short",year:"numeric"}).toUpperCase().replace(/,/g," ·")}function fr({query:t,onQuery:r,showMeta:o,onShowMeta:s,onlyUser:n,onOnlyUser:a,shown:i,total:d,hasData:m}){const p=S();return e.jsx("div",{className:"sticky top-2 z-30 mt-6 rounded-[var(--radius-input)] border border-[var(--color-hairline)] bg-[var(--color-surface)] px-4 sm:px-5 py-2.5 shadow-[var(--shadow-rise)]",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsxs("div",{className:"flex flex-1 min-w-[14rem] items-center gap-2 border-b border-[var(--color-hairline)] py-1 transition focus-within:border-[var(--color-accent)]",children:[e.jsx(jr,{className:"text-[var(--color-fg-muted)]"}),e.jsx("input",{type:"search",value:t,onChange:u=>r(u.target.value),placeholder:p("common.searchPlaceholder"),className:"w-full bg-transparent text-sm text-[var(--color-fg-primary)] placeholder:text-[var(--color-fg-faint)] focus:outline-none"})]}),e.jsx("span",{className:"hidden h-4 w-px bg-[var(--color-hairline-strong)] sm:inline-block"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx($e,{checked:o,onChange:s,label:p("common.system")}),e.jsx($e,{checked:n,onChange:a,label:p("common.onlyUser")})]}),m&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden h-4 w-px bg-[var(--color-hairline-strong)] sm:inline-block"}),e.jsx("span",{className:"font-mono text-[11px] tabular-nums text-[var(--color-fg-muted)]",children:p("session.shown",{shown:i,total:d})})]})]})})}function $e({checked:t,onChange:r,label:o}){return e.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-1.5",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.target.checked),className:"sr-only"}),e.jsx("span",{"aria-hidden":!0,className:"font-mono text-[11px] uppercase tracking-[0.16em] transition "+(t?"text-[var(--color-accent)] underline underline-offset-[6px] decoration-[var(--color-accent)]/50":"text-[var(--color-fg-faint)] hover:text-[var(--color-fg-secondary)]"),children:o})]})}function _e({tone:t,className:r="",children:o}){const s=t==="warn"?"border-[var(--color-accent)]/40 bg-[var(--color-accent-soft)] text-[var(--color-accent-ink)] dark:text-[var(--color-fg-primary)]":"border-[var(--color-danger)]/40 bg-[var(--color-danger-soft)] text-[var(--color-danger)]";return e.jsx("div",{className:`rounded-[10px] border px-4 py-3 text-sm ${s} ${r}`,children:o})}function gr(t){return t.type!=="user"?!1:t.blocks.length===0?!0:t.blocks.some(r=>r.type!=="tool_result")}function vr(t){return t.blocks.map(yr).join(`
|
|
4
|
-
`).toLowerCase()}function yr(t){switch(t.type){case"text":case"thinking":return t.text;case"tool_use":return`${t.name} ${JSON.stringify(t.input)}`;case"tool_result":return t.content;case"image":return"";default:return JSON.stringify(t.raw)}}function jr({className:t=""}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",className:t,"aria-hidden":!0,children:[e.jsx("circle",{cx:"11",cy:"11",r:"6.2"}),e.jsx("path",{d:"M20 20l-4.3-4.3"})]})}function br(){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M8 6V4.5A1.5 1.5 0 0 1 9.5 3h5A1.5 1.5 0 0 1 16 4.5V6"}),e.jsx("path",{d:"M5.5 6l1.1 13.2A1.5 1.5 0 0 0 8.1 20.5h7.8a1.5 1.5 0 0 0 1.5-1.3L18.5 6"})]})}function kr(){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}const Fe=320;function wr(){const t=S(),[r,o]=l.useState(!1),[s,n]=l.useState(!1);if(l.useEffect(()=>{let i=0;const d=()=>{i=0;const p=window.scrollY,u=window.innerHeight,g=document.documentElement.scrollHeight;o(p>=Fe),n(g-(p+u)>=Fe)},m=()=>{i||(i=requestAnimationFrame(d))};return d(),window.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",m,{passive:!0}),()=>{window.removeEventListener("scroll",m),window.removeEventListener("resize",m),i&&cancelAnimationFrame(i)}},[]),!r&&!s)return null;const a="rounded-full border border-[var(--color-hairline)] bg-[var(--color-surface)] p-2.5 text-[var(--color-fg-secondary)] shadow-[var(--shadow-pop)] transition hover:border-[var(--color-accent)] hover:text-[var(--color-accent)]";return e.jsxs("div",{className:"fixed bottom-6 right-6 z-30 flex flex-col gap-2",children:[r&&e.jsx("button",{type:"button","aria-label":t("common.scrollToTop"),title:t("common.scrollToTop"),onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:a,children:e.jsx(ze,{direction:"up"})}),s&&e.jsx("button",{type:"button","aria-label":t("common.scrollToBottom"),title:t("common.scrollToBottom"),onClick:()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:"smooth"}),className:a,children:e.jsx(ze,{direction:"down"})})]})}function ze({direction:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:t==="up"?"M6 15l6-6 6 6":"M6 9l6 6 6-6"})})}const Nr=l.lazy(()=>pe(()=>import("./DiskUsage-Bq4VaoUA.js"),__vite__mapDeps([0,1,2,3,4,5]))),Sr=l.lazy(()=>pe(()=>import("./ProjectMemory-aSV8UzQ9.js"),__vite__mapDeps([6,1,2,5,3]))),Lr=l.lazy(()=>pe(()=>import("./ImportPage-b8NORa8b.js"),__vite__mapDeps([7,1,2,5,3])));function Cr(){const[t,r]=l.useState(!1),o=l.useCallback(()=>r(a=>!a),[]),s=l.useCallback(()=>r(!0),[]),n=l.useCallback(()=>r(!1),[]);return ht("mod+k",o),e.jsxs("div",{className:"flex min-h-dvh",children:[e.jsx(Et,{onSearchOpen:s}),e.jsx("main",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"mx-auto w-full max-w-6xl px-5 py-8 sm:px-8 lg:px-12",children:e.jsxs(dt,{children:[e.jsx(H,{path:"/",element:e.jsx(Zt,{})}),e.jsx(H,{path:"/projects/:projectId",element:e.jsx(Ht,{})}),e.jsx(H,{path:"/projects/:projectId/memory",element:e.jsx(l.Suspense,{fallback:e.jsx(ie,{}),children:e.jsx(Sr,{})})}),e.jsx(H,{path:"/projects/:projectId/sessions/:sessionId",element:e.jsx(ur,{})}),e.jsx(H,{path:"/disk",element:e.jsx(l.Suspense,{fallback:e.jsx(ie,{}),children:e.jsx(Nr,{})})}),e.jsx(H,{path:"/import",element:e.jsx(l.Suspense,{fallback:e.jsx(ie,{}),children:e.jsx(Lr,{})})})]})})}),e.jsx(yt,{open:t,onClose:n})]})}function ie(){const t=S();return e.jsx("div",{className:"flex h-40 items-center justify-center",children:e.jsx(se,{label:t("common.loading"),className:"items-center"})})}const Pr=new at({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1}}}),Ze=document.getElementById("root");if(!Ze)throw new Error("#root not found");st.createRoot(Ze).render(e.jsx(nt.StrictMode,{children:e.jsx(it,{client:Pr,children:e.jsx(mt,{children:e.jsx(Cr,{})})})}));export{He as B,se as L,z as M,zt as P,Q as S,E as a,Y as b,I as c,me as d,ge as f,P as q,fe as s,S as u};
|
|
5
|
-
//# sourceMappingURL=index-DLATR3tZ.js.map
|