cursor-local-remote 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +25 -25
- package/.next/app-path-routes-manifest.json +7 -7
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +12 -12
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +2 -2
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/info/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/notifications/test/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/route.js +2 -2
- package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/active/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/history/route.js +1 -1
- package/.next/server/app/api/sessions/history/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/route.js +2 -2
- package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/watch/route.js +2 -2
- package/.next/server/app/api/sessions/watch/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/upload/route_client-reference-manifest.js +1 -1
- package/.next/server/app/index.html +2 -2
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +3 -3
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +7 -7
- package/.next/server/chunks/184.js +2 -2
- package/.next/server/middleware-manifest.json +1 -1
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/500.html +1 -1
- package/.next/static/chunks/app/page-ad3f0362e41a2976.js +1 -0
- package/.next/static/css/c2cea7b9cd78f685.css +1 -0
- package/README.md +1 -0
- package/bin/cursor-remote.mjs +1 -0
- package/bin/dev.mjs +1 -0
- package/package.json +1 -1
- package/.next/static/chunks/app/page-15e319bd13e0cc7c.js +0 -1
- package/.next/static/css/4e3b3a779665aaeb.css +0 -1
- /package/.next/static/{XMu8K85CP5u5_cZgrtqTv → kbKNDoW66g_F6hqOKd28R}/_buildManifest.js +0 -0
- /package/.next/static/{XMu8K85CP5u5_cZgrtqTv → kbKNDoW66g_F6hqOKd28R}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{"622":{"*":{"id":"2146","name":"*","chunks":[],"async":false}},"1959":{"*":{"id":"1603","name":"*","chunks":[],"async":false}},"2317":{"*":{"id":"1139","name":"*","chunks":[],"async":false}},"3886":{"*":{"id":"5170","name":"*","chunks":[],"async":false}},"4431":{"*":{"id":"2263","name":"*","chunks":[],"async":false}},"
|
|
1
|
+
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{"622":{"*":{"id":"2146","name":"*","chunks":[],"async":false}},"1959":{"*":{"id":"1603","name":"*","chunks":[],"async":false}},"2317":{"*":{"id":"1139","name":"*","chunks":[],"async":false}},"3886":{"*":{"id":"5170","name":"*","chunks":[],"async":false}},"4431":{"*":{"id":"2263","name":"*","chunks":[],"async":false}},"4522":{"*":{"id":"9566","name":"*","chunks":[],"async":false}},"5278":{"*":{"id":"8922","name":"*","chunks":[],"async":false}},"5932":{"*":{"id":"7996","name":"*","chunks":[],"async":false}},"7150":{"*":{"id":"4160","name":"*","chunks":[],"async":false}},"7989":{"*":{"id":"8495","name":"*","chunks":[],"async":false}},"8924":{"*":{"id":"9234","name":"*","chunks":[],"async":false}},"9766":{"*":{"id":"7526","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/builtin/global-error.js":{"id":7150,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/builtin/global-error.js":{"id":7150,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/client-page.js":{"id":1959,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/client-page.js":{"id":1959,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/client-segment.js":{"id":7989,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/client-segment.js":{"id":7989,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":3886,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":3886,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/layout-router.js":{"id":9766,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/layout-router.js":{"id":9766,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/metadata/async-metadata.js":{"id":5278,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/metadata/async-metadata.js":{"id":5278,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/client/components/render-from-template-context.js":{"id":8924,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":8924,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/lib/framework/boundary-components.js":{"id":4431,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/lib/framework/boundary-components.js":{"id":4431,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/lib/metadata/generate/icon-mark.js":{"id":622,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/node_modules/next/dist/esm/lib/metadata/generate/icon-mark.js":{"id":622,"name":"*","chunks":[],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/src/app/globals.css":{"id":3673,"name":"*","chunks":["558","static/chunks/app/layout-a7c7dda1f998a1ce.js"],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/src/components/pwa-install.tsx":{"id":2317,"name":"*","chunks":["558","static/chunks/app/layout-a7c7dda1f998a1ce.js"],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/src/components/chat-workspace.tsx":{"id":4522,"name":"*","chunks":["687","static/chunks/687-b390283af2e3452f.js","593","static/chunks/app/page-ad3f0362e41a2976.js"],"async":false},"/Users/jonmakinen/Documents/cursor-local-remote/src/components/error-boundary.tsx":{"id":5932,"name":"*","chunks":["687","static/chunks/687-b390283af2e3452f.js","593","static/chunks/app/page-ad3f0362e41a2976.js"],"async":false}},"entryCSSFiles":{"/Users/jonmakinen/Documents/cursor-local-remote/src/":[],"/Users/jonmakinen/Documents/cursor-local-remote/src/app/layout":[{"inlined":false,"path":"static/css/c2cea7b9cd78f685.css"}],"/Users/jonmakinen/Documents/cursor-local-remote/src/app/page":[{"inlined":false,"path":"static/css/30da1f7eab9bf366.css"}]},"rscModuleMapping":{"622":{"*":{"id":"1384","name":"*","chunks":[],"async":false}},"1959":{"*":{"id":"3597","name":"*","chunks":[],"async":false}},"2317":{"*":{"id":"3257","name":"*","chunks":[],"async":false}},"3673":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"3886":{"*":{"id":"9748","name":"*","chunks":[],"async":false}},"4431":{"*":{"id":"3041","name":"*","chunks":[],"async":false}},"4522":{"*":{"id":"6873","name":"*","chunks":[],"async":false}},"5278":{"*":{"id":"7184","name":"*","chunks":[],"async":false}},"5932":{"*":{"id":"1706","name":"*","chunks":[],"async":false}},"7150":{"*":{"id":"1170","name":"*","chunks":[],"async":false}},"7989":{"*":{"id":"6893","name":"*","chunks":[],"async":false}},"8924":{"*":{"id":"9576","name":"*","chunks":[],"async":false}},"9766":{"*":{"id":"6060","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
+
"/_not-found/page": "app/_not-found/page.js",
|
|
2
3
|
"/apple-icon.png/route": "app/apple-icon.png/route.js",
|
|
3
|
-
"/icon.png/route": "app/icon.png/route.js",
|
|
4
4
|
"/manifest.webmanifest/route": "app/manifest.webmanifest/route.js",
|
|
5
|
-
"/
|
|
6
|
-
"/api/notifications/test/route": "app/api/notifications/test/route.js",
|
|
5
|
+
"/icon.png/route": "app/icon.png/route.js",
|
|
7
6
|
"/api/info/route": "app/api/info/route.js",
|
|
8
7
|
"/api/projects/route": "app/api/projects/route.js",
|
|
9
|
-
"/api/chat/route": "app/api/chat/route.js",
|
|
10
8
|
"/api/models/route": "app/api/models/route.js",
|
|
11
9
|
"/api/sessions/history/route": "app/api/sessions/history/route.js",
|
|
10
|
+
"/api/chat/route": "app/api/chat/route.js",
|
|
11
|
+
"/api/sessions/route": "app/api/sessions/route.js",
|
|
12
|
+
"/api/notifications/test/route": "app/api/notifications/test/route.js",
|
|
12
13
|
"/api/sessions/active/route": "app/api/sessions/active/route.js",
|
|
13
14
|
"/api/settings/route": "app/api/settings/route.js",
|
|
14
15
|
"/api/terminal/input/route": "app/api/terminal/input/route.js",
|
|
15
|
-
"/api/sessions/route": "app/api/sessions/route.js",
|
|
16
|
+
"/api/sessions/watch/route": "app/api/sessions/watch/route.js",
|
|
16
17
|
"/api/terminal/route": "app/api/terminal/route.js",
|
|
17
18
|
"/api/terminal/stream/route": "app/api/terminal/stream/route.js",
|
|
18
|
-
"/api/sessions/watch/route": "app/api/sessions/watch/route.js",
|
|
19
|
-
"/api/upload/route": "app/api/upload/route.js",
|
|
20
19
|
"/api/git/route": "app/api/git/route.js",
|
|
20
|
+
"/api/upload/route": "app/api/upload/route.js",
|
|
21
21
|
"/page": "app/page.js"
|
|
22
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
exports.id=184,exports.ids=[184],exports.modules={401:(a,b,c)=>{"use strict";c.d(b,{Mf:()=>k,QO:()=>i,UH:()=>g,Wf:()=>d,Wg:()=>l,ZU:()=>j,c1:()=>e,jf:()=>f,wS:()=>h});let d=6e4,e=12e4,f=150,g=15e3,h=800,i=3e5,j=3e4,k=300,l=3100},5514:(a,b,c)=>{"use strict";c.d(b,{Bz:()=>
|
|
1
|
+
exports.id=184,exports.ids=[184],exports.modules={401:(a,b,c)=>{"use strict";c.d(b,{Mf:()=>k,QO:()=>i,UH:()=>g,Wf:()=>d,Wg:()=>l,ZU:()=>j,c1:()=>e,jf:()=>f,wS:()=>h});let d=6e4,e=12e4,f=150,g=15e3,h=800,i=3e5,j=3e4,k=300,l=3100},5514:(a,b,c)=>{"use strict";c.d(b,{Bz:()=>s,Nr:()=>w,Oe:()=>r,UQ:()=>p,b0:()=>v,hF:()=>j});var d=c(7367),e=c(9902),f=c(9439),g=c(9021),h=c(7810);let i=(0,e.join)((0,f.homedir)(),".cursor","projects");async function j(){let a=[];try{for(let b of(await (0,d.readdir)(i))){if(!/^[A-Z]/.test(b))continue;let c=(0,e.join)(i,b,"agent-transcripts");try{await (0,d.access)(c)}catch{continue}let f=function(a){let b=a.split("-"),c=e.sep+b[0];for(let a=1;a<b.length;a++){let d=c+e.sep+b[a];c=(0,g.existsSync)(d)&&(0,g.statSync)(d).isDirectory()?d:c+"-"+b[a]}return(0,g.existsSync)(c)?c:null}(b);if(!f)continue;let h=f.split(e.sep).pop()||f;a.push({name:h,path:f,key:b})}}catch{}return a.sort((a,b)=>a.name.localeCompare(b.name))}async function k(a){let b=(0,e.resolve)(a).replace(/^\//,"").replace(/\//g,"-"),c=(0,e.join)(i,b,"agent-transcripts");try{return await (0,d.access)(c),(0,h.l)("reader","transcripts dir found",c),c}catch{return(0,h.l)("reader","transcripts dir not found",c,"workspace",a,"key",b),null}}async function l(a){try{let b=await (0,d.readFile)(a,"utf-8"),c=[];for(let a of b.split("\n"))if(a.trim())try{c.push(JSON.parse(a))}catch{continue}return c}catch{return[]}}async function m(a){for(let b of(await l(a)))if("user"===b.role){let a=b.message,c=a?.content;return(c?.[0]?.text||"").replace(/<[^>]+>/g,"").trim().slice(0,120)}return""}async function n(a){try{return await (0,d.access)(a),!0}catch{return!1}}async function o(a,b){let c=await (0,d.stat)(a);if(c.isFile()&&b.endsWith(".jsonl"))return a;if(c.isDirectory()){let c=(0,e.join)(a,b+".jsonl");if(await n(c))return c;try{let b=(await (0,d.readdir)(a)).filter(a=>a.endsWith(".jsonl"));if(b.length>0)return(0,e.join)(a,b[0])}catch{}}return null}async function p(a){let b=await k(a);if(!b)return[];let c=[];try{for(let f of(await (0,d.readdir)(b))){let g=(0,e.join)(b,f),h=await o(g,f.replace(".jsonl",""));if(!h)continue;let i=await (0,d.stat)(h),j=f.replace(".jsonl",""),k=await m(h);k&&c.push({id:j,title:k.slice(0,60),workspace:a,preview:k,createdAt:i.birthtimeMs,updatedAt:i.mtimeMs})}}catch{}return c.sort((a,b)=>b.updatedAt-a.updatedAt)}function q(a){return a.replace(/<user_query>\n?/g,"").replace(/<\/user_query>\n?/g,"").replace(/<[^>]+>/g,"").trim()}async function r(a,b){let c=await k(a);if(!c)return(0,h.l)("reader","resolveJsonlPath: no transcripts dir",{workspace:a,sessionId:b}),null;let f=(0,e.resolve)(c),g=(0,e.resolve)(c,b);if(!g.startsWith(f+"/"))return(0,h.l)("reader","resolveJsonlPath: path traversal blocked",{entryPath:g,resolvedDir:f}),null;let i=(0,e.join)(c,b+".jsonl");if(await n(g)&&(await (0,d.stat)(g)).isDirectory()){let a=await o(g,b);return(0,h.l)("reader","resolveJsonlPath: directory entry",{sessionId:b,found:a??"null"}),a}return await n(i)?((0,h.l)("reader","resolveJsonlPath: flat file",{sessionId:b,path:i}),i):((0,h.l)("reader","resolveJsonlPath: not found",{sessionId:b,triedDir:g,triedFlat:i}),null)}async function s(a,b){let c=await r(a,b);if(!c)return 0;try{return(await (0,d.stat)(c)).mtimeMs}catch{return 0}}let t={Read:"read",Write:"write",Edit:"edit",StrReplace:"edit",Shell:"shell",Grep:"search",Glob:"search",List:"read",TodoWrite:"todo"};function u(a,b,c,d){let e=[];for(let f of a){let a,g,h;if("object"!=typeof f||null===f||"tool_use"!==f.type)continue;let i=f.name||"Tool",j=f.input||{},k=t[i]||"other";"TodoWrite"===i&&Array.isArray(j.todos)&&(a=j.todos.map(a=>({id:a.id,content:a.content,status:a.status?.toUpperCase().includes("COMPLETED")?"TODO_STATUS_COMPLETED":a.status?.toUpperCase().includes("PROGRESS")?"TODO_STATUS_IN_PROGRESS":"TODO_STATUS_PENDING"})));let l=a?.filter(a=>a.status.includes("COMPLETED")).length??0,m=a?.length??0;if("edit"===k&&"string"==typeof j.old_string&&"string"==typeof j.new_string)g=[...j.old_string.split("\n").map(a=>`-${a}`),...j.new_string.split("\n").map(a=>`+${a}`)].join("\n");else if("write"===k&&"string"==typeof j.contents){let a=j.contents.split("\n");g=a.map(a=>`+${a}`).join("\n"),a.length>30&&(g=a.slice(0,30).map(a=>`+${a}`).join("\n")+"\n+... ("+(a.length-30)+" more lines)")}"number"==typeof j.start_line&&(h=j.start_line),e.push({id:`${b}-tc-${c.n++}`,callId:`${b}-tc-${c.n}`,type:k,name:i,path:j.path||j.file_path,command:"shell"===k?j.command:"search"===k?j.pattern:void 0,status:"completed",diff:g,diffStartLine:h,result:"todo"===k&&m>0?`${m} items \xb7 ${l} done`:void 0,todos:a,timestamp:d+c.n})}return e}function v(a,b){let c=[],d=[],e={n:0},f=Date.now()-6e4;for(let g of a){let a=g.type;if("user"!==a&&"assistant"!==a)continue;let h=g.message?.content;if(!Array.isArray(h))continue;let i=[];for(let a of h)"text"===a.type&&a.text&&i.push(a.text);let j=i.join("");if("user"===a&&(j=q(j)),j.trim()){let d=c[c.length-1];d&&d.role===a?d.content+=j:c.push({id:`${b}-live-${e.n++}`,role:a,content:j,timestamp:f+e.n})}"assistant"===a&&d.push(...u(h,b,e,f))}return{messages:c,toolCalls:d}}async function w(a,b){let c=Date.now(),e=await r(a,b);if(!e)return(0,h.l)("reader","readSessionMessages: no jsonl path",{workspace:a,sessionId:b}),{messages:[],toolCalls:[],modifiedAt:0};let f=0;try{f=(await (0,d.stat)(e)).mtimeMs}catch(a){return(0,h.l)("reader","readSessionMessages: stat failed",{jsonlPath:e,error:String(a)}),{messages:[],toolCalls:[],modifiedAt:0}}let g=await l(e);(0,h.l)("reader","readSessionMessages: parsed jsonl",{sessionId:b,entries:g.length,jsonlPath:e});let i=[],j=[],k={n:0},m=f-6e4,n=0;for(let a of g){let c=a.role;if("user"!==c&&"assistant"!==c){n++;continue}let d=a.message?.content;if(!Array.isArray(d)){n++;continue}let e=[];for(let a of d)"text"===a.type&&a.text&&e.push(a.text);let f=e.join("");if("user"===c&&(f=q(f)),f.trim()){let a=i[i.length-1];a&&a.role===c?a.content+=f:i.push({id:`${b}-${k.n++}`,role:c,content:f,timestamp:m+k.n})}"assistant"===c&&j.push(...u(d,b,k,m))}return(0,h.l)("reader","readSessionMessages: done",{sessionId:b,messages:i.length,toolCalls:j.length,skippedEntries:n,modifiedAt:f,ms:Date.now()-c}),{messages:i,toolCalls:j,modifiedAt:f}}},6362:(a,b,c)=>{"use strict";c.d(b,{z:()=>e});var d=c(9439);function e(a=3100){let b=function(){let a=(0,d.networkInterfaces)();for(let b of Object.keys(a)){let c=a[b];if(c){for(let a of c)if("IPv4"===a.family&&!a.internal)return a.address}}return null}();return{lanIp:b||"localhost",port:a,url:b?`http://${b}:${a}`:`http://localhost:${a}`}}},6487:()=>{},6492:(a,b,c)=>{"use strict";c.d(b,{FF:()=>B,GW:()=>t,JZ:()=>u,ME:()=>y,Nk:()=>A,Nz:()=>x,Pn:()=>r,Q$:()=>v,ag:()=>C,ih:()=>s,jl:()=>w,zj:()=>z});var d=c(6293),e=c.n(d),f=c(9902),g=c(9439),h=c(9021);let i=(0,f.join)((0,g.homedir)(),".cursor-local-remote"),j=(0,f.join)(i,"sessions.db"),k=null,l=null;function m(){k&&(0,h.writeFileSync)(j,Buffer.from(k.export()))}async function n(){if(k)return k;let{Database:a}=await (!l&&(l=e()()),l);(0,h.mkdirSync)(i,{recursive:!0}),(k=(0,h.existsSync)(j)?new a((0,h.readFileSync)(j)):new a).run(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS sessions (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
title TEXT NOT NULL,
|
|
@@ -12,7 +12,7 @@ exports.id=184,exports.ids=[184],exports.modules={401:(a,b,c)=>{"use strict";c.d
|
|
|
12
12
|
key TEXT PRIMARY KEY,
|
|
13
13
|
value TEXT NOT NULL
|
|
14
14
|
)
|
|
15
|
-
`),m(),k}function o(a,b,c){let d=a.prepare(b);try{if(d.bind(c),d.step())return d.getAsObject();return}finally{d.free()}}function p(a,b,c=[]){let d=a.prepare(b);try{d.bind(c);let a=[];for(;d.step();)a.push(d.getAsObject());return a}finally{d.free()}}function q(a){return{id:a.id,title:a.title,workspace:a.workspace,preview:a.preview,createdAt:a.created_at,updatedAt:a.updated_at}}async function r(a){let b=o(await n(),"SELECT title FROM sessions WHERE id = ?",[a]);return b?b.title:null}async function s(a,b,c){let d=await n(),e=Date.now(),f=o(d,"SELECT * FROM sessions WHERE id = ?",[a]);if(f){let b=c?c.slice(0,120):f.preview;return d.run("UPDATE sessions SET updated_at = ?, preview = ? WHERE id = ?",[e,b,a]),m(),q({...f,updated_at:e,preview:b})}let g=c.slice(0,60)||"New session",h=c.slice(0,120);return d.run("INSERT INTO sessions (id, title, workspace, preview, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[a,g,b,h,e,e]),m(),{id:a,title:g,workspace:b,preview:h,createdAt:e,updatedAt:e}}async function t(a,b=!1){let c=await n(),d=b?" archived = 1":" archived = 0";return(a?p(c,"SELECT * FROM sessions WHERE workspace = ? AND"+d+" ORDER BY updated_at DESC",[a]):p(c,"SELECT * FROM sessions WHERE"+d+" ORDER BY updated_at DESC")).map(q)}async function u(a,b){let c=await n();if(!o(c,"SELECT id FROM sessions WHERE id = ?",[a])&&b){let a=Date.now();c.run("INSERT INTO sessions (id, title, workspace, preview, created_at, updated_at, archived) VALUES (?, ?, ?, ?, ?, ?, 1)",[b.id,b.title,b.workspace,b.preview,b.createdAt||a,b.updatedAt||a])}else c.run("UPDATE sessions SET archived = 1 WHERE id = ?",[a]);m()}async function v(a){(await n()).run("UPDATE sessions SET archived = 0 WHERE id = ?",[a]),m()}async function w(a,b){let c=await n();if(b){let a=Date.now();for(let d of b)o(c,"SELECT id FROM sessions WHERE id = ?",[d.id])||c.run("INSERT INTO sessions (id, title, workspace, preview, created_at, updated_at, archived) VALUES (?, ?, ?, ?, ?, ?, 0)",[d.id,d.title,d.workspace,d.preview,d.createdAt||a,d.updatedAt||a])}a?c.run("UPDATE sessions SET archived = 1 WHERE workspace = ? AND archived = 0",[a]):c.run("UPDATE sessions SET archived = 1 WHERE archived = 0"),m()}async function x(){return new Set(p(await n(),"SELECT id FROM sessions WHERE archived = 1").map(a=>a.id))}async function y(a){(await n()).run("DELETE FROM sessions WHERE id = ?",[a]),m()}async function z(a){let b=o(await n(),"SELECT value FROM config WHERE key = ?",[a]);return b?.value}async function A(a,b){(await n()).run("INSERT OR REPLACE INTO config (key, value) VALUES (?, ?)",[a,b]),m()}async function B(){return p(await n(),"SELECT DISTINCT workspace FROM sessions ORDER BY workspace").map(a=>a.workspace)}async function C(){let a=p(await n(),"SELECT key, value FROM config WHERE key NOT LIKE 'vapid%'"),b={};for(let c of a)b[c.key]=c.value;return b}},7093:(a,b,c)=>{"use strict";function d(a,b){return Response.json({error:a},{status:b})}function e(a){return d(a,400)}function f(a){return d(a,404)}function g(a="Internal server error"){return d(a,500)}function h(a,b){return a instanceof Error&&console.error(a),b}async function i(a){try{return await a.json()}catch{return e("Invalid JSON body")}}c.d(b,{Jo:()=>h,Y2:()=>i,ig:()=>g,li:()=>e,mX:()=>f})},8335:()=>{},9800:(a,b,c)=>{"use strict";c.d(b,{F2:()=>h,O9:()=>k,ae:()=>i});var d=c(6492),e=c(5514),f=c(6362),g=c(401);async function h(){return await (0,d.zj)("webhook_url")||""}async function i(a,b){let c;if(!a)return;c=a.includes("discord.com/api/webhooks")?function(a){let b="test"===a.event?5793266:5763719,c=[a.message];return a.url&&c.push(`
|
|
15
|
+
`),m(),k}function o(a,b,c){let d=a.prepare(b);try{if(d.bind(c),d.step())return d.getAsObject();return}finally{d.free()}}function p(a,b,c=[]){let d=a.prepare(b);try{d.bind(c);let a=[];for(;d.step();)a.push(d.getAsObject());return a}finally{d.free()}}function q(a){return{id:a.id,title:a.title,workspace:a.workspace,preview:a.preview,createdAt:a.created_at,updatedAt:a.updated_at}}async function r(a){let b=o(await n(),"SELECT title FROM sessions WHERE id = ?",[a]);return b?b.title:null}async function s(a,b,c){let d=await n(),e=Date.now(),f=o(d,"SELECT * FROM sessions WHERE id = ?",[a]);if(f){let b=c?c.slice(0,120):f.preview;return d.run("UPDATE sessions SET updated_at = ?, preview = ? WHERE id = ?",[e,b,a]),m(),q({...f,updated_at:e,preview:b})}let g=c.slice(0,60)||"New session",h=c.slice(0,120);return d.run("INSERT INTO sessions (id, title, workspace, preview, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[a,g,b,h,e,e]),m(),{id:a,title:g,workspace:b,preview:h,createdAt:e,updatedAt:e}}async function t(a,b=!1){let c=await n(),d=b?" archived = 1":" archived = 0";return(a?p(c,"SELECT * FROM sessions WHERE workspace = ? AND"+d+" ORDER BY updated_at DESC",[a]):p(c,"SELECT * FROM sessions WHERE"+d+" ORDER BY updated_at DESC")).map(q)}async function u(a,b){let c=await n();if(!o(c,"SELECT id FROM sessions WHERE id = ?",[a])&&b){let a=Date.now();c.run("INSERT INTO sessions (id, title, workspace, preview, created_at, updated_at, archived) VALUES (?, ?, ?, ?, ?, ?, 1)",[b.id,b.title,b.workspace,b.preview,b.createdAt||a,b.updatedAt||a])}else c.run("UPDATE sessions SET archived = 1 WHERE id = ?",[a]);m()}async function v(a){(await n()).run("UPDATE sessions SET archived = 0 WHERE id = ?",[a]),m()}async function w(a,b){let c=await n();if(b){let a=Date.now();for(let d of b)o(c,"SELECT id FROM sessions WHERE id = ?",[d.id])||c.run("INSERT INTO sessions (id, title, workspace, preview, created_at, updated_at, archived) VALUES (?, ?, ?, ?, ?, ?, 0)",[d.id,d.title,d.workspace,d.preview,d.createdAt||a,d.updatedAt||a])}a?c.run("UPDATE sessions SET archived = 1 WHERE workspace = ? AND archived = 0",[a]):c.run("UPDATE sessions SET archived = 1 WHERE archived = 0"),m()}async function x(){return new Set(p(await n(),"SELECT id FROM sessions WHERE archived = 1").map(a=>a.id))}async function y(a){(await n()).run("DELETE FROM sessions WHERE id = ?",[a]),m()}async function z(a){let b=o(await n(),"SELECT value FROM config WHERE key = ?",[a]);return b?.value}async function A(a,b){(await n()).run("INSERT OR REPLACE INTO config (key, value) VALUES (?, ?)",[a,b]),m()}async function B(){return p(await n(),"SELECT DISTINCT workspace FROM sessions ORDER BY workspace").map(a=>a.workspace)}async function C(){let a=p(await n(),"SELECT key, value FROM config WHERE key NOT LIKE 'vapid%'"),b={};for(let c of a)b[c.key]=c.value;return b}},7093:(a,b,c)=>{"use strict";function d(a,b){return Response.json({error:a},{status:b})}function e(a){return d(a,400)}function f(a){return d(a,404)}function g(a="Internal server error"){return d(a,500)}function h(a,b){return a instanceof Error&&console.error(a),b}async function i(a){try{return await a.json()}catch{return e("Invalid JSON body")}}c.d(b,{Jo:()=>h,Y2:()=>i,ig:()=>g,li:()=>e,mX:()=>f})},7810:(a,b,c)=>{"use strict";function d(a,...b){"1"===process.env.CLR_VERBOSE&&console.warn(`[verbose][${a}]`,...b)}c.d(b,{l:()=>d})},8335:()=>{},9800:(a,b,c)=>{"use strict";c.d(b,{F2:()=>h,O9:()=>k,ae:()=>i});var d=c(6492),e=c(5514),f=c(6362),g=c(401);async function h(){return await (0,d.zj)("webhook_url")||""}async function i(a,b){let c;if(!a)return;c=a.includes("discord.com/api/webhooks")?function(a){let b="test"===a.event?5793266:5763719,c=[a.message];return a.url&&c.push(`
|
|
16
16
|
[Open in CLR](${a.url})`),{embeds:[{title:a.title,description:c.join("\n"),color:b,timestamp:new Date(a.timestamp).toISOString()}]}}(b):a.includes("hooks.slack.com")?function(a){let b=a.url?`
|
|
17
17
|
<${a.url}|Open in CLR>`:"";return{text:`*${a.title}*
|
|
18
18
|
${a.message}${b}`}}(b):{...b};let d=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw Error(`Webhook returned ${d.status}`)}async function j(a,b){try{let{toolCalls:c}=await (0,e.Nr)(a,b),d=[...c].reverse().find(a=>"todo"===a.type&&a.todos?.length);return d?.todos??[]}catch{return[]}}async function k(a,b){try{let c=await h();if(!c)return;let e=b.split("/").filter(Boolean).pop()||b,k=await (0,d.Pn)(a),l=await j(b,a),m=[];k&&m.push(`"${k}"`),l.length>0&&m.push(l.map(a=>{var b;return`${(b=a.status).includes("COMPLETED")?"✅":b.includes("PROGRESS")?"⏳":"⬜"} ${a.content}`}).join("\n")),0===m.length&&m.push(`Session ${a.slice(0,8)} completed`),await i(c,{event:"agent_complete",title:`Done - ${e}`,message:m.join("\n\n"),url:function(a,b){try{let c=parseInt(process.env.PORT||String(g.Wg),10),d=(0,f.z)(c),e=process.env.AUTH_TOKEN,h=e?`${d.url}?token=${e}`:d.url,i=b?`#session=${a}&workspace=${encodeURIComponent(b)}`:`#session=${a}`;return`${h}${i}`}catch{return}}(a,b),sessionId:a,workspace:b,timestamp:Date.now()})}catch{}}}};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"wasm": [],
|
|
19
19
|
"assets": [],
|
|
20
20
|
"env": {
|
|
21
|
-
"__NEXT_BUILD_ID": "
|
|
21
|
+
"__NEXT_BUILD_ID": "kbKNDoW66g_F6hqOKd28R",
|
|
22
22
|
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "iXXMrFSSgs4vthm57YNSOxqx+PEci0BWRWSHfO7vXHw=",
|
|
23
23
|
"__NEXT_PREVIEW_MODE_ID": "1c5d6cae8d80ef41b72fb40230dd2603",
|
|
24
24
|
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "5077b6ff949d151981381dee9756424772b668d00a49f981f244a25ad2950e09",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--kbKNDoW66g_F6hqOKd28R--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/><link rel="stylesheet" href="/_next/static/css/c2cea7b9cd78f685.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-b7a7ce1923e86513.js"/><script src="/_next/static/chunks/4bd1b696-c023c6e3521b1417.js" async=""></script><script src="/_next/static/chunks/255-ebd51be49873d76c.js" async=""></script><script src="/_next/static/chunks/main-app-14a04931699eb2a2.js" async=""></script><script src="/_next/static/chunks/app/layout-a7c7dda1f998a1ce.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><meta name="theme-color" content="#0a0a0b"/><title>Cursor Local Remote</title><meta name="description" content="Control Cursor IDE from any device on your local network"/><link rel="manifest" href="/manifest.webmanifest"/><meta name="mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-title" content="CLR"/><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/><link rel="icon" href="/icon.png?c7e4facf85613587" type="image/png" sizes="32x32"/><link rel="apple-touch-icon" href="/apple-icon.png?4e1b4f0ebf73adf0" type="image/png" sizes="180x180"/><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="overscroll-none"><div hidden=""><!--$--><!--/$--></div><script>
|
|
2
2
|
if('serviceWorker' in navigator){
|
|
3
3
|
navigator.serviceWorker.getRegistrations().then(function(r){
|
|
4
4
|
r.forEach(function(reg){reg.unregister()})
|
|
@@ -8,4 +8,4 @@ if('serviceWorker' in navigator){
|
|
|
8
8
|
k.forEach(function(n){caches.delete(n)})
|
|
9
9
|
})
|
|
10
10
|
}
|
|
11
|
-
}</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-b7a7ce1923e86513.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[9766,[],\"\"]\n3:I[8924,[],\"\"]\n4:I[2317,[\"558\",\"static/chunks/app/layout-a7c7dda1f998a1ce.js\"],\"PwaInstall\"]\n5:I[4431,[],\"OutletBoundary\"]\n7:I[5278,[],\"AsyncMetadataOutlet\"]\n9:I[4431,[],\"ViewportBoundary\"]\nb:I[4431,[],\"MetadataBoundary\"]\nc:\"$Sreact.suspense\"\ne:I[7150,[],\"\"]\n:HL[\"/_next/static/css/
|
|
11
|
+
}</script><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-b7a7ce1923e86513.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[9766,[],\"\"]\n3:I[8924,[],\"\"]\n4:I[2317,[\"558\",\"static/chunks/app/layout-a7c7dda1f998a1ce.js\"],\"PwaInstall\"]\n5:I[4431,[],\"OutletBoundary\"]\n7:I[5278,[],\"AsyncMetadataOutlet\"]\n9:I[4431,[],\"ViewportBoundary\"]\nb:I[4431,[],\"MetadataBoundary\"]\nc:\"$Sreact.suspense\"\ne:I[7150,[],\"\"]\n:HL[\"/_next/static/css/c2cea7b9cd78f685.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"kbKNDoW66g_F6hqOKd28R\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/c2cea7b9cd78f685.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"overscroll-none\",\"children\":[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\nif('serviceWorker' in navigator){\\n navigator.serviceWorker.getRegistrations().then(function(r){\\n r.forEach(function(reg){reg.unregister()})\\n });\\n if(typeof caches!=='undefined'){\\n caches.keys().then(function(k){\\n k.forEach(function(n){caches.delete(n)})\\n })\\n }\\n}\"}}],[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],[\"$\",\"$L4\",null,{}]]}]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L5\",null,{\"children\":[\"$L6\",[\"$\",\"$L7\",null,{\"promise\":\"$@8\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L9\",null,{\"children\":\"$La\"}],null],[\"$\",\"$Lb\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$c\",null,{\"fallback\":null,\"children\":\"$Ld\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#0a0a0b\"}]]\n6:null\n"])</script><script>self.__next_f.push([1,"f:I[622,[],\"IconMark\"]\n"])</script><script>self.__next_f.push([1,"8:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"Cursor Local Remote\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Control Cursor IDE from any device on your local network\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"meta\",\"3\",{\"name\":\"mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"4\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"CLR\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"black-translucent\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/icon.png?c7e4facf85613587\",\"type\":\"image/png\",\"sizes\":\"32x32\"}],[\"$\",\"link\",\"7\",{\"rel\":\"apple-touch-icon\",\"href\":\"/apple-icon.png?4e1b4f0ebf73adf0\",\"type\":\"image/png\",\"sizes\":\"180x180\"}],[\"$\",\"$Lf\",\"8\",{}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"d:\"$8:metadata\"\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-b7a7ce1923e86513.js" defer=""></script><script src="/_next/static/chunks/framework-7c18bae94415732c.js" defer=""></script><script src="/_next/static/chunks/main-fef688ac5ef45212.js" defer=""></script><script src="/_next/static/chunks/pages/_app-79e662cab09aea11.js" defer=""></script><script src="/_next/static/chunks/pages/_error-89cd7530328c75d9.js" defer=""></script><script src="/_next/static/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-b7a7ce1923e86513.js" defer=""></script><script src="/_next/static/chunks/framework-7c18bae94415732c.js" defer=""></script><script src="/_next/static/chunks/main-fef688ac5ef45212.js" defer=""></script><script src="/_next/static/chunks/pages/_app-79e662cab09aea11.js" defer=""></script><script src="/_next/static/chunks/pages/_error-89cd7530328c75d9.js" defer=""></script><script src="/_next/static/kbKNDoW66g_F6hqOKd28R/_buildManifest.js" defer=""></script><script src="/_next/static/kbKNDoW66g_F6hqOKd28R/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"kbKNDoW66g_F6hqOKd28R","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[593],{169:(e,t,s)=>{"use strict";function r(e,t){let s=Error(t);return s.name="ApiError",s.status=e,s.body={error:t},s}s.d(t,{n:()=>a});let n=new Set([502,503,504]);async function l(e,t,s){let{timeoutMs:a=3e4,retries:o,...i}=t,c=new AbortController,d=setTimeout(()=>c.abort(),a);try{let a=await fetch(e,{...i,credentials:"same-origin",signal:c.signal});if(!a.ok){if(s>0&&n.has(a.status))return await new Promise(e=>setTimeout(e,500)),l(e,t,s-1);let o="HTTP ".concat(a.status);try{let e=await a.json();e.error&&(o=e.error)}catch(e){}throw r(a.status,o)}return a}catch(n){if(n instanceof Error&&"AbortError"===n.name){if(s>0)return await new Promise(e=>setTimeout(e,500)),l(e,t,s-1);throw r(0,"Request timed out")}throw n}finally{clearTimeout(d)}}function a(e){var t;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(e,s,null!=(t=s.retries)?t:2)}},2673:(e,t,s)=>{Promise.resolve().then(s.bind(s,4522)),Promise.resolve().then(s.bind(s,5932))},4522:(e,t,s)=>{"use strict";s.d(t,{ChatWorkspace:()=>eF});var r=s(5155),n=s(2115),l=s(154);function a(){let{trigger:e}=(0,l.Y)();return{tap:()=>e("light"),send:()=>e("success"),select:()=>e("selection"),warn:()=>e("warning"),error:()=>e("error")}}var o=s(169);function i(){var e;return"function"==typeof(null==(e=globalThis.crypto)?void 0:e.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function c(e){for(var t=arguments.length,s=Array(t>1?t-1:0),r=1;r<t;r++)s[r-1]=arguments[r];(function(){try{return"1"===localStorage.getItem("clr_verbose")}catch(e){return!1}})()&&console.log("[verbose][".concat(e,"]"),...s)}async function d(){try{let e=await (0,o.n)("/api/sessions/active");if(!e.ok)return[];return(await e.json()).sessions||[]}catch(e){return[]}}function x(){try{return"1"===localStorage.getItem("clr_sound_muted")}catch(e){return!1}}function u(e){if(e.current)return e.current;try{return e.current=new AudioContext,e.current}catch(e){return null}}function h(e,t,s,r,n){let l=e.createOscillator(),a=e.createGain();l.type="sine",l.frequency.value=t,a.gain.setValueAtTime(n,s),a.gain.exponentialRampToValueAtTime(.001,s+r),l.connect(a),a.connect(e.destination),l.start(s),l.stop(s+r)}s(5704);let m="Cursor Local Remote";function p(e){let t=document.querySelector("link[rel='icon']");t||((t=document.createElement("link")).rel="icon",document.head.appendChild(t)),t.href=e}function f(e){let t=Math.floor((Date.now()-e)/6e4);if(t<1)return"now";if(t<60)return"".concat(t,"m ago");let s=Math.floor(t/60);if(s<24)return"".concat(s,"h ago");let r=Math.floor(s/24);return"".concat(r,"d ago")}var g=s(6504),b=s(4514),v=s(5225);s(1226);let j={h1:e=>{let{children:t}=e;return(0,r.jsx)("h1",{className:"text-[17px] font-semibold mt-5 mb-2 text-text",children:t})},h2:e=>{let{children:t}=e;return(0,r.jsx)("h2",{className:"text-[15px] font-semibold mt-4 mb-1.5 text-text",children:t})},h3:e=>{let{children:t}=e;return(0,r.jsx)("h3",{className:"text-[14px] font-semibold mt-3 mb-1 text-text",children:t})},h4:e=>{let{children:t}=e;return(0,r.jsx)("h4",{className:"text-[13px] font-semibold mt-2.5 mb-1 text-text",children:t})},h5:e=>{let{children:t}=e;return(0,r.jsx)("h5",{className:"text-[13px] font-medium mt-2 mb-0.5 text-text-secondary",children:t})},h6:e=>{let{children:t}=e;return(0,r.jsx)("h6",{className:"text-[12px] font-medium mt-2 mb-0.5 text-text-secondary",children:t})},p:e=>{let{children:t}=e;return(0,r.jsx)("p",{className:"my-1 text-[13px] leading-[1.6]",children:t})},a:e=>{let{href:t,children:s}=e;return(0,r.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline underline-offset-2 decoration-text-muted/40 hover:decoration-accent transition-colors",children:s})},pre:e=>{let{children:t}=e;return(0,r.jsx)("pre",{className:"my-2 rounded-lg bg-[#0d0d0d] border border-border px-3.5 py-3 overflow-x-auto",children:t})},code:e=>{let{className:t,children:s}=e;return t?(0,r.jsx)("code",{className:"".concat(t," text-[12px] leading-[1.7] font-mono"),children:s}):(0,r.jsx)("code",{className:"px-1.5 py-0.5 rounded bg-[#1c1c1c] text-[#d4d4d4] text-[12px] font-mono",children:s})},ul:e=>{let{children:t}=e;return(0,r.jsx)("ul",{className:"my-1.5 space-y-0.5 list-disc pl-5",children:t})},ol:e=>{let{children:t}=e;return(0,r.jsx)("ol",{className:"my-1.5 space-y-0.5 list-decimal pl-5",children:t})},li:e=>{let{children:t}=e;return(0,r.jsx)("li",{className:"text-[13px] leading-[1.6]",children:t})},hr:()=>(0,r.jsx)("hr",{className:"my-3 border-border"}),blockquote:e=>{let{children:t}=e;return(0,r.jsx)("blockquote",{className:"my-2 pl-3 border-l-2 border-border text-text-secondary italic",children:t})},table:e=>{let{children:t}=e;return(0,r.jsx)("div",{className:"my-2 overflow-x-auto",children:(0,r.jsx)("table",{className:"min-w-full text-[13px] border-collapse",children:t})})},th:e=>{let{children:t}=e;return(0,r.jsx)("th",{className:"px-3 py-1.5 text-left font-semibold border-b border-border text-text",children:t})},td:e=>{let{children:t}=e;return(0,r.jsx)("td",{className:"px-3 py-1.5 border-b border-border/50",children:t})},img:e=>{let{src:t,alt:s}=e;return(0,r.jsx)("img",{src:t,alt:null!=s?s:"",className:"my-2 max-w-full rounded",loading:"lazy"})}},y=(0,n.memo)(function(e){let{content:t}=e;return(0,r.jsx)("div",{className:"text-text",children:(0,r.jsx)(g.oz,{remarkPlugins:[b.A],rehypePlugins:[v.A],components:j,children:t})})}),w={size:14,className:""};function k(e){let{size:t=10,className:s=""}=e;return(0,r.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})})}function N(e){let{size:t=w.size,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:[(0,r.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,r.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function C(e){let{size:t=12,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:[(0,r.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,r.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function S(e){let{size:t=w.size,className:s=w.className}=e;return(0,r.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})})}function E(e){let{size:t=w.size,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,r.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function L(e){let{size:t=20,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:[(0,r.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),(0,r.jsx)("line",{x1:"3",y1:"12",x2:"15",y2:"12"}),(0,r.jsx)("line",{x1:"3",y1:"18",x2:"18",y2:"18"})]})}function R(e){let{size:t=12,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:[(0,r.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,r.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}function T(e){let{size:t=w.size,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:[(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-6.22-8.56"}),(0,r.jsx)("polyline",{points:"21 3 21 9 15 9"})]})}function W(e){let{size:t=12,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:s,children:[(0,r.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,r.jsx)("polyline",{points:"19 12 12 19 5 12"})]})}function A(e){let{size:t=18,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),(0,r.jsx)("polyline",{points:"5 12 12 5 19 12"})]})}function z(e){let{size:t=18,className:s=w.className}=e;return(0,r.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",className:s,children:(0,r.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function F(e){let{className:t="w-3 h-3"}=e;return(0,r.jsx)("span",{className:"inline-block rounded-full border-2 border-text-muted border-t-transparent animate-spin ".concat(t)})}function I(e){let{size:t=10,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,r.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]})}function _(e){let{size:t=w.size,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}function D(e){let{size:t=12,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,r.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function M(e){let{size:t=14,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,r.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,r.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function P(e){let{size:t=12,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,r.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]})}function O(e){let{size:t=14,className:s=w.className}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("polyline",{points:"4 17 10 11 4 5"}),(0,r.jsx)("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function B(e){let{copied:t,onClick:s}=e;return(0,r.jsx)("button",{onClick:s,className:"absolute top-2 right-0 opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded text-text-muted hover:text-text-secondary","aria-label":t?"Copied":"Copy message",children:t?(0,r.jsx)(S,{}):(0,r.jsx)(E,{})})}let U=(0,n.memo)(function(e){let{message:t}=e,s="user"===t.role,[l,o]=(0,n.useState)(!1),i=a(),c=async()=>{try{await navigator.clipboard.writeText(t.content),i.tap(),o(!0),setTimeout(()=>o(!1),1500)}catch(e){}};return s?(0,r.jsxs)("div",{className:"py-3 group relative",children:[(0,r.jsx)("div",{className:"text-[13px] leading-[1.6] text-text whitespace-pre-wrap break-words bg-bg-surface rounded-lg px-3 py-2",children:t.content}),(0,r.jsx)(B,{copied:l,onClick:c})]}):(0,r.jsxs)("div",{className:"py-3 group relative",children:[(0,r.jsx)(y,{content:t.content}),(0,r.jsx)(B,{copied:l,onClick:c})]})}),H=new Set(["edit","write","shell","todo"]);function J(e){let{className:t}=e;return(0,r.jsxs)("svg",{className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,r.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function V(e){let{type:t}=e,s="w-3.5 h-3.5 shrink-0";switch(t){case"read":return(0,r.jsxs)("svg",{className:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,r.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,r.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]});case"write":case"edit":return(0,r.jsxs)("svg",{className:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,r.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"shell":return(0,r.jsxs)("svg",{className:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("polyline",{points:"4 17 10 11 4 5"}),(0,r.jsx)("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]});case"search":return(0,r.jsxs)("svg",{className:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,r.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]});case"todo":return(0,r.jsxs)("svg",{className:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M9 11l3 3L22 4"}),(0,r.jsx)("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});default:return(0,r.jsx)(J,{className:s})}}function q(e){let t=e.split("/");return t.length<=3?e:".../"+t.slice(-2).join("/")}function Q(e){let{status:t}=e,s="w-3 h-3 shrink-0 mt-0.5";return t.includes("COMPLETED")?(0,r.jsx)("svg",{className:"".concat(s," text-text-secondary"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polyline",{points:"20 6 9 17 4 12"})}):t.includes("IN_PROGRESS")?(0,r.jsx)(F,{className:s}):(0,r.jsx)("svg",{className:"".concat(s," text-text-muted"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,r.jsx)("circle",{cx:"12",cy:"12",r:"9"})})}function K(e){let{diff:t,startLine:s}=e,n=t.split("\n"),l=void 0!==s,a=null!=s?s:1,o=null!=s?s:1,i=[];if(l)for(let e of n)e.startsWith("-")?(i.push(String(a)),a++):(e.startsWith("+")?i.push(String(o)):(i.push(String(o)),a++),o++);let c=l?String(Math.max(a,o)).length:0;return(0,r.jsx)("pre",{className:"bg-[#0d0d0d] rounded px-2 py-1.5 text-[11px] whitespace-pre-wrap break-all max-h-[300px] overflow-y-auto",children:n.map((e,t)=>(0,r.jsxs)("span",{className:e.startsWith("+")?"text-green-400/70":e.startsWith("-")?"text-red-400/70":"text-text-muted",children:[l&&(0,r.jsx)("span",{className:"text-text-muted/40 select-none inline-block mr-2",style:{width:"".concat(c,"ch"),textAlign:"right"},children:i[t]}),e,t<n.length-1?"\n":""]},t))})}function G(e){switch(e.type){case"read":return"Reading";case"write":return"Writing";case"edit":return"Editing";case"shell":return"Running";case"search":return"Searching";case"todo":return"Updating";default:return e.name}}function Y(e){if("shell"===e.type&&e.command)return e.command;if("search"===e.type&&e.command){let t=e.path?" in ".concat(q(e.path)):"";return'"'.concat(e.command,'"').concat(t)}return"todo"===e.type?"todo list":e.path?q(e.path):e.name}function $(e){let t={};for(let s of e){let e=s.name||s.type;t[e]=(t[e]||0)+1}return Object.entries(t).map(e=>{let[t,s]=e;return"".concat(s," ").concat(t)}).join(", ")}function X(e){let{toolCalls:t}=e,[s,l]=(0,n.useState)(!1),o=a(),i=t.every(e=>"completed"===e.status);return(0,r.jsxs)("div",{className:"py-1.5",children:[(0,r.jsxs)("button",{onClick:()=>{o.tap(),l(e=>!e)},"aria-expanded":s,"aria-label":"Tool call group: ".concat($(t)),className:"flex items-center gap-2 text-[12px] text-text-muted hover:text-text-secondary transition-colors w-full text-left",children:[(0,r.jsx)("span",{className:i?"text-text-muted":"text-text-secondary",children:i?(0,r.jsx)(J,{className:"w-3.5 h-3.5 shrink-0"}):(0,r.jsx)(F,{className:"w-3.5 h-3.5"})}),(0,r.jsx)("span",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:(0,r.jsx)("span",{className:"font-mono text-text-muted truncate",children:$(t)})}),(0,r.jsx)(k,{className:"shrink-0 transition-transform ".concat(s?"rotate-180":"")})]}),s&&(0,r.jsx)("div",{className:"ml-5 pl-3 border-l-2 border-border",children:t.map(e=>(0,r.jsx)(Z,{toolCall:e},e.id))})]})}function Z(e){let{toolCall:t,defaultExpanded:s}=e,[l,o]=(0,n.useState)(null!=s&&s),i=a(),c="running"===t.status;return(0,r.jsxs)("div",{className:"py-1.5",children:[(0,r.jsxs)("button",{onClick:()=>{i.tap(),o(e=>!e)},"aria-expanded":l,"aria-label":"".concat(G(t)," ").concat(Y(t)),className:"flex items-center gap-2 text-[12px] text-text-muted hover:text-text-secondary transition-colors w-full text-left",children:[(0,r.jsx)("span",{className:c?"text-text-secondary":"text-text-muted",children:c?(0,r.jsx)(F,{className:"w-3.5 h-3.5"}):(0,r.jsx)(V,{type:t.type})}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5 min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"font-medium ".concat(c?"text-text-secondary":"text-text-muted"),children:G(t)}),(0,r.jsx)("span",{className:"font-mono truncate",children:Y(t)})]}),t.result&&(0,r.jsx)("span",{className:"text-text-muted text-[11px] shrink-0",children:t.result}),(0,r.jsx)(k,{className:"shrink-0 transition-transform ".concat(l?"rotate-180":"")})]}),l&&(0,r.jsxs)("div",{className:"mt-1.5 ml-5 pl-3 border-l-2 border-border text-[11px] font-mono text-text-muted py-1.5 space-y-1 overflow-x-auto",children:[(0,r.jsx)("p",{className:"text-text-secondary",children:t.name}),t.path&&(0,r.jsx)("p",{className:"break-all",children:t.path}),"shell"===t.type&&t.command&&(0,r.jsxs)("pre",{className:"bg-[#0d0d0d] rounded px-2 py-1.5 text-[11px] text-[#c9d1d9] whitespace-pre-wrap break-all",children:["$ ",t.command]}),"search"===t.type&&t.command&&(0,r.jsxs)("p",{children:["pattern: ",(0,r.jsx)("span",{className:"text-text-secondary",children:t.command})]}),t.todos&&t.todos.length>0&&(0,r.jsx)("ul",{className:"space-y-0.5",children:t.todos.map(e=>(0,r.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,r.jsx)(Q,{status:e.status}),(0,r.jsx)("span",{className:e.status.includes("COMPLETED")?"text-text-muted line-through":"text-text-secondary",children:e.content})]},e.id))}),t.diff&&(0,r.jsx)(K,{diff:t.diff,startLine:t.diffStartLine}),!t.diff&&!t.todos&&t.result&&(0,r.jsx)("p",{className:"text-text-secondary",children:t.result}),c&&(0,r.jsx)("p",{className:"text-text-muted animate-pulse",children:"running..."})]})]})}function ee(e){let{change:t}=e,[s,l]=(0,n.useState)(!1),o=a(),i=t.diffs.length>0;return(0,r.jsxs)("li",{children:[(0,r.jsxs)("button",{onClick:()=>{i&&(o.tap(),l(e=>!e))},className:"flex items-center gap-2 text-[11px] font-mono w-full text-left py-0.5 ".concat(i?"hover:text-text-secondary cursor-pointer":""),children:[(0,r.jsxs)("svg",{className:"w-3 h-3 shrink-0 text-text-muted",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,r.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),(0,r.jsx)("span",{className:"text-text-secondary truncate flex-1",title:t.path,children:t.shortPath}),(0,r.jsx)("span",{className:"text-text-muted shrink-0",children:t.edits>0&&t.writes>0?"".concat(t.edits,"e ").concat(t.writes,"w"):t.edits>0?"".concat(t.edits," edit").concat(t.edits>1?"s":""):"".concat(t.writes," write").concat(t.writes>1?"s":"")}),i&&(0,r.jsx)(k,{className:"shrink-0 transition-transform ".concat(s?"rotate-180":"")})]}),s&&t.diffs.map((e,t)=>(0,r.jsx)("div",{className:"mt-1 mb-2",children:(0,r.jsx)(K,{diff:e.diff,startLine:e.startLine})},t))]})}function et(e){let{toolCalls:t}=e,[s,l]=(0,n.useState)(!1),o=a(),i=function(e){let t=new Map;for(let s of e){if("write"!==s.type&&"edit"!==s.type||!s.path)continue;let e=t.get(s.path);e||(e={path:s.path,shortPath:q(s.path),writes:0,edits:0,diffs:[]},t.set(s.path,e)),"write"===s.type?e.writes++:e.edits++,s.diff&&e.diffs.push({diff:s.diff,startLine:s.diffStartLine})}return Array.from(t.values()).sort((e,t)=>t.writes+t.edits-(e.writes+e.edits))}(t);if(0===i.length)return null;let c=i.reduce((e,t)=>e+t.edits,0),d=i.reduce((e,t)=>e+t.writes,0),x=[];return c>0&&x.push("".concat(c," edit").concat(c>1?"s":"")),d>0&&x.push("".concat(d," write").concat(d>1?"s":"")),(0,r.jsxs)("div",{className:"py-2",children:[(0,r.jsxs)("button",{onClick:()=>{o.tap(),l(e=>!e)},"aria-expanded":s,"aria-label":"Changes summary: ".concat(i.length," files"),className:"flex items-center gap-2 text-[12px] text-text-muted hover:text-text-secondary transition-colors w-full text-left",children:[(0,r.jsxs)("svg",{className:"w-3.5 h-3.5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,r.jsx)("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),(0,r.jsx)("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),(0,r.jsxs)("span",{className:"font-medium text-text-secondary",children:[i.length," file",i.length>1?"s":""," changed"]}),(0,r.jsx)("span",{className:"text-text-muted text-[11px]",children:x.join(", ")}),(0,r.jsx)(k,{className:"shrink-0 transition-transform ml-auto ".concat(s?"rotate-180":"")})]}),s&&(0,r.jsx)("ul",{className:"mt-1.5 ml-5 pl-3 border-l-2 border-border space-y-0.5 py-1",children:i.map(e=>(0,r.jsx)(ee,{change:e},e.path))})]})}function es(e){let{toolCall:t,defaultOpen:s=!0}=e,[l,o]=(0,n.useState)(s),i=a(),c=t.todos;if(!c||0===c.length)return null;let d=c.filter(e=>e.status.includes("COMPLETED")).length,x=c.filter(e=>e.status.includes("IN_PROGRESS")).length;return(0,r.jsxs)("div",{className:"py-2",children:[(0,r.jsxs)("button",{onClick:()=>{i.tap(),o(e=>!e)},"aria-expanded":l,"aria-label":"Todo list: ".concat(d,"/").concat(c.length," done"),className:"flex items-center gap-2 text-[12px] text-text-muted hover:text-text-secondary transition-colors w-full text-left",children:[(0,r.jsxs)("svg",{className:"w-3.5 h-3.5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M9 11l3 3L22 4"}),(0,r.jsx)("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),(0,r.jsx)("span",{className:"font-medium text-text-secondary",children:"Todo"}),(0,r.jsxs)("span",{className:"text-text-muted text-[11px]",children:[d,"/",c.length," done",x>0?" \xb7 ".concat(x," active"):""]}),(0,r.jsx)(k,{className:"shrink-0 transition-transform ml-auto ".concat(l?"rotate-180":"")})]}),l&&(0,r.jsx)("ul",{className:"mt-1.5 ml-5 pl-3 border-l-2 border-border space-y-0.5 py-1",children:c.map(e=>(0,r.jsxs)("li",{className:"flex items-start gap-1.5 text-[11px] font-mono",children:[(0,r.jsx)(Q,{status:e.status}),(0,r.jsx)("span",{className:e.status.includes("COMPLETED")?"text-text-muted line-through":"text-text-secondary",children:e.content})]},e.id))})]})}function er(e){let{sessions:t,onSelect:s}=e,n=a();return 0===t.length?null:(0,r.jsxs)("div",{className:"mt-5 w-full max-w-xs",children:[(0,r.jsx)("p",{className:"text-text-muted text-[11px] font-medium mb-2 uppercase tracking-wider",children:"Recent sessions"}),(0,r.jsx)("div",{className:"space-y-1",children:t.map(e=>(0,r.jsxs)("button",{onClick:()=>{n.tap(),s(e.id,e.workspace)},className:"w-full text-left px-3 py-2 rounded-lg bg-bg-surface hover:bg-bg-hover border border-border/50 transition-colors group",children:[(0,r.jsx)("p",{className:"text-[12px] text-text-secondary group-hover:text-text truncate",children:e.title}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5",children:f(e.updatedAt)})]},e.id))})]})}function en(e){let{msg:t,onForceSend:s,onEdit:l,onDelete:o}=e,[i,c]=(0,n.useState)(!1),[d,x]=(0,n.useState)(t.content),u=a(),h=()=>{let e=d.trim();e&&e!==t.content&&l(e),c(!1)},m=()=>{x(t.content),c(!1)};return(0,r.jsxs)("div",{className:"py-2.5 border border-dashed border-text-muted/25 rounded-lg px-3 bg-bg-surface/50",children:[(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:"shrink-0 mt-0.5 text-text-muted/50",children:(0,r.jsx)(_,{})}),(0,r.jsx)("div",{className:"flex-1 min-w-0",children:i?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("textarea",{autoFocus:!0,"aria-label":"Edit queued message",value:d,onChange:e=>x(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),h()),"Escape"===e.key&&m()},rows:2,className:"w-full resize-none bg-bg px-2 py-1.5 text-[13px] text-text rounded border border-border focus:outline-none focus:border-text-muted/40"}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{onClick:h,className:"px-2 py-0.5 text-[10px] font-medium rounded bg-bg-active text-text hover:bg-bg-hover transition-colors",children:"Save"}),(0,r.jsx)("button",{onClick:m,className:"px-2 py-0.5 text-[10px] font-medium rounded text-text-muted hover:text-text-secondary transition-colors",children:"Cancel"})]})]}):(0,r.jsx)("p",{className:"text-[13px] text-text-secondary whitespace-pre-wrap break-words",children:t.content})})]}),!i&&(0,r.jsxs)("div",{className:"flex items-center gap-1 mt-1.5 ml-5",children:[(0,r.jsx)("span",{className:"text-[10px] text-text-muted/50 mr-1",children:"Queued"}),(0,r.jsx)("button",{onClick:()=>{u.send(),s()},className:"px-2 py-0.5 text-[10px] font-medium rounded bg-bg-active text-text-secondary hover:text-text transition-colors",title:"Stop current and send this now",children:"Send now"}),(0,r.jsx)("button",{onClick:()=>{u.tap(),x(t.content),c(!0)},className:"px-2 py-0.5 text-[10px] font-medium rounded text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:"Edit"}),(0,r.jsx)("button",{onClick:()=>{u.warn(),o()},className:"px-2 py-0.5 text-[10px] font-medium rounded text-text-muted hover:text-error/80 hover:bg-error/5 transition-colors",children:"Delete"})]})]})}function el(e){var t,s,l;let o,{messages:i,toolCalls:c,isStreaming:d,isLoadingHistory:x,isWatching:u,recentSessions:h=[],onSelectSession:m,onRetry:p,queuedMessages:f=[],onForceSend:g,onEditQueued:b,onDeleteQueued:v}=e,j=a(),y=(0,n.useRef)(null),w=(0,n.useRef)(null),[k,N]=(0,n.useState)(!0),C=(0,n.useRef)(!1),S=(0,n.useCallback)(()=>{var e;null==(e=w.current)||e.scrollIntoView({behavior:"smooth"}),N(!0)},[]),E=(0,n.useCallback)(()=>{if(C.current)return;let e=y.current;e&&N(e.scrollHeight-e.scrollTop-e.clientHeight<60)},[]),L=i[i.length-1],R=d&&(null==L?void 0:L.role)==="user",T=(0,n.useRef)(null),A=(0,n.useRef)(!1);(0,n.useEffect)(()=>{var e;if(k||R){if(T.current){A.current=!0;return}C.current=!0,null==(e=w.current)||e.scrollIntoView({behavior:"smooth"}),T.current=setTimeout(()=>{if(T.current=null,C.current=!1,A.current){var e;A.current=!1,null==(e=w.current)||e.scrollIntoView({behavior:"smooth"})}},200)}},[i,c,k,R]);let z=[...i.map(e=>({kind:"message",timestamp:e.timestamp,message:e})),...c.map(e=>({kind:"toolcall",timestamp:e.timestamp,toolCall:e}))].sort((e,t)=>e.timestamp-t.timestamp),_=[],D=[],M=()=>{0!==D.length&&(1===D.length?_.push({kind:"toolcall",timestamp:D[0].timestamp,toolCall:D[0]}):_.push({kind:"toolgroup",timestamp:D[0].timestamp,toolCalls:[...D]}),D=[])};for(let e of z)"toolcall"===e.kind&&e.toolCall&&(l=e.toolCall,!H.has(l.type))?D.push(e.toolCall):(M(),_.push(e));if(M(),x)return(0,r.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[13px]",children:[(0,r.jsx)(F,{className:"w-3.5 h-3.5"}),"Loading session..."]})});if(0===_.length)return(0,r.jsx)("div",{className:"flex-1 flex items-center justify-center px-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center max-w-sm",children:[(0,r.jsx)("p",{className:"text-text-secondary text-[13px] font-medium mb-1",children:"Cursor Remote"}),(0,r.jsx)("p",{className:"text-text-muted text-[12px] leading-relaxed",children:"Send a message to start an agent session."}),m&&(0,r.jsx)(er,{sessions:h,onSelect:m})]})});let P=c.some(e=>"running"===e.status),O=_[_.length-1],B=(null==O?void 0:O.kind)==="message"&&(null==(t=O.message)?void 0:t.role)==="user",J=d&&!P&&B;for(let e=_.length-1;e>=0;e--){let t=_[e];if("toolcall"===t.kind&&(null==(s=t.toolCall)?void 0:s.type)==="todo"){o=t.toolCall.id;break}}let V=i[i.length-1],q=!d&&(null==V?void 0:V.role)==="user"&&p;return(0,r.jsxs)("div",{className:"flex-1 overflow-hidden relative",children:[(0,r.jsx)("div",{ref:y,onScroll:E,className:"h-full overflow-y-auto",children:(0,r.jsxs)("div",{className:"px-4 max-w-3xl mx-auto w-full",children:[(0,r.jsx)("div",{className:"divide-y divide-border/50",children:_.map((e,t)=>"message"===e.kind&&e.message?(0,r.jsx)(U,{message:e.message},e.message.id):"toolcall"===e.kind&&e.toolCall?"todo"===e.toolCall.type?(0,r.jsx)(es,{toolCall:e.toolCall,defaultOpen:e.toolCall.id===o},e.toolCall.id):(0,r.jsx)(Z,{toolCall:e.toolCall},e.toolCall.id):"toolgroup"===e.kind&&e.toolCalls?(0,r.jsx)(X,{toolCalls:e.toolCalls},"group-".concat(t)):null)}),!d&&_.length>0&&c.length>0&&(0,r.jsx)(et,{toolCalls:c}),J&&(0,r.jsxs)("div",{className:"py-3 flex items-center gap-2 text-text-muted text-[12px]",children:[(0,r.jsx)(F,{}),"Thinking..."]}),u&&!d&&_.length>0&&(0,r.jsxs)("div",{className:"py-3 flex items-center gap-2 text-text-muted text-[11px]",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"Watching for updates..."]}),q&&(0,r.jsx)("div",{className:"py-1",children:(0,r.jsxs)("button",{onClick:()=>{j.tap(),null==p||p()},className:"flex items-center gap-1 text-[10px] text-text-muted/60 hover:text-text-muted transition-colors","aria-label":"Retry last message",children:[(0,r.jsx)(I,{}),"Retry last message"]})}),f.length>0&&(0,r.jsx)("div",{className:"space-y-2 py-2",children:f.map(e=>(0,r.jsx)(en,{msg:e,onForceSend:()=>null==g?void 0:g(e.id),onEdit:t=>null==b?void 0:b(e.id,t),onDelete:()=>null==v?void 0:v(e.id)},e.id))}),(0,r.jsx)("div",{ref:w,className:"h-4"})]})}),!k&&_.length>0&&(0,r.jsxs)("button",{onClick:S,"aria-label":"Scroll to bottom",className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-bg-elevated border border-border text-text-muted hover:text-text-secondary text-[11px] shadow-lg transition-colors",children:[(0,r.jsx)(W,{}),"Scroll to bottom"]})]})}let ea=[{id:"agent",label:"Agent"},{id:"ask",label:"Ask"},{id:"plan",label:"Plan"}];function eo(e){var t;let{onSend:s,onStop:l,isStreaming:i,selectedModel:c,selectedMode:d,onModelChange:x,onModeChange:u}=e,[h,m]=(0,n.useState)(""),[p,f]=(0,n.useState)(!1),[g,b]=(0,n.useState)([]),[v,j]=(0,n.useState)(!0),[y,w]=(0,n.useState)([]),[S,E]=(0,n.useState)(!1),[L,R]=(0,n.useState)(!1),T=(0,n.useRef)(null),W=a();(0,n.useEffect)(()=>{let e=!1;return(0,o.n)("/api/models").then(e=>e.json()).then(t=>{var s;!e&&(null==(s=t.models)?void 0:s.length)>0&&b(t.models)}).catch(e=>console.error("[models] Failed to fetch:",e)).finally(()=>{e||j(!1)}),()=>{e=!0}},[]);let I=(0,n.useCallback)(e=>{let t=e.filter(e=>e.type.startsWith("image/"));if(0===t.length)return;let s=t.map(e=>({file:e,preview:URL.createObjectURL(e)}));w(e=>[...e,...s])},[]),_=(0,n.useCallback)(e=>{w(t=>(URL.revokeObjectURL(t[e].preview),t.filter((t,s)=>s!==e)))},[]),D=(0,n.useCallback)(async e=>{let t=new FormData;for(let s of e)t.append("file",s.file);let s=await (0,o.n)("/api/upload",{method:"POST",body:t});return s.ok&&(await s.json()).paths||[]},[]),M=(0,n.useCallback)(async()=>{let e=h.trim();if(!e&&0===y.length)return;W.send();let t=e;if(y.length>0){E(!0);try{let e=await D(y);if(e.length>0){let s=e.map(e=>"[Attached image: ".concat(e,"]")).join("\n");t=t?t+"\n\n"+s:s}}catch(e){console.error("[upload] Failed to upload images")}finally{E(!1)}for(let e of y)URL.revokeObjectURL(e.preview);w([])}t&&s(t),m(""),T.current&&(T.current.style.height="auto")},[h,y,s,W,D]),P=(0,n.useCallback)(()=>{W.tap(),null==l||l()},[l,W]),O=(0,n.useCallback)(e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);t.length>0&&(e.preventDefault(),I(t))},[I]),B=(0,n.useCallback)(e=>{e.preventDefault(),R(!1);let t=Array.from(e.dataTransfer.files).filter(e=>e.type.startsWith("image/"));t.length>0&&I(t)},[I]),U=(0,n.useCallback)(e=>{e.preventDefault(),R(!0)},[]),H=(0,n.useCallback)(()=>{R(!1)},[]),J=(null==(t=g.find(e=>e.id===c))?void 0:t.label)||c,V=g.find(e=>"auto"===e.id),q=g.filter(e=>"auto"!==e.id);return(0,r.jsx)("div",{className:"shrink-0 bg-bg px-4 py-3 safe-bottom",children:(0,r.jsx)("div",{className:"max-w-3xl mx-auto",children:(0,r.jsxs)("div",{className:"relative bg-bg-surface border rounded-xl focus-within:border-text-muted/40 transition-colors ".concat(L?"border-accent/60 bg-accent/5":"border-border"),onDrop:B,onDragOver:U,onDragLeave:H,children:[(0,r.jsx)("textarea",{ref:T,value:h,onChange:e=>{m(e.target.value);let t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,160)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),M())},onPaste:O,placeholder:i?"Type to queue a message...":"Ask Cursor anything...","aria-label":"Message input",rows:1,className:"w-full resize-none bg-transparent px-3.5 pt-2.5 pb-1 pr-10 text-[13px] text-text placeholder:text-text-muted focus:outline-none"}),y.length>0&&(0,r.jsx)("div",{className:"flex gap-2 px-3 pb-1.5 overflow-x-auto",children:y.map((e,t)=>(0,r.jsxs)("div",{className:"relative shrink-0 w-14 h-14 rounded-md overflow-hidden border border-border group",children:[(0,r.jsx)("img",{src:e.preview,alt:"",className:"w-full h-full object-cover"}),(0,r.jsx)("button",{onClick:()=>_(t),className:"absolute top-0 right-0 p-0.5 bg-black/70 rounded-bl text-white opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Remove image",children:(0,r.jsx)(N,{size:10})})]},e.preview))}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",role:"radiogroup","aria-label":"Agent mode",children:[ea.map(e=>(0,r.jsx)("button",{role:"radio","aria-checked":d===e.id,onClick:()=>{W.select(),u(e.id)},className:"px-3 py-1.5 rounded text-[12px] font-medium transition-colors ".concat(d===e.id?"bg-bg-active text-text":"text-text-muted hover:text-text-secondary hover:bg-bg-hover"),children:e.label},e.id)),(0,r.jsx)("span",{className:"hidden sm:inline text-[10px] text-text-muted/50 ml-2 select-none",children:"Enter ↵ send \xb7 Shift+Enter newline"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{onClick:()=>{W.tap(),f(!p)},"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"Select model",className:"flex items-center gap-1 px-3 py-1.5 rounded text-[12px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:[v?(0,r.jsx)(F,{className:"w-2.5 h-2.5"}):(0,r.jsx)("span",{className:"truncate max-w-[80px] sm:max-w-[150px]",children:J}),(0,r.jsx)(k,{})]}),p&&g.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>f(!1)}),(0,r.jsxs)("div",{role:"listbox","aria-label":"Models",className:"absolute bottom-full right-0 mb-1 z-50 w-56 bg-bg-elevated border border-border rounded-lg shadow-xl py-1 max-h-80 overflow-y-auto",children:[V&&(0,r.jsx)(ei,{model:V,selected:c===V.id,onSelect:()=>{x(V.id),f(!1)}},V.id),q.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"h-px bg-border mx-2 my-1"}),q.map(e=>(0,r.jsx)(ei,{model:e,selected:c===e.id,onSelect:()=>{x(e.id),f(!1)}},e.id))]})]})]})]}),i&&(0,r.jsx)("button",{onClick:P,className:"p-2 rounded-md text-text-muted hover:text-text transition-colors","aria-label":"Stop streaming",children:(0,r.jsx)(z,{})}),(0,r.jsx)("button",{onClick:M,disabled:!h.trim()&&0===y.length||S,className:"p-2 rounded-md text-text-muted hover:text-text disabled:opacity-20 disabled:cursor-not-allowed transition-colors","aria-label":S?"Uploading...":i?"Queue message":"Send message",children:S?(0,r.jsx)(F,{className:"w-4 h-4"}):i?(0,r.jsx)(C,{size:18}):(0,r.jsx)(A,{})})]})]})]})})})}function ei(e){let{model:t,selected:s,onSelect:n}=e,l=a();return(0,r.jsxs)("button",{role:"option","aria-selected":s,onClick:()=>{l.select(),n()},className:"w-full text-left px-3 py-1.5 text-[12px] flex items-center justify-between gap-2 transition-colors ".concat(s?"text-text bg-bg-active":"text-text-secondary hover:bg-bg-hover hover:text-text"),children:[(0,r.jsx)("span",{className:"truncate",children:t.label}),(0,r.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[t.isDefault&&(0,r.jsx)("span",{className:"text-[9px] px-1 py-px rounded bg-bg-hover text-text-secondary font-medium",children:"default"}),t.isCurrent&&(0,r.jsx)("span",{className:"text-[9px] px-1 py-px rounded bg-success/15 text-success font-medium",children:"current"})]})]})}function ec(e){let{diff:t}=e;if(!t)return(0,r.jsx)("p",{className:"text-text-muted text-[11px] px-3 py-2",children:"No diff available"});let s=t.split("\n");return(0,r.jsx)("div",{className:"overflow-x-auto text-[11px] font-mono leading-[1.6]",children:s.map((e,t)=>{let s="text-text-muted px-3";return e.startsWith("+")&&!e.startsWith("+++")?s="text-success bg-success/8 px-3":e.startsWith("-")&&!e.startsWith("---")?s="text-error bg-error/8 px-3":e.startsWith("@@")?s="text-info bg-info/8 px-3":(e.startsWith("diff ")||e.startsWith("index "))&&(s="text-text-muted/50 px-3"),(0,r.jsx)("div",{className:s,children:(0,r.jsx)("span",{className:"whitespace-pre",children:e})},t)})})}function ed(e,t,s){return(0,o.n)("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,workspace:t,...s})})}function ex(e){var t;let{open:s,onClose:l,workspace:i}=e,[c,d]=(0,n.useState)(null),[x,u]=(0,n.useState)(!1),[h,m]=(0,n.useState)(""),[p,f]=(0,n.useState)(new Set),[g,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),[y,w]=(0,n.useState)(!1),[C,E]=(0,n.useState)(!1),[L,R]=(0,n.useState)(!1),[W,A]=(0,n.useState)(!1),[z,I]=(0,n.useState)(!1),[_,D]=(0,n.useState)(!1),[M,P]=(0,n.useState)(null),[O,B]=(0,n.useState)(null),[U,H]=(0,n.useState)({}),[J,V]=(0,n.useState)(null),[q,Q]=(0,n.useState)(!1),[K,G]=(0,n.useState)(!1),[Y,$]=(0,n.useState)(!1),[X,Z]=(0,n.useState)(null),[ee,et]=(0,n.useState)(!1),[es,er]=(0,n.useState)(""),[en,el]=(0,n.useState)(!1),ea=a(),eo=i?"&workspace=".concat(encodeURIComponent(i)):"",ei=(0,n.useCallback)(()=>{u(!0),P(null),(0,o.n)("/api/git?detail=status".concat(eo)).then(e=>e.json()).then(e=>{var t;d(e),f(new Set((null!=(t=e.files)?t:[]).map(e=>e.file)))}).catch(()=>P("Failed to load git status")).finally(()=>u(!1))},[eo]),ec=(0,n.useCallback)(()=>{(0,o.n)("/api/git?detail=branches".concat(eo)).then(e=>e.json()).then(e=>Z(e)).catch(()=>{})},[eo]);(0,n.useEffect)(()=>{s&&(R(!1),A(!1),P(null),B(null),H({}),G(!1),$(!1),er(""),ei())},[s,ei]);let ex=(0,n.useCallback)(e=>{if(O===e)return void B(null);B(e),void 0===U[e]&&(V(e),(0,o.n)("/api/git?detail=diff&file=".concat(encodeURIComponent(e)).concat(eo)).then(e=>e.json()).then(t=>H(s=>({...s,[e]:t.diff||""}))).catch(()=>H(t=>({...t,[e]:"Failed to load diff"}))).finally(()=>V(null)))},[O,U,eo]),eh=(0,n.useCallback)((e,t)=>{t.stopPropagation(),ea.select(),f(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),em=(0,n.useCallback)(()=>{var e;ea.tap();let t=null!=(e=null==c?void 0:c.files)?e:[];p.size===t.length?f(new Set):f(new Set(t.map(e=>e.file)))},[c,p]),ep=(0,n.useCallback)(async()=>{if(!K)return void G(!0);G(!1),Q(!0),P(null);try{let e=await ed("discard",i,{files:Array.from(p)});if(!e.ok){let t=await e.json();throw Error(t.error||"Discard failed")}H({}),B(null),ea.warn(),ei()}catch(e){P(e instanceof Error?e.message:"Discard failed"),ea.error()}finally{Q(!1)}},[K,i,p,ei,ea]),ef=(0,n.useCallback)(async()=>{if(h.trim()&&0!==p.size){b(!0),P(null);try{let e=await ed("commit",i,{message:h,files:Array.from(p)});if(!e.ok){let t=await e.json();throw Error(t.error||"Commit failed")}m(""),R(!0),setTimeout(()=>R(!1),2e3),H({}),B(null),ea.send(),ei()}catch(e){P(e instanceof Error?e.message:"Commit failed"),ea.error()}finally{b(!1)}}},[h,i,ei,p,ea]),eg=(0,n.useCallback)(async()=>{j(!0),P(null);try{let e=await ed("push",i);if(!e.ok){let t=await e.json();throw Error(t.error||"Push failed")}A(!0),setTimeout(()=>A(!1),2e3),ea.send(),ei()}catch(e){P(e instanceof Error?e.message:"Push failed"),ea.error()}finally{j(!1)}},[i,ei,ea]),eb=(0,n.useCallback)(async()=>{w(!0),P(null);try{let e=await ed("fetch",i);if(!e.ok){let t=await e.json();throw Error(t.error||"Fetch failed")}I(!0),setTimeout(()=>I(!1),2e3),ea.tap(),ei()}catch(e){P(e instanceof Error?e.message:"Fetch failed"),ea.error()}finally{w(!1)}},[i,ei,ea]),ev=(0,n.useCallback)(async()=>{E(!0),P(null);try{let e=await ed("pull",i);if(!e.ok){let t=await e.json();throw Error(t.error||"Pull failed")}D(!0),setTimeout(()=>D(!1),2e3),H({}),B(null),ea.tap(),ei()}catch(e){P(e instanceof Error?e.message:"Pull failed"),ea.error()}finally{E(!1)}},[i,ei,ea]),ej=(0,n.useCallback)(async e=>{et(!0),P(null);try{let t=await ed("checkout",i,{branch:e});if(!t.ok){let e=await t.json();throw Error(e.error||"Checkout failed")}$(!1),H({}),B(null),ea.tap(),ei()}catch(e){P(e instanceof Error?e.message:"Checkout failed"),ea.error()}finally{et(!1)}},[i,ei,ea]),ey=(0,n.useCallback)(async()=>{let e=es.trim();if(e){el(!0),P(null);try{let t=await ed("create_branch",i,{branch:e});if(!t.ok){let e=await t.json();throw Error(e.error||"Create branch failed")}er(""),$(!1),ea.send(),ei()}catch(e){P(e instanceof Error?e.message:"Create branch failed"),ea.error()}finally{el(!1)}}},[es,i,ei,ea]);if(!s)return null;let ew=null!=(t=null==c?void 0:c.files)?t:[],ek=ew.length>0,eN=p.size,eC=ek&&eN===ew.length;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/60","aria-hidden":"true",onClick:l}),(0,r.jsxs)("div",{className:"fixed inset-0 z-50 bg-bg-elevated flex flex-col sm:inset-auto sm:top-0 sm:right-0 sm:h-full sm:w-[380px] sm:border-l sm:border-border",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between h-11 px-3 border-b border-border shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"text-[13px] font-medium text-text-secondary shrink-0",children:"Git"}),(null==c?void 0:c.branch)&&(0,r.jsxs)("button",{onClick:()=>{$(e=>!e),X||ec()},className:"flex items-center gap-1 text-[11px] text-text-muted font-mono hover:text-text-secondary transition-colors min-w-0",children:[(0,r.jsx)("span",{className:"truncate max-w-[120px]",children:c.branch}),(0,r.jsx)(k,{size:8})]}),c&&c.ahead>0&&(0,r.jsxs)("span",{className:"text-[10px] text-info shrink-0",children:["↑",c.ahead]}),c&&c.behind>0&&(0,r.jsxs)("span",{className:"text-[10px] text-warning shrink-0",children:["↓",c.behind]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:()=>{ei(),H({})},disabled:x,"aria-label":"Refresh",className:"p-1.5 rounded-md hover:bg-bg-hover text-text-muted hover:text-text-secondary transition-colors disabled:opacity-40",children:(0,r.jsx)(T,{size:13,className:x?"animate-spin":""})}),(0,r.jsx)("button",{onClick:l,"aria-label":"Close",className:"p-1.5 rounded-md hover:bg-bg-hover text-text-muted hover:text-text-secondary transition-colors",children:(0,r.jsx)(N,{size:13})})]})]}),Y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>$(!1)}),(0,r.jsxs)("div",{className:"relative z-50 mx-3 mt-2 bg-bg-elevated border border-border rounded-lg shadow-xl max-h-[280px] flex flex-col",children:[ee&&(0,r.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,r.jsx)(F,{})}),!ee&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"p-2 border-b border-border flex gap-1.5",children:[(0,r.jsx)("input",{value:es,onChange:e=>er(e.target.value),placeholder:"New branch name...",className:"flex-1 min-w-0 rounded border border-border bg-bg-surface px-2 py-1 text-[11px] text-text placeholder:text-text-muted/50 focus:outline-none focus:border-text-muted/40",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ey())}}),(0,r.jsx)("button",{onClick:ey,disabled:!es.trim()||en,className:"shrink-0 px-2 py-1 rounded text-[10px] font-medium bg-bg-surface border border-border text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors disabled:opacity-40",children:en?(0,r.jsx)(F,{className:"w-2.5 h-2.5"}):"Create"})]}),(0,r.jsxs)("div",{className:"overflow-y-auto flex-1 py-1",children:[null==X?void 0:X.local.map(e=>(0,r.jsxs)("button",{onClick:()=>e!==X.current&&ej(e),className:"w-full text-left px-3 py-1.5 text-[11px] font-mono transition-colors ".concat(e===X.current?"text-text bg-bg-active":"text-text-secondary hover:bg-bg-hover hover:text-text"),children:[e,e===X.current&&(0,r.jsx)("span",{className:"text-text-muted ml-1",children:"(current)"})]},e)),X&&X.remoteOnly.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"h-px bg-border mx-2 my-1"}),(0,r.jsx)("div",{className:"px-3 py-1",children:(0,r.jsx)("span",{className:"text-[9px] font-medium uppercase tracking-wider text-text-muted",children:"Remote"})}),X.remoteOnly.map(e=>(0,r.jsx)("button",{onClick:()=>ej(e),className:"w-full text-left px-3 py-1.5 text-[11px] font-mono text-text-muted hover:bg-bg-hover hover:text-text-secondary transition-colors",children:e},e))]})]})]})]})]}),M&&(0,r.jsx)("div",{className:"mx-3 mt-2 px-2.5 py-2 rounded-md bg-error/10 text-error text-[11px] break-words",children:M}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:x&&!c?(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(F,{})}):(null==c?void 0:c.branch)?ek?(0,r.jsxs)("div",{className:"py-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,r.jsx)("button",{onClick:em,className:"shrink-0 w-4 text-center","aria-label":"Toggle all",children:(0,r.jsx)("span",{className:"text-[11px] font-bold transition-colors ".concat(eC?"text-text-secondary":"text-text-muted/40"),children:eC?"✓":"–"})}),(0,r.jsxs)("span",{className:"text-[10px] font-medium uppercase tracking-wider text-text-muted flex-1",children:[eN,"/",ew.length," file",1!==ew.length?"s":""]}),eN>0&&(K?(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("button",{onClick:ep,disabled:q,className:"px-2 py-0.5 rounded text-[10px] font-medium bg-error/15 text-error hover:bg-error/25 transition-colors disabled:opacity-40",children:q?(0,r.jsx)(F,{className:"w-2.5 h-2.5"}):"Discard ".concat(eN)}),(0,r.jsx)("button",{onClick:()=>G(!1),"aria-label":"Cancel",className:"p-0.5 rounded text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:(0,r.jsx)(N,{size:9})})]}):(0,r.jsx)("button",{onClick:ep,className:"px-2 py-0.5 rounded text-[10px] font-medium text-text-muted/50 hover:text-error hover:bg-error/10 transition-colors",children:"Discard"}))]}),ew.map(e=>(0,r.jsx)(eu,{file:e,checked:p.has(e.file),expanded:O===e.file,diff:U[e.file],loadingDiff:J===e.file,onToggleExpand:()=>ex(e.file),onToggleCheck:t=>eh(e.file,t)},e.file))]}):(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("p",{className:"text-text-muted text-[12px]",children:"Working tree clean"}),c.ahead>0&&(0,r.jsxs)("p",{className:"text-text-secondary text-[11px] mt-1",children:[c.ahead," commit",c.ahead>1?"s":""," ahead of remote"]})]}):(0,r.jsx)("p",{className:"text-text-muted text-[12px] text-center py-12",children:"Not a git repository"})}),(null==c?void 0:c.branch)&&(0,r.jsxs)("div",{className:"shrink-0 border-t border-border p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{onClick:eb,disabled:y,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-[11px] font-medium bg-bg-surface border border-border text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors disabled:opacity-40 disabled:pointer-events-none",children:[y?(0,r.jsx)(F,{className:"w-3 h-3"}):z?(0,r.jsx)(S,{size:11}):(0,r.jsxs)("svg",{width:11,height:11,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M21 12a9 9 0 1 1-6.22-8.56"}),(0,r.jsx)("polyline",{points:"21 3 21 9 15 9"})]}),z?"Fetched":"Fetch"]}),(0,r.jsxs)("button",{onClick:ev,disabled:C,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-[11px] font-medium bg-bg-surface border border-border text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors disabled:opacity-40 disabled:pointer-events-none",children:[C?(0,r.jsx)(F,{className:"w-3 h-3"}):_?(0,r.jsx)(S,{size:11}):(0,r.jsxs)("svg",{width:11,height:11,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,r.jsx)("polyline",{points:"19 12 12 19 5 12"})]}),_?"Pulled":"Pull"]}),(0,r.jsxs)("button",{onClick:eg,disabled:v,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-[11px] font-medium bg-bg-surface border border-border text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors disabled:opacity-40 disabled:pointer-events-none",children:[v?(0,r.jsx)(F,{className:"w-3 h-3"}):W?(0,r.jsx)(S,{size:11}):(0,r.jsxs)("svg",{width:11,height:11,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),(0,r.jsx)("polyline",{points:"5 12 12 5 19 12"})]}),W?"Pushed":"Push"]})]}),ek&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{value:h,onChange:e=>m(e.target.value),placeholder:"Commit message...",rows:2,className:"w-full resize-none rounded-md border border-border bg-bg-surface px-2.5 py-2 text-[12px] text-text placeholder:text-text-muted/50 focus:outline-none focus:border-text-muted/40",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ef())}}),(0,r.jsxs)("button",{onClick:ef,disabled:g||!h.trim()||0===eN,className:"w-full flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-[12px] font-medium bg-bg-surface border border-border text-text-secondary hover:text-text hover:bg-bg-hover transition-colors disabled:opacity-40 disabled:pointer-events-none",children:[g?(0,r.jsx)(F,{className:"w-3 h-3"}):L?(0,r.jsx)(S,{size:12}):null,L?"Committed":eN===ew.length?"Commit all":"Commit ".concat(eN," file").concat(1!==eN?"s":"")]}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted/50 text-center",children:"⌘+Enter to commit"})]})]})]})]})}function eu(e){let{file:t,checked:s,expanded:n,diff:l,loadingDiff:a,onToggleExpand:o,onToggleCheck:i}=e;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{onClick:o,className:"flex items-center gap-1.5 px-3 py-1.5 hover:bg-bg-hover transition-colors group cursor-pointer ".concat(n?"bg-bg-hover/50":""),children:[(0,r.jsx)("button",{onClick:i,className:"shrink-0 w-4 text-center","aria-label":s?"Deselect":"Select",children:(0,r.jsx)("span",{className:"text-[11px] font-bold transition-colors ".concat(s?"text-text-secondary":"text-text-muted/30"),children:s?"✓":"–"})}),(0,r.jsx)("span",{className:"shrink-0 w-4 text-center text-[10px] font-mono font-bold ".concat(function(e){switch(e){case"added":case"untracked":return"text-success";case"deleted":return"text-error";case"modified":return"text-warning";case"renamed":case"copied":return"text-info";default:return"text-text-muted"}}(t.status)),children:function(e){switch(e){case"added":return"A";case"untracked":return"U";case"deleted":return"D";case"modified":return"M";case"renamed":return"R";case"copied":return"C";default:return"?"}}(t.status)}),(0,r.jsx)("span",{className:"text-[11px] font-mono min-w-0 flex-1 text-text-secondary group-hover:text-text overflow-hidden text-ellipsis whitespace-nowrap",dir:"rtl",children:(0,r.jsx)("bdi",{children:t.file})}),(0,r.jsx)("svg",{width:10,height:10,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"shrink-0 text-text-muted/40 transition-transform ".concat(n?"rotate-180":""),children:(0,r.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),n&&(0,r.jsx)("div",{className:"border-t border-b border-border/50 bg-bg-surface/50 max-h-[300px] overflow-y-auto",children:a?(0,r.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,r.jsx)(F,{})}):(0,r.jsx)(ec,{diff:null!=l?l:""})})]})}s(729);let eh={background:"#000000",foreground:"#e8e8e8",cursor:"#e8e8e8",cursorAccent:"#000000",selectionBackground:"#ffffff30"};function em(e){return e.split("/").filter(Boolean).pop()||"~"}function ep(e){var t;let{open:l,onClose:i,workspace:c,onCountChange:d}=e,[x,u]=(0,n.useState)([]),[h,m]=(0,n.useState)(null),[p,f]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1),v=(0,n.useRef)(new Map),j=(0,n.useRef)(new Map),y=(0,n.useRef)(new Map),w=a(),k=(0,n.useRef)(!1),S=(0,n.useRef)(null),E=(0,n.useRef)(null),L=(0,n.useRef)(null),T=(0,n.useRef)(null),W=(0,n.useRef)(null),[A,I]=(0,n.useState)(!1);(0,n.useEffect)(()=>{null==d||d(x.length)},[x.length,d]),(0,n.useEffect)(()=>{let e=!1;return Promise.all([s.e(888).then(s.bind(s,9101)).then(e=>e.Terminal),s.e(581).then(s.bind(s,5581)).then(e=>e.FitAddon),s.e(877).then(s.bind(s,1877)).then(e=>e.WebLinksAddon)]).then(t=>{let[s,r,n]=t;e||(L.current=s,T.current=r,W.current=n,I(!0))}),()=>{e=!0}},[]);let _=(0,n.useCallback)(e=>{let t=j.current.get(e);if(t&&!t.disposed)return t;let s=L.current,r=T.current,n=W.current;if(!s||!r)return null;let l=new s({theme:eh,fontSize:13,fontFamily:'"SF Mono", "Fira Code", Menlo, Consolas, monospace',cursorBlink:!0,scrollback:5e3,convertEol:!0,disableStdin:!0}),a=new r;l.loadAddon(a),n&&l.loadAddon(new n((e,t)=>window.open(t,"_blank")));let o={term:l,fit:a,opened:!1,disposed:!1};return j.current.set(e,o),o},[]),D=(0,n.useCallback)(e=>{let t=j.current.get(e),s=y.current.get(e);t&&s&&!t.opened&&!t.disposed&&(t.term.open(s),t.opened=!0,requestAnimationFrame(()=>{try{t.fit.fit()}catch(e){}}))},[]),M=(0,n.useCallback)(e=>{if(v.current.has(e))return;let t=_(e);if(!t)return;let s=new EventSource("/api/terminal/stream?id=".concat(e));v.current.set(e,s),s.addEventListener("connected",s=>{let r=JSON.parse(s.data);r.output&&t.term.write(r.output),u(t=>t.map(t=>t.id===e?{...t,running:r.running,exitCode:r.exitCode}:t))}),s.addEventListener("output",s=>{let r=JSON.parse(s.data);r.data&&t.term.write(r.data),u(t=>t.map(t=>t.id===e?{...t,running:r.running,exitCode:r.exitCode}:t))}),s.onerror=()=>{s.close(),v.current.delete(e)}},[_]),P=(0,n.useRef)(c);(0,n.useEffect)(()=>{if(P.current!==c){for(let e of(P.current=c,k.current=!1,v.current.values()))e.close();for(let e of(v.current.clear(),j.current.values()))e.disposed=!0,e.term.dispose();j.current.clear(),y.current.clear(),u([]),m(null),f("")}},[c]),(0,n.useEffect)(()=>{l&&A&&(k.current||(k.current=!0,(0,o.n)("/api/terminal").then(e=>e.json()).then(e=>{let t=e.terminals||[],s=c?t.filter(e=>e.cwd===c):t;if(0===s.length)return;let r=s.map(e=>({id:e.id,label:em(e.cwd),running:e.running,exitCode:e.exitCode}));for(let e of(u(r),m(r[0].id),r))M(e.id)}).catch(()=>{})))},[l,A,M,c]),(0,n.useEffect)(()=>()=>{for(let e of v.current.values())e.close();for(let e of(v.current.clear(),j.current.values()))e.disposed=!0,e.term.dispose();j.current.clear()},[]),(0,n.useEffect)(()=>{if(!l||!S.current)return;let e=new ResizeObserver(()=>{if(!h)return;let e=j.current.get(h);if((null==e?void 0:e.opened)&&!e.disposed)try{e.fit.fit()}catch(e){}});return e.observe(S.current),()=>e.disconnect()},[l,h]),(0,n.useEffect)(()=>{if(A)for(let e of x)D(e.id)},[x,A,D]),(0,n.useEffect)(()=>{if(!h)return;let e=j.current.get(h);(null==e?void 0:e.opened)&&!e.disposed&&requestAnimationFrame(()=>{try{e.fit.fit()}catch(e){}})},[h]);let O=x.find(e=>e.id===h),B=null!=(t=null==O?void 0:O.running)&&t,U=(0,n.useCallback)(e=>{let t=v.current.get(e);t&&(t.close(),v.current.delete(e));let s=j.current.get(e);s&&(s.disposed=!0,s.term.dispose(),j.current.delete(e)),y.current.delete(e),(0,o.n)("/api/terminal",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,remove:!0})}).catch(()=>{})},[]),H=(0,n.useCallback)(async()=>{b(!0);try{let e=await (0,o.n)("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:c})}),t=await e.json(),s=em(t.cwd||c||"~"),r={id:t.id,label:s,running:!0,exitCode:null};u(e=>[...e,r]),m(t.id),M(t.id),w.send(),setTimeout(()=>{var e;return null==(e=E.current)?void 0:e.focus()},50)}catch(e){w.error()}finally{b(!1)}},[c,M,w]),J=(0,n.useCallback)(async e=>{h&&e&&(await (0,o.n)("/api/terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:h,data:e+"\n"})}).catch(()=>{}),f(""))},[h]),V=(0,n.useCallback)(()=>{O&&B&&J(p)},[p,O,B,J]),q=(0,n.useCallback)(async()=>{h&&(await (0,o.n)("/api/terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:h,data:"\x03"})}).catch(()=>{}),w.tap())},[h,w]),Q=(0,n.useCallback)(async e=>{w.warn(),await (0,o.n)("/api/terminal",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})}).catch(()=>{})},[w]),K=(0,n.useCallback)(e=>{U(e),u(t=>{var s,r;let n=t.filter(t=>t.id!==e);return h===e&&m(null!=(r=null==(s=n[0])?void 0:s.id)?r:null),n}),w.tap()},[h,w,U]);return l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/60","aria-hidden":"true",onClick:i}),(0,r.jsxs)("div",{className:"fixed inset-0 z-50 bg-bg-elevated flex flex-col sm:inset-auto sm:top-0 sm:right-0 sm:h-full sm:w-[380px] sm:border-l sm:border-border",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between h-11 px-3 border-b border-border shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"text-[13px] font-medium text-text-secondary",children:"Terminal"}),x.length>0&&(0,r.jsx)("span",{className:"text-[10px] text-text-muted",children:x.length})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:H,disabled:g,className:"p-1.5 rounded-md transition-colors text-text-muted hover:text-text-secondary hover:bg-bg-hover disabled:opacity-40","aria-label":"New terminal",children:g?(0,r.jsx)(F,{className:"w-3.5 h-3.5"}):(0,r.jsx)(C,{size:13})}),(0,r.jsx)("button",{onClick:i,"aria-label":"Close",className:"p-1.5 rounded-md hover:bg-bg-hover text-text-muted hover:text-text-secondary transition-colors",children:(0,r.jsx)(N,{size:13})})]})]}),x.length>0&&(0,r.jsx)("div",{className:"shrink-0 flex items-center gap-0.5 px-2 py-1 border-b border-border overflow-x-auto",children:x.map((e,t)=>(0,r.jsxs)("button",{onClick:()=>m(e.id),className:"group flex items-center gap-1.5 pl-2 pr-1 py-1.5 rounded-md text-[11px] font-mono transition-colors shrink-0 max-w-[150px] ".concat(e.id===h?"bg-bg-active text-text":"text-text-muted hover:text-text-secondary hover:bg-bg-hover"),children:[(0,r.jsx)("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full ".concat(e.running?"bg-success":0===e.exitCode?"bg-text-muted/30":"bg-error/60")}),(0,r.jsxs)("span",{className:"truncate",children:[e.label,x.filter(t=>t.label===e.label).length>1?" ".concat(t+1):""]}),(0,r.jsx)("span",{role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),e.running?Q(e.id):K(e.id)},onKeyDown:t=>{"Enter"===t.key&&(t.stopPropagation(),e.running?Q(e.id):K(e.id))},className:"shrink-0 ml-0.5 p-1 rounded opacity-40 hover:opacity-100 active:opacity-100 hover:bg-bg-active transition-opacity",children:(0,r.jsx)(N,{size:9})})]},e.id))}),(0,r.jsxs)("div",{ref:S,className:"flex-1 relative bg-bg overflow-hidden",children:[0===x.length&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,r.jsxs)("button",{onClick:H,disabled:g,className:"flex items-center gap-2 px-4 py-2 rounded-lg text-[13px] text-text-muted hover:text-text-secondary bg-bg-surface hover:bg-bg-hover transition-colors disabled:opacity-40",children:[g?(0,r.jsx)(F,{className:"w-3.5 h-3.5"}):(0,r.jsx)(C,{size:13}),"New terminal"]})}),x.map(e=>(0,r.jsx)("div",{ref:t=>{t&&(y.current.set(e.id,t),D(e.id))},className:"absolute inset-0",style:{display:e.id===h?"block":"none"}},e.id))]}),O&&(0,r.jsxs)("div",{className:"shrink-0 border-t border-border bg-bg-elevated",children:[!B&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border",children:[(0,r.jsxs)("span",{className:"text-[11px] text-text-muted",children:["exited",0!==O.exitCode&&null!==O.exitCode?" (".concat(O.exitCode,")"):""]}),(0,r.jsxs)("button",{onClick:()=>K(O.id),className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-[11px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:[(0,r.jsx)(R,{size:10}),"Remove"]})]}),B&&(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),V()},className:"flex items-center gap-2 px-3 py-2.5",children:[(0,r.jsx)("span",{className:"text-[13px] font-mono shrink-0 text-text-muted",children:">"}),(0,r.jsx)("input",{ref:E,value:p,onChange:e=>f(e.target.value),placeholder:"Type a command...",className:"flex-1 min-w-0 bg-transparent text-[13px] font-mono text-text placeholder:text-text-muted/50 focus:outline-none",autoFocus:!0}),(0,r.jsx)("button",{type:"button",onClick:q,className:"shrink-0 px-2 py-1 rounded-md text-[11px] font-mono text-error/60 hover:text-error hover:bg-error/10 transition-colors",children:"^C"}),(0,r.jsx)("button",{type:"button",onClick:()=>Q(O.id),className:"shrink-0 p-1.5 rounded-md text-error/50 hover:text-error hover:bg-error/10 transition-colors","aria-label":"Kill process",children:(0,r.jsx)(z,{size:12})})]})]})]})]}):null}function ef(e){let{initialSessionId:t,initialWorkspace:s,defaultModel:l,onLabelChange:f,onStreamingChange:g,onSessionIdChange:b,onSelectSession:v,onOpenSidebar:j,onOpenSettings:y,onOpenQr:w}=e,{messages:k,toolCalls:C,sessionId:E,isStreaming:R,isLoadingHistory:T,isWatching:W,model:A,selectedModel:z,selectedMode:F,error:I,sendMessage:_,loadSession:B,setSelectedModel:U,setSelectedMode:H,stopStreaming:J,retryLastMessage:V,queuedMessages:q,forceSendQueued:Q,editQueued:K,deleteQueued:G}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"auto",t=arguments.length>1?arguments[1]:void 0,[s,r]=(0,n.useState)(null),[l,a]=(0,n.useState)(!1),[x,u]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),[p,f]=(0,n.useState)(e),[g,b]=(0,n.useState)("agent"),[v,j]=(0,n.useState)(null),y=(0,n.useRef)(null),w=(0,n.useRef)(t),k=(0,n.useRef)(!1),N=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{y.current=s},[s]),(0,n.useEffect)(()=>{k.current=l},[l]),(0,n.useEffect)(()=>{s||(w.current=t)},[t,s]);let C=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[t,s]=(0,n.useState)([]),[r,l]=(0,n.useState)([]),[a,i]=(0,n.useState)(!1),[d,x]=(0,n.useState)(!1),u=(0,n.useRef)(null),h=(0,n.useRef)(0),m=(0,n.useRef)(e.onStreamEnd),p=(0,n.useRef)(e.onStreamStart);(0,n.useEffect)(()=>{m.current=e.onStreamEnd},[e.onStreamEnd]),(0,n.useEffect)(()=>{p.current=e.onStreamStart},[e.onStreamStart]);let f=(0,n.useCallback)(()=>{u.current&&(c("watch-client","stopWatching: closing EventSource"),u.current.close(),u.current=null),i(!1)},[]),g=(0,n.useCallback)(e=>{s(t=>{let s=new Set(e.map(e=>e.id)),r=new Set(e.filter(e=>"user"===e.role).map(e=>e.content.trim())),n=t.filter(e=>"user"===e.role&&!s.has(e.id)&&!r.has(e.content.trim()));return(c("watch-client","mergeMessages",{incoming:e.length,prev:t.length,optimistic:n.length}),0===n.length)?e:[...e,...n]})},[]),b=(0,n.useCallback)(e=>{if(e.modifiedAt&&e.modifiedAt>h.current){var t,s;h.current=e.modifiedAt,(null==(t=e.messages)?void 0:t.length)>0&&g(e.messages),(null==(s=e.toolCalls)?void 0:s.length)>0&&l(e.toolCalls)}},[g]),v=(0,n.useCallback)((e,t)=>{f();let s="/api/sessions/watch?id=".concat(encodeURIComponent(e));t&&(s+="&workspace=".concat(encodeURIComponent(t))),c("watch-client","startWatching: opening EventSource",{id:e,url:s});let r=new EventSource(s);u.current=r,r.addEventListener("connected",t=>{i(!0);try{var s,r,n,a,o,d,u,f;let i=JSON.parse(t.data);c("watch-client","connected event",{id:e,isActive:i.isActive,messages:null!=(o=null==(s=i.messages)?void 0:s.length)?o:0,toolCalls:null!=(d=null==(r=i.toolCalls)?void 0:r.length)?d:0,modifiedAt:i.modifiedAt}),!0===i.isActive?(x(!0),null==(u=p.current)||u.call(p)):(x(!1),null==(f=m.current)||f.call(m)),i.modifiedAt&&(h.current=i.modifiedAt),(null==(n=i.messages)?void 0:n.length)>0&&g(i.messages),(null==(a=i.toolCalls)?void 0:a.length)>0&&l(i.toolCalls)}catch(e){console.error("[watch] Failed to parse connected event"),c("watch-client","connected parse error",String(e))}}),r.addEventListener("update",t=>{try{var s,r,n,l,a;let o=JSON.parse(t.data);c("watch-client","update event",{id:e,isActive:o.isActive,messages:null!=(n=null==(s=o.messages)?void 0:s.length)?n:0,toolCalls:null!=(l=null==(r=o.toolCalls)?void 0:r.length)?l:0,modifiedAt:o.modifiedAt}),b(o),!1===o.isActive?(x(!1),null==(a=m.current)||a.call(m)):!0===o.isActive&&x(!0)}catch(e){console.error("[watch] Failed to parse update event"),c("watch-client","update parse error",String(e))}}),r.addEventListener("error",t=>{if(c("watch-client","EventSource error",{id:e,readyState:r.readyState,event:String(t)}),r.readyState===EventSource.CLOSED){var s;x(!1),null==(s=m.current)||s.call(m)}})},[f,b,g]),j=(0,n.useCallback)(async(e,t)=>{let s=Date.now();try{var r,n,a,i,d,x;let u="/api/sessions/history?id=".concat(encodeURIComponent(e));t&&(u+="&workspace=".concat(encodeURIComponent(t))),c("watch-client","refreshFromHistory: fetch",{sessionId:e,url:u});let m=await (0,o.n)(u);if(c("watch-client","refreshFromHistory: response",{sessionId:e,status:m.status,ok:m.ok}),!m.ok)return;let p=await m.json();c("watch-client","refreshFromHistory: data",{sessionId:e,messages:null!=(d=null==(r=p.messages)?void 0:r.length)?d:0,toolCalls:null!=(x=null==(n=p.toolCalls)?void 0:n.length)?x:0,modifiedAt:p.modifiedAt,ms:Date.now()-s}),(null==(a=p.messages)?void 0:a.length)>0&&g(p.messages),(null==(i=p.toolCalls)?void 0:i.length)>0&&l(p.toolCalls),p.modifiedAt&&(h.current=p.modifiedAt)}catch(t){console.error("[watch] Failed to refresh from history"),c("watch-client","refreshFromHistory: error",{sessionId:e,error:String(t),ms:Date.now()-s})}},[g]),y=(0,n.useCallback)(()=>{c("watch-client","resetState"),s([]),l([]),x(!1),h.current=0},[]);return(0,n.useEffect)(()=>()=>{f()},[f]),{messages:t,setMessages:s,toolCalls:r,setToolCalls:l,isWatching:a,isActive:d,setIsActive:x,startWatching:v,stopWatching:f,refreshFromHistory:j,resetState:y,lastModifiedRef:h}}({onStreamEnd:(0,n.useCallback)(()=>{a(!1);let e=S.dequeueNext();if(e){let t=e.model||e.mode?{model:e.model,mode:e.mode}:void 0;setTimeout(()=>{var s;null==(s=N.current)||s.call(N,e.content,t)},0)}},[]),onStreamStart:(0,n.useCallback)(()=>a(!0),[])}),S=function(e){let{selectedModel:t,selectedMode:s}=e,[r,l]=(0,n.useState)([]),a=(0,n.useRef)([]);(0,n.useEffect)(()=>{a.current=r},[r]);let o=(0,n.useCallback)(e=>{let r={id:i(),content:e,timestamp:Date.now(),model:t,mode:s};l(e=>[...e,r])},[t,s]),c=(0,n.useCallback)(()=>{let e=a.current;if(0===e.length)return null;let t=e[0];return l(e=>e.slice(1)),t},[]),d=(0,n.useCallback)(e=>{let t=a.current.find(t=>t.id===e);return t?(l(t=>t.filter(t=>t.id!==e)),t):null},[]),x=(0,n.useCallback)((e,t)=>{l(s=>s.map(s=>s.id===e?{...s,content:t}:s))},[]);return{queuedMessages:r,enqueue:o,dequeueNext:c,forceSendQueued:d,editQueued:x,deleteQueued:(0,n.useCallback)(e=>{l(t=>t.filter(t=>t.id!==e))},[]),clearQueue:(0,n.useCallback)(()=>{l([])},[])}}({selectedModel:p,selectedMode:g}),E=(0,n.useCallback)(()=>{C.stopWatching(),C.resetState(),r(null),w.current=t,m(null),j(null),a(!1),S.clearQueue()},[C,S]),L=(0,n.useCallback)(()=>{y.current&&(0,o.n)("/api/sessions/active",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:y.current})}).catch(e=>console.error("[chat] Failed to stop streaming:",e)),a(!1)},[]),R=(0,n.useCallback)(async(e,t)=>{let s=Date.now();c("chat","loadSession start",{id:e,workspace:t}),C.stopWatching(),C.resetState(),u(!0),j(null),r(e),w.current=t;try{c("chat","loadSession: refreshFromHistory",{id:e,workspace:t}),await C.refreshFromHistory(e,t),c("chat","loadSession: refreshFromHistory done",{id:e,ms:Date.now()-s}),c("chat","loadSession: startWatching",{id:e,workspace:t}),C.startWatching(e,t),c("chat","loadSession: checking active sessions");let r=await d(),n=r.includes(e);c("chat","loadSession: active check",{id:e,isSessionActive:n,activeSessions:r.length}),n&&a(!0)}catch(r){let t=r instanceof Error?r.message:"Failed to load session";c("chat","loadSession: error",{id:e,error:t,ms:Date.now()-s}),j(t)}finally{c("chat","loadSession: done",{id:e,ms:Date.now()-s}),u(!1)}},[C]),T=(0,n.useCallback)(async(e,t)=>{var s,n,l;if(k.current)return void S.enqueue(e);C.stopWatching(),j(null),a(!0);let c={id:i(),role:"user",content:e,timestamp:Date.now()};C.setMessages(e=>[...e,c]);let d=null!=(s=null==t?void 0:t.model)?s:p,x=null!=(n=null==t?void 0:t.mode)?n:g;try{let t=await (0,o.n)("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,sessionId:null!=(l=y.current)?l:void 0,model:"auto"!==d?d:void 0,mode:"agent"!==x?x:void 0,workspace:w.current})});if(!t.ok){let e=await t.json();throw Error(e.error||"HTTP ".concat(t.status))}let s=await t.json(),n=s.sessionId;y.current=n,r(n),s.model&&m(s.model),C.startWatching(n,w.current)}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;j(e instanceof Error?e.message:"Unknown error"),a(!1)}},[p,g,C,S]);(0,n.useEffect)(()=>{N.current=T},[T]),(0,n.useEffect)(()=>{let e=async()=>{if("visible"!==document.visibilityState)return;let e=y.current;if(e)try{await C.refreshFromHistory(e,w.current);let t=await d();a(t.includes(e)),j(null),C.isWatching||C.startWatching(e,w.current)}catch(e){console.error("[chat] Failed to refresh on visibility change")}};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[C]);let W=(0,n.useCallback)(e=>{let t=S.forceSendQueued(e);if(!t)return;a(!1);let s=t.model||t.mode?{model:t.model,mode:t.mode}:void 0;setTimeout(()=>{var e;null==(e=N.current)||e.call(N,t.content,s)},0)},[S]);(0,n.useEffect)(()=>{if(!l)return;let e=setInterval(async()=>{let e=y.current;if(e&&k.current)try{(await d()).includes(e)||(a(!1),await C.refreshFromHistory(e,w.current))}catch(e){}},1e4);return()=>clearInterval(e)},[l,C]);let A=(0,n.useCallback)(()=>{if(k.current)return;let e=C.messages,t=[...e].reverse().find(e=>"user"===e.role);if(!t)return;let s=t.content,r=e.findIndex(e=>e.id===t.id);r>=0&&C.setMessages(e.slice(0,r)),C.setToolCalls(e=>e.filter(e=>e.timestamp<t.timestamp)),T(s).catch(e=>console.error("[chat] Retry failed:",e))},[C,T]);return{messages:C.messages,toolCalls:C.toolCalls,sessionId:s,isStreaming:l,isLoadingHistory:x,isWatching:C.isWatching,model:h,selectedModel:p,selectedMode:g,error:v,queuedMessages:S.queuedMessages,sendMessage:T,loadSession:R,setSessionId:r,setSelectedModel:f,setSelectedMode:b,clearChat:E,stopStreaming:L,retryLastMessage:A,forceSendQueued:W,editQueued:S.editQueued,deleteQueued:S.deleteQueued}}(l,s),Y=a(),$=function(){let e=(0,n.useRef)(null);return{playComplete:(0,n.useCallback)(()=>{if(x())return;let t=u(e);if(!t)return;let s=t.currentTime;h(t,880,s,.12,.15),h(t,1174.66,s+.1,.18,.12)},[]),playError:(0,n.useCallback)(()=>{if(x())return;let t=u(e);if(!t)return;let s=t.currentTime;h(t,330,s,.2,.15),h(t,220,s+.15,.25,.12)},[])}}(),X=function(){let[e,t]=(0,n.useState)(null),s=(0,n.useRef)(null),r=(0,n.useRef)(""),l=(0,n.useRef)(null),a=(0,n.useCallback)(()=>{s.current&&(clearInterval(s.current),s.current=null),document.title=m,r.current&&p(r.current),l.current=null},[]),o=(0,n.useCallback)(()=>{t(null),a()},[a]);return{pending:e,notify:(0,n.useCallback)((e,n)=>{var o;t({type:e,elapsed:n});let i=document.querySelector("link[rel='icon']");r.current=null!=(o=null==i?void 0:i.href)?o:"/favicon.ico";let c=function(e){let t=document.createElement("canvas");t.width=32,t.height=32;let s=t.getContext("2d");return s?(s.fillStyle="#0a0a0b",s.beginPath(),s.roundRect(0,0,32,32,6),s.fill(),s.fillStyle="#e5e5e6",s.font="bold 18px sans-serif",s.textAlign="center",s.textBaseline="middle",s.fillText("C",16,17),s.fillStyle=e,s.beginPath(),s.arc(26,6,6,0,2*Math.PI),s.fill(),t.toDataURL("image/png")):""}("error"===e?"#ef4444":"#22c55e");c&&p(c);let d="error"===e?"Error - CLR":"Done! - CLR",x=!0;s.current=setInterval(()=>{document.title=x?d:m,x=!x},1e3);let u=()=>{"visible"===document.visibilityState&&(a(),document.removeEventListener("visibilitychange",u))};document.addEventListener("visibilitychange",u),l.current=()=>{a(),document.removeEventListener("visibilitychange",u)}},[a]),dismiss:o}}(),[Z,ee]=(0,n.useState)(""),[et,es]=(0,n.useState)([]),[er,en]=(0,n.useState)(0),[ea,ei]=(0,n.useState)(!1),[ec,ed]=(0,n.useState)(null),[eu,eh]=(0,n.useState)(!1),[em,ef]=(0,n.useState)(!1),[eg,eb]=(0,n.useState)(0),ev=(0,n.useRef)(void 0),ej=(0,n.useRef)(0),ey=(0,n.useRef)(!1),ew=(0,n.useRef)(!1),ek=(0,n.useRef)(0);(0,n.useEffect)(()=>{t&&!ey.current&&(ey.current=!0,c("container","loading initial session",{initialSessionId:t,initialWorkspace:s}),B(t,s))},[t,s,B]);let eN=(0,n.useCallback)(()=>{if(s)return void ee(s);(0,o.n)("/api/info").then(e=>e.json()).then(e=>ee(e.workspace||"")).catch(e=>console.error("[workspace] Failed to fetch:",e))},[s]);(0,n.useEffect)(()=>{eN(),(0,o.n)("/api/sessions").then(e=>e.json()).then(e=>{var t;(null==(t=e.sessions)?void 0:t.length)>0&&es(e.sessions.slice(0,3))}).catch(e=>console.error("[sessions] Failed to fetch:",e))},[eN]),(0,n.useEffect)(()=>{let e=k.filter(e=>"assistant"===e.role).length;e>ej.current&&e>0&&Y.tap(),ej.current=e},[k,Y]),(0,n.useEffect)(()=>{if(R&&!ew.current&&(ek.current=Date.now(),X.dismiss()),ew.current&&!R){let e=Date.now()-ek.current,t=e>3e3,s=Math.floor(e/1e3);I?(t||document.hidden)&&$.playError():(t||document.hidden)&&$.playComplete(),document.hidden&&X.notify(I?"error":"complete",s)}ew.current=R,null==g||g(R)},[R,I]),(0,n.useEffect)(()=>{if(!R)return void en(0);let e=()=>en(Math.floor((Date.now()-ek.current)/1e3));e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[R]),(0,n.useEffect)(()=>{null==b||b(E)},[E]),(0,n.useEffect)(()=>{let e=k.find(e=>"user"===e.role);e&&(null==f||f(e.content.slice(0,50)))},[k]);let eC=(0,n.useCallback)(async()=>{let e=function(e,t){let s=[...e.map(e=>({ts:e.timestamp,kind:"msg",msg:e})),...t.map(e=>({ts:e.timestamp,kind:"tc",tc:e}))].sort((e,t)=>e.ts-t.ts),r=[];for(let e of s)if("msg"===e.kind&&e.msg){let t="user"===e.msg.role?"User":"Assistant";r.push("## ".concat(t,"\n\n").concat(e.msg.content))}else"tc"===e.kind&&e.tc&&r.push(function(e){let t="shell"===e.type?"Shell":"search"===e.type?"Search":"edit"===e.type?"Edit":"write"===e.type?"Write":"read"===e.type?"Read":e.name,s="shell"===e.type?e.command:e.path;return s?"> **".concat(t,"** `").concat(s,"`"):"> **".concat(t,"**")}(e.tc));return r.join("\n\n")}(k,C);try{await navigator.clipboard.writeText(e),Y.tap(),ei(!0),setTimeout(()=>ei(!1),1500)}catch(n){let t=new Blob([e],{type:"text/markdown"}),s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download="session-".concat((null==E?void 0:E.slice(0,8))||"export",".md"),r.click(),URL.revokeObjectURL(s)}},[k,C,E,Y]),eS=(0,n.useCallback)(()=>{(0,o.n)("/api/terminal").then(e=>e.json()).then(e=>{let t=e.terminals||[];eb(Z?t.filter(e=>e.cwd===Z).length:t.length)}).catch(()=>{})},[Z]);(0,n.useEffect)(()=>(eS(),ev.current=setInterval(eS,1e4),()=>clearInterval(ev.current)),[eS]),(0,n.useEffect)(()=>{if(!Z)return;let e="/api/git?workspace=".concat(encodeURIComponent(Z)),t=()=>{(0,o.n)(e).then(e=>e.json()).then(e=>{var t;e.branch?ed({branch:e.branch,changedFiles:null!=(t=e.changedFiles)?t:0}):ed(null)}).catch(()=>{})};t();let s=setInterval(t,3e4);return()=>clearInterval(s)},[Z]);let eE=Z.split("/").filter(Boolean).pop()||"~",eL=er>=60?"".concat(Math.floor(er/60),"m ").concat(er%60,"s"):"".concat(er,"s");return(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsxs)("header",{className:"shrink-0 flex items-center justify-between h-11 px-3 border-b border-border",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>{Y.tap(),null==j||j()},"aria-label":"Open session sidebar",className:"p-2 rounded-md hover:bg-bg-hover transition-colors text-text-muted hover:text-text-secondary",children:(0,r.jsx)(L,{})}),(0,r.jsx)("span",{className:"text-[13px] font-medium text-text-secondary",children:eE}),ec&&(0,r.jsxs)("button",{onClick:()=>eh(!0),className:"flex items-center gap-1 text-[10px] text-text-muted bg-bg-surface hover:bg-bg-hover rounded px-1.5 py-0.5 transition-colors",children:[(0,r.jsx)(P,{size:10}),(0,r.jsx)("span",{className:"truncate max-w-[80px]",children:ec.branch}),ec.changedFiles>0&&(0,r.jsxs)("span",{className:"text-warning",children:["+",ec.changedFiles]})]}),(0,r.jsxs)("button",{onClick:()=>ef(!0),className:"flex items-center gap-1 text-[10px] text-text-muted bg-bg-surface hover:bg-bg-hover rounded px-1.5 py-0.5 transition-colors",children:[(0,r.jsx)(O,{size:10}),(0,r.jsx)("span",{children:"Terminal"}),eg>0&&(0,r.jsx)("span",{className:"text-success",children:eg})]}),R&&(0,r.jsxs)(r.Fragment,{children:[A&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-text-muted text-[11px]",children:"/"}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted truncate max-w-[120px]",children:A})]}),(0,r.jsx)("span",{className:"text-[11px] text-text-muted/60 tabular-nums",children:eL})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[E&&(0,r.jsx)("span",{className:"text-[10px] text-text-muted font-mono mr-1 hidden sm:inline opacity-60",children:E.slice(0,8)}),E&&k.length>0&&(0,r.jsx)("button",{onClick:eC,className:"p-2 rounded-md hover:bg-bg-hover transition-colors text-text-muted hover:text-text-secondary","aria-label":ea?"Copied to clipboard":"Export conversation",children:ea?(0,r.jsx)(S,{size:14}):(0,r.jsx)(M,{size:14})}),(0,r.jsx)("button",{onClick:()=>{Y.tap(),null==y||y()},className:"p-2 rounded-md hover:bg-bg-hover transition-colors text-text-muted hover:text-text-secondary","aria-label":"Settings",children:(0,r.jsx)(D,{size:16})}),(0,r.jsx)("button",{onClick:()=>{Y.tap(),null==w||w()},className:"p-2 rounded-md hover:bg-bg-hover transition-colors text-text-muted hover:text-text-secondary","aria-label":"Connect device",children:(0,r.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),(0,r.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"14",width:"3",height:"3"}),(0,r.jsx)("line",{x1:"21",y1:"14",x2:"21",y2:"14.01"}),(0,r.jsx)("line",{x1:"21",y1:"21",x2:"21",y2:"21.01"})]})})]})]}),I&&(0,r.jsx)("div",{className:"shrink-0 px-4 py-2 border-b border-error/20 text-error text-[12px] bg-error/5",children:I}),X.pending&&(0,r.jsxs)("div",{className:"shrink-0 flex items-center justify-between px-4 py-2 border-b text-[12px] ".concat("error"===X.pending.type?"border-error/20 text-error bg-error/5":"border-success/20 text-success bg-success/5"),children:[(0,r.jsxs)("span",{children:["error"===X.pending.type?"Agent errored":"Agent finished",null!==X.pending.elapsed&&void 0!==X.pending.elapsed&&X.pending.elapsed>0&&(0,r.jsxs)("span",{className:"opacity-60 ml-1",children:["(",X.pending.elapsed>=60?"".concat(Math.floor(X.pending.elapsed/60),"m ").concat(X.pending.elapsed%60,"s"):"".concat(X.pending.elapsed,"s"),")"]})]}),(0,r.jsx)("button",{onClick:X.dismiss,className:"p-0.5 rounded hover:bg-bg-hover transition-colors","aria-label":"Dismiss notification",children:(0,r.jsx)(N,{size:12})})]}),(0,r.jsx)(el,{messages:k,toolCalls:C,isStreaming:R,isLoadingHistory:T,isWatching:W,recentSessions:et,onSelectSession:null!=v?v:B,onRetry:V,queuedMessages:q,onForceSend:Q,onEditQueued:K,onDeleteQueued:G}),(0,r.jsx)(eo,{onSend:_,onStop:J,isStreaming:R,selectedModel:z,selectedMode:F,onModelChange:U,onModeChange:H}),(0,r.jsx)(ex,{open:eu,onClose:()=>{eh(!1),Z&&(0,o.n)("/api/git?workspace=".concat(encodeURIComponent(Z))).then(e=>e.json()).then(e=>{var t;e.branch?ed({branch:e.branch,changedFiles:null!=(t=e.changedFiles)?t:0}):ed(null)}).catch(()=>{})},workspace:Z||void 0}),(0,r.jsx)(ep,{open:em,onClose:()=>ef(!1),workspace:Z||void 0,onCountChange:e=>{eb(e)}})]})}function eg(e){let{status:t}=e;return"streaming"===t?(0,r.jsx)("span",{className:"shrink-0 w-2 h-2 rounded-full border-[1.5px] border-success border-t-transparent animate-spin"}):(0,r.jsx)("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-text-muted/40"})}function eb(e){let{size:t=12,className:s=""}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("polyline",{points:"21 8 21 21 3 21 3 8"}),(0,r.jsx)("rect",{x:"1",y:"3",width:"22",height:"5"}),(0,r.jsx)("line",{x1:"10",y1:"12",x2:"14",y2:"12"})]})}function ev(e){let{size:t=12,className:s=""}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:s,children:[(0,r.jsx)("polyline",{points:"21 8 21 21 3 21 3 8"}),(0,r.jsx)("rect",{x:"1",y:"3",width:"22",height:"5"}),(0,r.jsx)("polyline",{points:"12 15 12 10"}),(0,r.jsx)("polyline",{points:"9 12 12 9 15 12"})]})}let ej="clr-selected-project",ey="clr-starred-projects";function ew(e){let{size:t=12,filled:s=!1,className:n=""}=e;return(0,r.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:s?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,children:(0,r.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function ek(e){localStorage.setItem(ey,JSON.stringify(e)),(0,o.n)("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({starred_projects:JSON.stringify(e)})}).catch(()=>{})}function eN(e){let{session:t,children:s}=e,[l,a]=(0,n.useState)(!1),[o,i]=(0,n.useState)({x:0,y:0}),c=(0,n.useRef)(null);return(0,r.jsxs)("div",{ref:c,onMouseEnter:e=>{let t=e.currentTarget.getBoundingClientRect();i({x:t.left+t.width/2,y:t.top}),a(!0)},onMouseLeave:()=>a(!1),className:"relative",children:[s,l&&(0,r.jsx)("div",{className:"fixed z-[100] pointer-events-none",style:{left:o.x,top:o.y},children:(0,r.jsxs)("div",{className:"relative -translate-x-1/2 -translate-y-full -mt-1.5 max-w-[240px] px-2.5 py-1.5 rounded-md bg-bg-elevated border border-border shadow-lg",children:[(0,r.jsx)("p",{className:"text-[11px] text-text leading-snug break-words",children:t.title}),t.preview&&t.preview!==t.title&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5 leading-snug break-words line-clamp-3",children:t.preview}),(0,r.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 top-full w-0 h-0 border-x-[5px] border-x-transparent border-t-[5px] border-t-border"})]})})]})}function eC(e){var t;let{open:s,onClose:l,currentSessionId:i,onSelectSession:c,onNewSession:d,onWorkspaceChange:x,activeStatuses:u={},workspaceTerminals:h={}}=e,[m,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),[y,w]=(0,n.useState)(null),[S,E]=(0,n.useState)(null),[L,W]=(0,n.useState)([]),[A,z]=(0,n.useState)(null),[I,_]=(0,n.useState)(!1),[D,M]=(0,n.useState)([]),P=a();(0,n.useEffect)(()=>{let e=localStorage.getItem(ej),t=function(){try{return JSON.parse(localStorage.getItem(ey)||"[]")}catch(e){return[]}}();z(e),M(t),(0,o.n)("/api/settings").then(e=>e.json()).then(e=>{var s;let r=null==(s=e.settings)?void 0:s.starred_projects;if(r)try{let e=JSON.parse(r);(e.length>0||0===t.length)&&(M(e),localStorage.setItem(ey,r))}catch(e){}else t.length>0&&ek(t)}).catch(()=>{})},[]);let O=(0,n.useCallback)((e,t)=>{e.stopPropagation(),M(e=>{let s=e.includes(t)?e.filter(e=>e!==t):[...e,t];return ek(s),s})},[]),B=(0,n.useCallback)(()=>{(0,o.n)("/api/projects").then(e=>e.json()).then(e=>{W(e.projects||[]),!A&&e.currentWorkspace&&(z(e.currentWorkspace),localStorage.setItem(ej,e.currentWorkspace))}).catch(()=>{})},[A]),U=(0,n.useCallback)(()=>{E(null);let e=new URLSearchParams;"__all__"===A?e.set("all","true"):A&&e.set("workspace",A),v&&e.set("archived","true");let t=e.toString();return(0,o.n)("/api/sessions"+(t?"?"+t:"")).then(e=>e.json()).then(e=>p(e.sessions||[])).catch(()=>E("Failed to load sessions"))},[A,v]);(0,n.useEffect)(()=>{if(!s)return;let e=!1;return b(!0),w(null),B(),U().finally(()=>{e||b(!1)}),()=>{e=!0}},[s,U,B]);let H=(0,n.useCallback)(e=>{z(e),localStorage.setItem(ej,e),_(!1),"__all__"!==e&&(null==x||x(e))},[x]),J=(e,t)=>{e.stopPropagation(),y===t?(P.error(),(0,o.n)("/api/sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t})}).then(()=>U()).catch(()=>E("Failed to delete session")).finally(()=>w(null))):(P.warn(),w(t))},V=e=>{e.stopPropagation(),w(null)},q="__all__"===A?"All projects":(null==(t=L.find(e=>e.path===A))?void 0:t.name)||(null==A?void 0:A.split("/").pop())||"Current project";return(0,r.jsxs)(r.Fragment,{children:[s&&(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/60","aria-hidden":"true",onClick:l}),(0,r.jsxs)("div",{role:"dialog","aria-label":"Session history","aria-hidden":!s,className:"fixed inset-0 z-50 bg-bg-elevated transform transition-transform duration-150 flex flex-col sm:inset-auto sm:top-0 sm:left-0 sm:h-full sm:w-[280px] sm:border-r sm:border-border ".concat(s?"translate-x-0":"-translate-x-full"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between h-11 px-3 border-b border-border shrink-0",children:[(0,r.jsx)("span",{className:"text-[13px] font-medium text-text-secondary",children:"Sessions"}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:()=>{P.tap(),b(!0),U().finally(()=>b(!1))},disabled:g,"aria-label":"Refresh sessions",className:"p-1 rounded-md hover:bg-bg-hover text-text-muted hover:text-text-secondary transition-colors disabled:opacity-40",children:(0,r.jsx)(T,{size:14,className:g?"animate-spin":""})}),(0,r.jsx)("button",{onClick:l,"aria-label":"Close sidebar",className:"p-1 rounded-md hover:bg-bg-hover text-text-muted hover:text-text-secondary transition-colors",children:(0,r.jsx)(N,{size:14})})]})]}),(0,r.jsxs)("div",{className:"px-2 pt-2 pb-1 space-y-1 shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>{d(A&&"__all__"!==A?A:void 0),l()},className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[12px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:[(0,r.jsx)(C,{}),"New session"]}),D.length>0&&(0,r.jsx)("div",{className:"space-y-px",children:D.map(e=>{let t=L.find(t=>t.path===e),s=(null==t?void 0:t.name)||e.split("/").pop()||e,n=A===e,l=h[e]||0;return(0,r.jsxs)("button",{onClick:()=>H(e),className:"w-full flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-[12px] transition-colors ".concat(n?"bg-bg-active text-text":"text-text-muted hover:text-text-secondary hover:bg-bg-hover"),children:[(0,r.jsx)(ew,{size:10,filled:!0,className:"shrink-0 text-text-secondary"}),(0,r.jsx)("span",{className:"truncate",children:s}),l>0&&(0,r.jsx)("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-success"})]},e)})}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("button",{onClick:()=>{P.tap(),_(e=>!e)},className:"w-full flex items-center justify-between gap-2 px-2.5 py-1.5 rounded-md text-[12px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:[(0,r.jsx)("span",{className:"truncate",children:q}),(0,r.jsx)(k,{})]}),I&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>_(!1)}),(0,r.jsxs)("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-bg-elevated border border-border rounded-lg shadow-xl py-1 max-h-60 overflow-y-auto",children:[(0,r.jsx)("button",{onClick:()=>H("__all__"),className:"w-full text-left px-3 py-1.5 text-[12px] transition-colors ".concat("__all__"===A?"text-text bg-bg-active":"text-text-secondary hover:bg-bg-hover hover:text-text"),children:"All projects"}),(0,r.jsx)("div",{className:"h-px bg-border mx-2 my-1"}),L.map(e=>{let t=h[e.path]||0;return(0,r.jsxs)("button",{onClick:()=>H(e.path),className:"w-full text-left px-3 py-1.5 text-[12px] transition-colors flex items-center gap-2 ".concat(A===e.path?"text-text bg-bg-active":"text-text-secondary hover:bg-bg-hover hover:text-text"),children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"truncate",children:e.name}),t>0&&(0,r.jsx)("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-success"})]}),(0,r.jsx)("span",{className:"block text-[10px] text-text-muted font-mono truncate",children:e.path})]}),(0,r.jsx)("span",{onClick:t=>O(t,e.path),className:"shrink-0 p-0.5 rounded hover:bg-bg-active transition-colors ".concat(D.includes(e.path)?"text-text-secondary":"text-text-muted/30 hover:text-text-muted"),role:"button","aria-label":D.includes(e.path)?"Unstar project":"Star project",children:(0,r.jsx)(ew,{size:12,filled:D.includes(e.path)})})]},e.key)})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("button",{onClick:()=>{P.tap(),j(e=>!e)},"aria-pressed":v,className:"flex-1 flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[12px] transition-colors ".concat(v?"text-text bg-bg-active":"text-text-muted hover:text-text-secondary hover:bg-bg-hover"),children:[(0,r.jsx)(eb,{}),v?"Archived":"Archive"]}),!v&&m.length>0&&(0,r.jsx)("button",{onClick:()=>{P.warn();let e="__all__"===A?void 0:A||void 0;(0,o.n)("/api/sessions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"archive_all",workspace:e})}).then(()=>U()).catch(()=>E("Failed to archive sessions"))},title:"Archive all visible sessions",className:"px-2 py-1.5 rounded-md text-[10px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors whitespace-nowrap",children:"Archive all"})]})]}),(0,r.jsxs)("div",{className:"overflow-y-auto flex-1 px-2 pb-2",children:[S&&(0,r.jsx)("div",{className:"mx-1 mb-2 px-2.5 py-2 rounded-md bg-error/10 text-error text-[11px]",children:S}),g?(0,r.jsx)("div",{className:"flex items-center gap-2 justify-center py-8 text-text-muted text-[12px]",children:(0,r.jsx)(F,{})}):0!==m.length||S?m.map(e=>{let t=u[e.id];return(0,r.jsx)(eN,{session:e,children:(0,r.jsxs)("div",{className:"relative mb-px",children:[(0,r.jsxs)("button",{onClick:()=>{P.select(),c(e.id,e.workspace),l()},"aria-current":e.id===i?"true":void 0,className:"group w-full text-left px-2.5 py-2 rounded-md transition-colors ".concat(e.id===i?"bg-bg-active text-text":"hover:bg-bg-hover text-text-secondary"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0 pr-12",children:[t&&(0,r.jsx)(eg,{status:t}),(0,r.jsx)("p",{className:"text-[12px] truncate",children:e.title})]}),(0,r.jsx)("span",{className:"text-[10px] text-text-muted shrink-0",children:f(e.updatedAt)})]}),"__all__"===A&&(0,r.jsx)("p",{className:"text-[10px] text-text-muted mt-0.5 font-mono truncate",children:e.workspace.split("/").pop()})]}),y===e.id?(0,r.jsxs)("div",{className:"absolute top-1 right-1 flex items-center gap-1",children:[(0,r.jsx)("button",{onClick:t=>J(t,e.id),className:"px-2 py-1 rounded text-[10px] font-medium bg-error/15 text-error hover:bg-error/25 transition-colors",children:"Delete"}),(0,r.jsx)("button",{onClick:V,"aria-label":"Cancel delete",className:"p-1 rounded text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:(0,r.jsx)(N,{size:10})})]}):(0,r.jsxs)("div",{className:"absolute top-1 right-1 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-all",children:[(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),P.tap(),(0,o.n)("/api/sessions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:v?"unarchive":"archive",sessionId:e.id,workspace:e.workspace})}).then(()=>U()).catch(()=>E("Failed to update session"))},"aria-label":v?"Unarchive session":"Archive session",className:"p-1.5 rounded hover:bg-bg-surface text-text-muted hover:text-text-secondary transition-colors",children:v?(0,r.jsx)(ev,{}):(0,r.jsx)(eb,{})}),(0,r.jsx)("button",{onClick:t=>J(t,e.id),"aria-label":"Delete session",className:"p-1.5 rounded hover:bg-bg-surface text-text-muted hover:text-error transition-colors",children:(0,r.jsx)(R,{})})]})]})},e.id)}):(0,r.jsx)("p",{className:"text-text-muted text-[12px] text-center py-8",children:v?"No archived sessions":"No sessions"})]})]})]})}let eS={trust:!0,sound:!0,pwa_prompt:!0,default_model:"auto",webhook_url:""},eE={trust:{label:"Workspace trust",description:"Allow the agent to execute code and edit files without asking"},sound:{label:"Sound effects",description:"Play sounds on completion and errors"},pwa_prompt:{label:"Suggest PWA install",description:"Show the install-as-app prompt on page load"}},eL=Object.keys(eE);function eR(e){var t;let{open:s,onClose:l,onDefaultModelChange:i}=e,[c,d]=(0,n.useState)(eS),[x,u]=(0,n.useState)(!0),[h,m]=(0,n.useState)([]),[p,f]=(0,n.useState)(!1),[g,b]=(0,n.useState)(!1),[v,j]=(0,n.useState)("idle"),y=(0,n.useRef)(null),w=a();(0,n.useEffect)(()=>{if(!s)return;let e=!1;return u(!0),Promise.all([(0,o.n)("/api/settings").then(e=>e.json()),(0,o.n)("/api/models").then(e=>e.json())]).then(t=>{var s;let[r,n]=t;!e&&(d({...eS,...r.settings}),(null==(s=n.models)?void 0:s.length)>0&&m(n.models))}).catch(()=>{}).finally(()=>{e||u(!1)}),()=>{e=!0}},[s]);let C=(0,n.useCallback)(e=>{w.tap(),d(t=>{let s={...t,[e]:!t[e]};return(0,o.n)("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[e]:s[e]})}).catch(()=>{d(t)}),s})},[w]),E=(0,n.useCallback)(e=>{w.select(),d(t=>{let s={...t,default_model:e};return(0,o.n)("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({default_model:e})}).catch(()=>{d(t)}),s}),null==i||i(e),f(!1)},[i,w]),L=(0,n.useCallback)(async()=>{w.warn();try{if("serviceWorker"in navigator){let e=await navigator.serviceWorker.getRegistrations();await Promise.all(e.map(e=>e.unregister()))}if("undefined"!=typeof caches){let e=await caches.keys();await Promise.all(e.map(e=>caches.delete(e)))}b(!0),setTimeout(()=>b(!1),2e3)}catch(e){}},[w]),R=(0,n.useCallback)(e=>{d(t=>({...t,webhook_url:e})),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{(0,o.n)("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({webhook_url:e})}).catch(()=>{})},500)},[]),T=(0,n.useCallback)(async()=>{w.tap(),j("sending");try{if(!(await (0,o.n)("/api/notifications/test",{method:"POST"})).ok)throw Error();j("ok")}catch(e){j("error")}setTimeout(()=>j("idle"),2500)},[w]),W=(null==(t=h.find(e=>e.id===c.default_model))?void 0:t.label)||c.default_model;return(0,r.jsxs)(r.Fragment,{children:[s&&(0,r.jsx)("div",{className:"fixed inset-0 z-40 bg-black/60","aria-hidden":"true",onClick:l}),(0,r.jsxs)("div",{role:"dialog","aria-label":"Settings","aria-hidden":!s,className:"fixed inset-0 z-50 bg-bg-elevated transform transition-transform duration-150 flex flex-col sm:inset-auto sm:top-0 sm:right-0 sm:h-full sm:w-[300px] sm:border-l sm:border-border ".concat(s?"translate-x-0":"translate-x-full"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between h-11 px-3 border-b border-border shrink-0",children:[(0,r.jsx)("span",{className:"text-[13px] font-medium text-text-secondary",children:"Settings"}),(0,r.jsx)("button",{onClick:l,"aria-label":"Close settings",className:"p-1 rounded-md hover:bg-bg-hover text-text-muted hover:text-text-secondary transition-colors",children:(0,r.jsx)(N,{size:14})})]}),(0,r.jsx)("div",{className:"overflow-y-auto flex-1 p-3 space-y-1",children:x?(0,r.jsx)("div",{className:"flex justify-center py-8",children:(0,r.jsx)("span",{className:"inline-block w-3 h-3 rounded-full border-2 border-text-muted border-t-transparent animate-spin"})}):(0,r.jsxs)(r.Fragment,{children:[eL.map(e=>(0,r.jsxs)("button",{onClick:()=>C(e),className:"w-full flex items-center justify-between gap-3 px-3 py-2.5 rounded-md hover:bg-bg-hover transition-colors text-left",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"text-[12px] text-text",children:eE[e].label}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 leading-tight",children:eE[e].description})]}),(0,r.jsx)("div",{className:"shrink-0 w-8 h-[18px] rounded-full transition-colors relative ".concat(c[e]?"bg-success":"bg-bg-active"),children:(0,r.jsx)("div",{className:"absolute top-[2px] w-[14px] h-[14px] rounded-full bg-white transition-transform ".concat(c[e]?"translate-x-[16px]":"translate-x-[2px]")})})]},e)),(0,r.jsxs)("div",{className:"pt-3 mt-2 border-t border-border",children:[(0,r.jsxs)("div",{className:"px-3 py-2",children:[(0,r.jsx)("p",{className:"text-[12px] text-text",children:"Default model"}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 leading-tight",children:"Model used for new sessions"})]}),(0,r.jsxs)("div",{className:"relative px-3",children:[(0,r.jsxs)("button",{onClick:()=>f(e=>!e),className:"w-full flex items-center justify-between gap-2 px-3 py-2 rounded-md bg-bg-surface border border-border text-[12px] text-text hover:bg-bg-hover transition-colors",children:[(0,r.jsx)("span",{className:"truncate",children:W}),(0,r.jsx)(k,{})]}),p&&h.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>f(!1)}),(0,r.jsx)("div",{className:"absolute left-3 right-3 top-full mt-1 z-50 bg-bg-elevated border border-border rounded-lg shadow-xl py-1 max-h-60 overflow-y-auto",children:h.map(e=>(0,r.jsx)("button",{onClick:()=>E(e.id),className:"w-full text-left px-3 py-1.5 text-[12px] transition-colors ".concat(c.default_model===e.id?"text-text bg-bg-active":"text-text-secondary hover:bg-bg-hover hover:text-text"),children:e.label},e.id))})]})]})]}),(0,r.jsxs)("div",{className:"pt-3 mt-2 border-t border-border",children:[(0,r.jsxs)("div",{className:"px-3 py-2",children:[(0,r.jsx)("p",{className:"text-[12px] text-text",children:"Webhook notifications"}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 leading-tight",children:"Get notified when the agent finishes via any webhook"})]}),(0,r.jsxs)("div",{className:"px-3 space-y-2",children:[(0,r.jsx)("input",{type:"url",value:c.webhook_url,onChange:e=>R(e.target.value),placeholder:"https://hooks.slack.com/...",className:"w-full px-3 py-2 rounded-md bg-bg-surface border border-border text-[12px] text-text placeholder:text-text-muted/50 focus:outline-none focus:border-text-muted transition-colors","aria-label":"Webhook URL"}),(0,r.jsxs)("button",{onClick:T,disabled:!c.webhook_url||"sending"===v,className:"w-full flex items-center justify-center gap-1.5 px-3 py-2 rounded-md bg-bg-surface border border-border text-[12px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:["sending"===v&&(0,r.jsx)("span",{className:"inline-block w-3 h-3 rounded-full border-2 border-text-muted border-t-transparent animate-spin"}),"ok"===v&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S,{size:12})," Sent!"]}),"error"===v&&"Failed to send","idle"===v&&"Send test","sending"===v&&"Sending..."]}),(0,r.jsx)("p",{className:"text-[10px] text-text-muted/60 leading-tight px-0.5",children:"Paste a Slack, Discord, or custom webhook URL to receive push notifications when the agent completes"})]})]}),(0,r.jsxs)("div",{className:"pt-3 mt-2 border-t border-border",children:[(0,r.jsxs)("div",{className:"px-3 py-2",children:[(0,r.jsx)("p",{className:"text-[12px] text-text",children:"Cache"}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted mt-0.5 leading-tight",children:"Clear cached data if the app feels stale"})]}),(0,r.jsx)("div",{className:"px-3",children:(0,r.jsx)("button",{onClick:L,className:"w-full flex items-center justify-center gap-1.5 px-3 py-2 rounded-md bg-bg-surface border border-border text-[12px] text-text-muted hover:text-text-secondary hover:bg-bg-hover transition-colors",children:g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S,{size:12}),"Cache cleared"]}):"Clear cache"})})]})]})})]})]})}var eT=s(2834);function eW(e){let{open:t,onClose:s}=e,[l,i]=(0,n.useState)(null),[c,d]=(0,n.useState)(null),x=a();return((0,n.useEffect)(()=>{if(!t)return;let e=!1;return(0,o.n)("/api/info").then(e=>e.json()).then(t=>{e||i(t)}).catch(()=>{e||d("Could not load network info")}),()=>{e=!0,i(null),d(null)}},[t]),t)?(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:s,children:(0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Connect device via QR code",className:"bg-bg-elevated border border-border rounded-xl p-6 max-w-xs w-full mx-4 text-center",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("p",{className:"text-[13px] font-medium text-text mb-1",children:"Connect device"}),(0,r.jsx)("p",{className:"text-[12px] text-text-muted mb-5",children:"Scan from any device on your network"}),l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"bg-white rounded-lg p-3 inline-block mb-3",children:(0,r.jsx)(eT.h,{value:l.authUrl,size:180})}),(0,r.jsx)("p",{className:"font-mono text-[12px] text-text-secondary",children:l.url})]}):c?(0,r.jsx)("div",{className:"py-10 text-error text-[12px]",children:c}):(0,r.jsx)("div",{className:"py-10 text-text-muted text-[12px]",children:(0,r.jsx)(F,{className:"w-3.5 h-3.5"})}),(0,r.jsx)("button",{onClick:()=>{x.tap(),s()},className:"mt-4 w-full py-1.5 rounded-lg text-[12px] text-text-muted hover:text-text-secondary transition-colors",children:"Close"})]})}):null}var eA=s(5932);function ez(e,t){return{id:i(),sessionId:null,label:e?"Loading...":"New chat",isStreaming:!1,initialSessionId:e,initialWorkspace:t}}function eF(){var e,t;let[s,l]=(0,n.useState)(()=>{let{sessionId:e,workspace:t}=function(){var e;let t=window.location.hash,s=t.match(/session=([a-f0-9-]+)/i),r=t.match(/workspace=([^&]+)/);return{sessionId:null!=(e=null==s?void 0:s[1])?e:null,workspace:r?decodeURIComponent(r[1]):null}}();return[ez(null!=e?e:void 0,null!=t?t:void 0)]}),[i,x]=(0,n.useState)(()=>s[0].id),[u,h]=(0,n.useState)(!1),[m,p]=(0,n.useState)(!1),[f,g]=(0,n.useState)(!1),[b,v]=(0,n.useState)("auto"),j=a(),y=(0,n.useRef)(!1),w=(0,n.useRef)(!1);(0,n.useEffect)(()=>{window.location.hash.includes("session=")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),(0,n.useEffect)(()=>{w.current||(w.current=!0,(0,o.n)("/api/settings").then(e=>e.json()).then(e=>{var t;(null==(t=e.settings)?void 0:t.default_model)&&v(e.settings.default_model)}).catch(()=>{}))},[]),(0,n.useEffect)(()=>{y.current||(y.current=!0,d().then(e=>{0!==e.length&&l(t=>{let s=[...t],r=null;for(let t=0;t<e.length;t++){let n=e[t];if(s.some(e=>e.initialSessionId===n||e.sessionId===n))continue;let l=ez(n);0!==t||1!==s.length||s[0].sessionId||s[0].isStreaming?(s.push(l),r||(r=l.id)):(s[0]=l,r=l.id)}if(r){let e=r;setTimeout(()=>x(e),0)}return s})}))},[]);let k=(0,n.useMemo)(()=>{let e={};for(let t of s)t.sessionId&&(e[t.sessionId]=t.isStreaming?"streaming":"idle");return e},[s]),N=(0,n.useCallback)(e=>{j.tap();let t=s.find(e=>e.id===i);if(t&&!t.sessionId&&!t.isStreaming){if(e&&t.initialWorkspace!==e){let t=ez(void 0,e);l(e=>e.map(e=>e.id===i?t:e)),x(t.id)}return}let r=ez(void 0,e);l(e=>[...e,r]),x(r.id)},[j,s,i]),C=(0,n.useCallback)((e,t)=>{c("workspace","handleSelectSession",{sessionId:e,workspace:t,activeId:i,instanceCount:s.length});let r=s.find(t=>t.sessionId===e);if(r){c("workspace","handleSelectSession: found existing instance",{instanceId:r.id,sessionId:e}),x(r.id);return}let n=ez(e,t),a=s.find(e=>e.id===i);!a||a.sessionId||a.isStreaming?(c("workspace","handleSelectSession: adding new instance",{newId:n.id,sessionId:e,currentHasSession:!!(null==a?void 0:a.sessionId),currentStreaming:null==a?void 0:a.isStreaming}),l(e=>[...e,n])):(c("workspace","handleSelectSession: replacing empty instance",{replacedId:a.id,newId:n.id,sessionId:e}),l(e=>e.map(e=>e.id===i?n:e))),x(n.id)},[s,i]),S=(0,n.useCallback)((e,t)=>{l(s=>{let r=s.find(t=>t.id===e);return r&&r.label!==t?s.map(s=>s.id===e?{...s,label:t}:s):s})},[]),E=(0,n.useCallback)((e,t)=>{l(s=>{let r=s.find(t=>t.id===e);return r&&r.isStreaming!==t?s.map(s=>s.id===e?{...s,isStreaming:t}:s):s})},[]),L=(0,n.useCallback)((e,t)=>{l(s=>{let r=s.find(t=>t.id===e);return r&&r.sessionId!==t?s.map(s=>s.id===e?{...s,sessionId:t}:s):s})},[]),R=(0,n.useCallback)(e=>{let t=null!=e?e:void 0;l(e=>{let s=e.find(e=>e.id===i);return!s||s.sessionId||s.isStreaming||s.initialWorkspace===t?e:e.map(e=>e.id===i?{...e,initialWorkspace:t}:e)})},[i]),[T,W]=(0,n.useState)({});(0,n.useEffect)(()=>{let e=()=>{(0,o.n)("/api/terminal").then(e=>e.json()).then(e=>{let t=e.terminals||[],s={};for(let e of t)e.running&&(s[e.cwd]=(s[e.cwd]||0)+1);W(s)}).catch(()=>{})};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[]);let A=null!=(t=null==(e=s.find(e=>e.id===i))?void 0:e.sessionId)?t:null;return(0,r.jsxs)("div",{className:"h-dvh",children:[s.map(e=>(0,r.jsx)("div",{className:e.id===i?"h-full":"hidden",children:(0,r.jsx)(eA.ErrorBoundary,{fallback:"inline",children:(0,r.jsx)(ef,{initialSessionId:e.initialSessionId,initialWorkspace:e.initialWorkspace,defaultModel:b,onLabelChange:t=>S(e.id,t),onStreamingChange:t=>E(e.id,t),onSessionIdChange:t=>L(e.id,t),onSelectSession:C,onOpenSidebar:()=>h(!0),onOpenSettings:()=>p(!0),onOpenQr:()=>g(!0)})})},e.id)),(0,r.jsx)(eC,{open:u,onClose:()=>h(!1),currentSessionId:A,onSelectSession:C,onNewSession:N,onWorkspaceChange:R,activeStatuses:k,workspaceTerminals:T}),(0,r.jsx)(eR,{open:m,onClose:()=>p(!1),onDefaultModelChange:v}),(0,r.jsx)(eW,{open:f,onClose:()=>g(!1)})]})}},5932:(e,t,s)=>{"use strict";s.d(t,{ErrorBoundary:()=>l});var r=s(5155),n=s(2115);class l extends n.Component{static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("Uncaught render error:",e,t.componentStack)}render(){return this.state.error?"inline"===this.props.fallback?(0,r.jsx)("div",{className:"h-full flex items-center justify-center px-6",children:(0,r.jsxs)("div",{className:"text-center max-w-sm",children:[(0,r.jsx)("p",{className:"text-[13px] font-medium text-text mb-2",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-[11px] text-text-muted mb-3 font-mono break-all",children:this.state.error.message}),(0,r.jsx)("button",{onClick:()=>this.setState({error:null}),className:"px-3 py-1 rounded-lg text-[12px] font-medium bg-bg-surface text-text border border-border hover:bg-bg-hover transition-colors",children:"Try again"})]})}):(0,r.jsx)("div",{className:"h-dvh flex items-center justify-center bg-[#0a0a0b] px-6",children:(0,r.jsxs)("div",{className:"text-center max-w-sm",children:[(0,r.jsx)("p",{className:"text-[14px] font-medium text-[#e8e8e8] mb-2",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-[12px] text-[#888] mb-4 font-mono break-all",children:this.state.error.message}),(0,r.jsx)("button",{onClick:()=>this.setState({error:null}),className:"px-4 py-1.5 rounded-lg text-[12px] font-medium bg-[#1c1c1c] text-[#e8e8e8] border border-[#2a2a2a] hover:bg-[#252525] transition-colors",children:"Try again"})]})}):this.props.children}constructor(...e){super(...e),this.state={error:null}}}}},e=>{e.O(0,[32,687,441,255,358],()=>e(e.s=2673)),_N_E=e.O()}]);
|