offsite 0.0.61 → 0.0.63

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.
@@ -17,5 +17,5 @@ Error generating stack: `+e.message+`
17
17
  `)}function pF(e){let t=fF(e).trimEnd().split(/\r?\n/).map(e=>e.trimEnd()),n=[],r=0,i=!1;for(let e of t){let t=e.trim()!==``;if(t&&r>=10){i=!0;break}n.push(e),t&&(r+=1)}for(;n.length>0&&n.at(-1)?.trim()===``;)n.pop();return n.length===0?dF(e)??`Plan preview unavailable.`:(i&&n.push(``,`...`),n.join(`
18
18
  `))}function mF(e){let t=e.toLowerCase().replace(/[`'".,!?()[\]{}]+/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t===``?`plan`:t}function hF(e){let t=e.item.answers;return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 text-sm leading-6 select-text`,children:[e.item.questions.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-foreground font-medium`,children:e.question}),(0,U.jsx)(`ul`,{className:`text-secondary-label list-disc pl-5`,children:e.options.map(e=>(0,U.jsxs)(`li`,{children:[e.label,e.description!==``&&` — ${e.description}`]},e.label))}),t?.[e.question]!==void 0&&(0,U.jsxs)(`p`,{className:`text-foreground whitespace-pre-wrap`,children:[`Answer: `,t[e.question]]})]},e.question)),e.item.status===`failed`&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`Skipped`})]})}function gF(e){return e.kind===`group`||e.kind===`agent`}function _F(e,t){let n=[],r=e.prompt?.id??`start`;e.prompt!==null&&n.push({kind:`user`,key:e.prompt.id,item:e.prompt,first:e.first});for(let r of e.items){let e=vF(r,t!==null),i=n.at(-1);e?.kind===`group`&&i?.kind===`group`?i.entries.push(...e.entries):e!==null&&n.push(e)}let i=n.at(-1);return t!==null&&t.partial===``&&i?.kind===`group`&&(n[n.length-1]={...i,live:!0}),t!==null&&t.partial!==``&&n.push({kind:`assistant`,key:`${r}:partial`,message:``,text:t.partial,time:null,streaming:!0,meta:!1}),t!==null&&t.partial===``&&n.push({kind:`working`,key:`${r}:working`}),t===null&&i?.kind===`assistant`&&(n[n.length-1]={...i,meta:!0}),n}function vF(e,t){switch(e.kind){case`assistant`:return{kind:`assistant`,key:e.id,message:e.message,text:e.text,time:e.time,streaming:!1,meta:!1};case`reasoning`:case`file_change`:case`web_search`:case`skill`:case`tool`:return{kind:`group`,key:`group:${e.id}`,entries:[e],live:!1};case`command`:return e.background===null?{kind:`group`,key:`group:${e.id}`,entries:[e],live:!1}:{kind:`agent`,key:e.id,item:e,live:t};case`subagent`:case`agent_message`:return{kind:`agent`,key:e.id,item:e,live:t};case`plan`:return{kind:`plan`,key:e.id,plan:e.plan};case`question`:return{kind:`question`,key:e.id,item:e};case`notice`:return{kind:`notice`,key:e.id,text:e.text};case`compaction`:return{kind:`notice`,key:e.id,text:`Conversation compacted`};case`error`:return{kind:`error`,key:e.id,text:e.text,time:e.time};case`user`:case`todo_list`:return null}}function yF(e,t,n){let r=[],i=!1;for(let t of e)t.parent===null&&(t.kind===`user`?r.push({prompt:t,first:!i,items:[]}):(t.kind!==`notice`&&t.kind!==`error`&&t.kind!==`compaction`&&(i=!0),r.length===0&&r.push({prompt:null,first:!0,items:[]}),r[r.length-1].items.push(t)));let a=r.flatMap((e,i)=>_F(e,t&&i===r.length-1?{partial:n}:null));return t&&r.length===0&&a.push({kind:`working`,key:`working`}),a}var bF={all:{label:`Restore code and chat`,description:`This will undo file changes made since this message and remove this message and everything after it from the chat.`,icon:Va,code:!0,conversation:!0},chat:{label:`Restore chat`,description:`This will remove this message and everything after it from the chat. Files will not change.`,icon:Ka,code:!1,conversation:!0},code:{label:`Restore code`,description:`This will undo file changes made since this message. The chat will not change.`,icon:Ht,code:!0,conversation:!1}};function xF(e){if(e===`claude`)return[`all`,`chat`,`code`];if(e===`opencode`)return[`all`,`chat`];if(e===`codex`)return[`chat`];throw Error(`unknown provider ${e}`)}function SF(e){let[t,n]=(0,H.useState)(!1),[r,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=e.target,p=f.messageId,m=L(e=>e.selection),h=L(e=>e.settings.provider),g=xF(h),_=L(e=>e.prefs.rewind),v=g.includes(_)?_:`chat`,y=m?.machine??null,b=m?.sessionId??null,x=m?.projectId??``,S=L(e=>y===null?``:pt(e,y,x)?.path??``);(0,H.useEffect)(()=>{if(a(null),s(null),!t||y===null||b===null)return;let e=!0;return M(y,`sessions.rewind`,{sessionId:b,projectId:x,messageId:p,settings:I().settings,code:!0,conversation:!1,dryRun:!0}).then(t=>{e&&a(t)},t=>{e&&s(kt(t))}),()=>{e=!1}},[t,p,y,b,x]);async function C(e){if(y===null||b===null)return;let{code:t,conversation:r}=bF[e];l(!0);try{let a=r?await Promise.all(f.images.map((e,t)=>e.data===null?M(y,`sessions.image`,{sessionId:b,itemId:f.messageId,index:t}):{mediaType:e.mediaType,data:e.data})):[],o=r&&(!f.first||h===`opencode`);(t||o)&&await M(y,`sessions.rewind`,{sessionId:b,projectId:x,messageId:f.messageId,settings:I().settings,code:t,conversation:o,dryRun:!1}),r&&f.first&&h!==`opencode`&&Ue({machine:y,projectId:x,sessionId:null}),r&&oe({text:f.text,images:a}),i({...I().prefs,rewind:e}),n(!1)}catch(e){ht(e)}finally{l(!1)}}let w=r!==null&&o===null;return(0,U.jsxs)(U.Fragment,{children:[g.length>1&&(0,U.jsxs)($t,{open:t,onOpenChange:e=>{c||n(e)},children:[(0,U.jsx)(yr,{label:`Restore options`,children:(0,U.jsx)(dn,{asChild:!0,children:(0,U.jsx)(V,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Restore options`,disabled:e.disabled,children:(0,U.jsx)(B,{icon:zn,className:`size-3.5`})})})}),(0,U.jsxs)(nn,{align:`end`,className:`w-72`,children:[(0,U.jsxs)(`div`,{className:`text-muted-foreground px-2 py-1.5 text-xs`,children:[o!==null&&`Code can't be restored: ${o}`,o===null&&r===null&&`Checking file changes…`,r!==null&&r.files.length===0&&`No file changes since this message.`,r!==null&&r.files.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{children:[`Restores `,r.files.length,` `,r.files.length===1?`file`:`files`,` (`,(0,U.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,r.insertions]}),` `,(0,U.jsxs)(`span`,{className:`text-diff-deletion`,children:[`−`,r.deletions]}),`)`]}),(0,U.jsx)(`ul`,{className:`mt-1 max-h-24 overflow-y-auto font-mono`,children:r.files.map(e=>(0,U.jsx)(`li`,{className:`truncate`,children:ad(e,S)},e))})]})]}),(0,U.jsx)(Ut,{}),g.map(e=>(0,U.jsxs)(Kt,{disabled:c||bF[e].code&&!w,onSelect:()=>d(e),children:[(0,U.jsx)(B,{icon:bF[e].icon}),bF[e].label]},e))]})]}),(0,U.jsx)(yr,{label:bF[v].label,children:(0,U.jsx)(V,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,"aria-label":bF[v].label,disabled:e.disabled||c,onClick:()=>d(v),children:(0,U.jsx)(B,{icon:bF[v].icon,className:`size-3.5`})})}),(0,U.jsx)(Sn,{open:u!==null,onOpenChange:e=>{e||d(null)},children:u!==null&&(0,U.jsxs)(In,{children:[(0,U.jsxs)(hn,{children:[(0,U.jsxs)(Qn,{children:[bF[u].label,`?`]}),(0,U.jsxs)(kn,{children:[bF[u].description,` Do you really want to continue?`]})]}),(0,U.jsxs)(Dn,{children:[(0,U.jsx)(Hn,{children:`Cancel`}),(0,U.jsx)(Tn,{variant:`destructive`,onClick:()=>void C(u),children:bF[u].label})]})]})})]})}var CF=20,wF=`linear-gradient(to bottom, black calc(100% - 1.75rem), transparent)`,TF=new Map;function EF(e){let[t,n]=(0,H.useState)(!1),r=e.item,i=r.format===`text`||r.format===`command`?r.text:``,a=i.trim()!==``&&(i.length>600||i.split(`
19
19
  `).length>8),o=a&&!t;return(0,U.jsxs)(`div`,{className:`group flex flex-col items-end gap-1`,children:[(0,U.jsxs)(`div`,{className:`bg-message text-message-foreground relative max-w-[80%] rounded-2xl px-3 py-2`,children:[r.images.length>0&&(0,U.jsx)(`div`,{className:`mb-2 grid max-w-[210px] grid-cols-2 gap-2`,children:r.images.map((e,t)=>(0,U.jsx)(`div`,{className:`border-border/80 bg-background/70 aspect-[4/3] overflow-hidden rounded-lg border`,children:(0,U.jsx)(OF,{itemId:r.id,index:t,mediaType:e.mediaType,data:e.data})},t))}),r.text!==``&&(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:R(`relative`,o&&`max-h-44 overflow-hidden`),style:o?{WebkitMaskImage:wF,maskImage:wF}:void 0,children:[r.format===`command`&&(0,U.jsx)(`span`,{className:`font-mono text-sm`,children:r.text}),r.format===`output`&&(0,U.jsx)(`pre`,{className:`text-muted-foreground font-mono text-xs whitespace-pre-wrap`,children:r.text}),r.format===`text`&&(0,U.jsx)(z,{text:r.text,className:`text-foreground`,lineBreaks:!0,rawHtml:!1})]}),a&&(0,U.jsx)(`div`,{className:`mt-1.5 flex items-center justify-end gap-2`,children:(0,U.jsx)(V,{type:`button`,size:`xs`,variant:`ghost-muted`,"aria-expanded":t,className:`-ml-1`,onClick:()=>n(!t),children:t?`Show less`:`Show full message`})})]})]}),(0,U.jsx)(`div`,{className:`flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover:opacity-100 focus-within:opacity-100 has-aria-expanded:opacity-100 pointer-coarse:opacity-100`,children:(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r.time!==null&&(0,U.jsx)(yr,{label:ir(r.time),children:(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:gn(r.time)})}),i!==``&&(0,U.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[e.rewind&&(0,U.jsx)(SF,{target:{messageId:r.id,text:i,images:r.images,first:e.first},disabled:e.running}),(0,U.jsx)(DF,{text:i})]})]})})]})}function DF(e){let t=tn();return(0,U.jsx)(yr,{label:`Copy message`,children:(0,U.jsx)(V,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Copy message`,disabled:t.copied,onClick:()=>void t.copy(e.text),children:(0,U.jsx)(B,{icon:t.copied?Zn:Vn,className:R(`size-3.5`,t.copied&&`text-primary`)})})})}function OF(e){let t=L(e=>e.selection),n=t?.machine??null,r=t?.sessionId??null,[i,a]=(0,H.useState)(null);(0,H.useEffect)(()=>{if(e.data!==null||n===null||r===null)return;let t=!0,i=JSON.stringify([n,r,e.itemId,e.index]),o=TF.get(i);if(o===void 0){if(o=M(n,`sessions.image`,{sessionId:r,itemId:e.itemId,index:e.index}),TF.set(i,o),TF.size>CF){let[e]=TF.keys();TF.delete(e)}o.catch(()=>TF.delete(i))}return o.then(e=>{t&&a(e.data)}).catch(ht),()=>{t=!1}},[e.data,e.itemId,e.index,n,r]);let o=e.data??i;return o===null?null:(0,U.jsx)(Nn,{src:`data:${e.mediaType};base64,${o}`,alt:``,name:`Image`,className:`block size-full`,imageClassName:`block size-full object-cover`})}function kF(e){switch(e.kind){case`command`:return`Shell`;case`file_change`:return`Edit`;case`web_search`:return e.url===null?`Web Search`:`Webfetch`;case`skill`:return`Skill`;case`tool`:return e.name}}function AF(e){let t=e.item,n=e.live&&t.status===`running`;if(t.status===`failed`)return(0,U.jsx)(IF,{title:kF(t),subtitle:LF(t,e.cwd),error:t.output});switch(t.kind){case`command`:return(0,U.jsx)(jF,{command:t.command,output:t.output,pending:n});case`file_change`:return(0,U.jsx)(PF,{items:[t],cwd:e.cwd,live:e.live});case`web_search`:{let e=t.url;return e===null?(0,U.jsx)(MF,{query:t.query??``,links:t.results,pending:n}):(0,U.jsx)(eF,{title:`Webfetch`,subtitle:(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary hover:underline hover:underline-offset-2`,children:e}),pending:n,grouped:!0,open:!1,onToggle:null})}case`skill`:return(0,U.jsxs)(`div`,{className:`flex min-h-7 items-center gap-1 text-[13px] leading-4 tracking-[-0.04px]`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Loaded`}),(0,U.jsx)(`span`,{className:`text-foreground`,children:(0,U.jsx)(ZP,{text:t.skill,active:n})}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`skill`})]});case`tool`:{let r=t.input;switch(ed(t.name)){case`read`:return(0,U.jsx)(eF,{title:`Read`,subtitle:zF(q(r)),args:RF(r,[`offset`,`limit`]),pending:n,grouped:!0,open:!1,onToggle:null});case`search`:return(0,U.jsx)(eF,{title:t.name,subtitle:LF(t,e.cwd),args:[...RF(r,[`pattern`]),...id(r.glob)===``?[]:[`include=${id(r.glob)}`]],pending:n,grouped:!0,open:!1,onToggle:null});case`other`:return(0,U.jsx)(eF,{title:`Called ${t.name}`,subtitle:LF(t,e.cwd),args:RF(r,Object.keys(r).filter(e=>![`description`,`query`,`url`,`path`,`pattern`].includes(e))).slice(0,3),pending:n,grouped:!0,open:!1,onToggle:null})}}}}function jF(e){let[t,n]=(0,H.useState)(!1);return(0,U.jsx)(eF,{title:`Shell`,subtitle:t?void 0:e.command,pending:e.pending,grouped:!0,open:t,onToggle:()=>n(!t),rail:!1,children:(0,U.jsxs)(`div`,{dir:`ltr`,className:`group/output border-border relative w-full overflow-hidden rounded-md border`,children:[(0,U.jsx)(`div`,{className:`absolute top-1 right-1 opacity-0 transition-opacity group-hover/output:opacity-100 focus-within:opacity-100`,children:(0,U.jsx)(DF,{text:e.command})}),(0,U.jsx)(`div`,{className:`max-h-60 [scrollbar-width:none] overflow-x-hidden overflow-y-auto`,children:(0,U.jsx)(`pre`,{className:`m-0 font-mono text-[13px] leading-5 tracking-[-0.04px] [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:(0,U.jsxs)(`code`,{children:[(0,U.jsx)(`span`,{className:`text-foreground block p-3`,children:e.command}),e.output!==``&&(0,U.jsx)(`span`,{className:`border-border bg-muted text-muted-foreground block border-t p-3`,children:e.output})]})})})]})})}function MF(e){let[t,n]=(0,H.useState)(!1),r=e.links;return(0,U.jsx)(eF,{title:`Web Search`,subtitle:e.query,pending:e.pending,grouped:!0,open:t,onToggle:r.length===0?null:()=>n(!t),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px] leading-5`,children:[r.slice(0,10).map(e=>(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary truncate hover:underline hover:underline-offset-2`,children:e.title===``?e.url:e.title},e.url)),r.length>10&&(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`+`,r.length-10,` more`]})]})})}function NF(e){let[t,n]=(0,H.useState)(!1);return(0,U.jsx)(eF,{title:e.streaming?`Thinking`:`Thought`,subtitle:e.streaming?BF(e.text):void 0,pending:e.streaming,grouped:!0,open:t,onToggle:()=>n(!t),children:(0,U.jsx)(z,{text:e.text,className:`text-muted-foreground text-[13px]`,lineBreaks:!0})})}function PF(e){let t=new Map;for(let n of e.items){let r=ad(n.path,e.cwd);t.set(r,[...t.get(r)??[],n])}return(0,U.jsx)(`div`,{className:`border-border overflow-hidden rounded-md border`,children:[...t].map(([t,n])=>(0,U.jsx)(FF,{file:t,items:n,pending:e.live&&n.some(e=>e.status===`running`)},t))})}function FF(e){let[t,n]=(0,H.useState)(!1),r=Math.max(e.file.lastIndexOf(`/`),e.file.lastIndexOf(`\\`)),i=0,a=0;for(let t of e.items){let e=td(t);i+=e.added,a+=e.removed}return(0,U.jsxs)(`div`,{className:`border-border border-b last:border-b-0`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`group/tool flex h-9 w-full cursor-pointer items-center gap-2 ps-3 pe-1 text-left text-[13px] leading-4 tracking-[-0.04px] select-none`,children:[(0,U.jsx)(jr,{path:e.file,className:`size-4 shrink-0`}),(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline`,children:[r>=0&&(0,U.jsx)(`span`,{className:`text-muted-foreground truncate`,children:e.file.slice(0,r+1)}),(0,U.jsx)(`span`,{className:`text-foreground shrink-0`,children:(0,U.jsx)(ZP,{text:e.file.slice(r+1),active:e.pending})})]}),(0,U.jsxs)(`span`,{role:`group`,"aria-label":`${i} additions, ${a} deletions`,className:`inline-flex items-center gap-1 align-middle font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{"aria-hidden":!0,className:`text-diff-addition`,children:[`+`,$n(i)]}),(0,U.jsxs)(`span`,{"aria-hidden":!0,className:`text-diff-deletion`,children:[`-`,$n(a)]})]}),(0,U.jsx)($P,{open:t})]}),t&&(0,U.jsx)(`div`,{className:`border-border flex flex-col gap-2 border-t p-2`,children:e.items.map(e=>(0,U.jsx)(Qu,{item:e},e.id))})]})}function IF(e){let[t,n]=(0,H.useState)(!1),r=e.error.replace(/<\/?tool_use_error>/g,``).trim(),i=r.split(`: `)[0].trim();return(0,U.jsxs)(`div`,{className:`group/error flex w-full min-w-0 flex-col`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(!t),className:`flex h-6 w-full cursor-pointer items-center text-left text-[13px] leading-4 tracking-[-0.04px] select-none`,children:[(0,U.jsxs)(`span`,{className:`flex max-w-[calc(100%-20px)] min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(B,{icon:Fa,className:`text-destructive size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:e.title}),e.subtitle!==``&&!t&&(0,U.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:e.subtitle}),!t&&(0,U.jsx)(`span`,{className:`text-destructive min-w-0 truncate`,children:i===``?`Failed`:i[0].toUpperCase()+i.slice(1)})]}),(0,U.jsx)($P,{open:!0,className:`ms-1.5 size-3.5`})]}),t&&(0,U.jsxs)(`div`,{className:`relative ps-6 pe-10 select-text`,children:[(0,U.jsx)(`div`,{className:`absolute top-0 right-0 opacity-0 transition-opacity group-hover/error:opacity-100 focus-within:opacity-100`,children:(0,U.jsx)(DF,{text:r})}),(0,U.jsx)(`p`,{className:`text-destructive text-[13px] leading-5 tracking-[-0.04px] [overflow-wrap:anywhere] whitespace-pre-wrap`,children:r})]})]})}function LF(e,t){switch(e.kind){case`command`:return e.command;case`file_change`:return e.path;case`web_search`:return e.url??e.query??``;case`skill`:return e.skill;case`tool`:{let n=e.input;if(ed(e.name)===`search`){let e=id(n.path);return e===``||e===t?``:ad(e,t)}return[`description`,`query`,`url`,`file_path`,`path`,`pattern`].map(e=>id(n[e])).find(e=>e!==``)??``}}}function RF(e,t){return t.flatMap(t=>{let n=e[t];return typeof n==`string`||typeof n==`number`||typeof n==`boolean`?[`${t}=${n}`]:[]})}function zF(e){return e.split(`/`).at(-1)??e}function BF(e){let t=[...e.matchAll(/^\s*(?:#{1,6}[ \t]+(.+?)|\*\*([^*\n]+)\*\*)\s*$/gm)].at(-1);return t===void 0?void 0:(t[1]??t[2]).trim()}var VF=new Intl.ListFormat(`en`,{style:`long`,type:`conjunction`});function HF(e){let t=e.entries.flatMap(e=>e.kind===`reasoning`?[]:[e]),n=e.entries.length-t.length,r=VF.format([...new Set(t.map(kF))]),i=r===``?n===1?`Thought`:`Thoughts`:r,a=t.length>0?t.length:n;return(0,U.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":e.open,"aria-label":`Used ${a} ${i}`,onClick:e.onToggle,className:R(`group/tool focus-visible:ring-ring/70 flex h-7 w-full cursor-pointer items-center rounded-md text-left text-xs select-none focus-visible:ring-2 focus-visible:outline-none`,e.open&&`bg-background sticky top-0 z-20 box-content pb-2`),children:[(0,U.jsxs)(`span`,{className:`flex max-w-[calc(100%-24px)] min-w-0 items-center gap-1`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`Used`}),(0,U.jsx)(`span`,{className:`text-muted-foreground shrink-0 tabular-nums`,children:a}),(0,U.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:i})]}),(0,U.jsx)($P,{open:e.open})]}),e.open&&(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:WF(e.entries).map(t=>(0,U.jsx)(`div`,{className:`flex min-h-7 min-w-0 flex-col justify-center`,children:(0,U.jsx)(UF,{item:t,cwd:e.cwd,live:e.live})},t.key))})]})}function UF(e){let t=e.item;switch(t.kind){case`thinking`:return(0,U.jsx)(NF,{text:t.text,streaming:e.live&&t.last});case`tool`:return(0,U.jsx)(AF,{item:t.item,cwd:e.cwd,live:e.live});case`reads`:return(0,U.jsx)(eF,{title:`Read`,subtitle:(0,U.jsx)(`span`,{title:t.items.map(e=>q(e.input)).join(`
20
- `),children:t.items.map((t,n)=>(0,U.jsxs)(`span`,{children:[n>0&&` `,(0,U.jsx)(ZP,{text:q(t.input).split(`/`).at(-1)??``,active:e.live&&t.status===`running`})]},t.id))}),pending:e.live&&t.items.some(e=>e.status===`running`),grouped:!0,open:!1,onToggle:null});case`files`:return(0,U.jsx)(PF,{items:t.items,cwd:e.cwd,live:e.live})}}function WF(e){let t=[];return e.forEach((n,r)=>{if(n.kind===`reasoning`){t.push({kind:`thinking`,key:n.id,text:n.text,last:r===e.length-1});return}let i=t.at(-1);n.status!==`failed`&&n.kind===`file_change`?i?.kind===`files`?i.items.push(n):t.push({kind:`files`,key:n.id,items:[n]}):n.status!==`failed`&&n.kind===`tool`&&ed(n.name)===`read`?i?.kind===`reads`?i.items.push(n):t.push({kind:`reads`,key:n.id,items:[n]}):t.push({kind:`tool`,key:n.id,item:n})}),t}var GF=30;function KF(e){let t=L(e=>e.selection),n=L(e=>e.loaded),r=L(e=>e.items),i=L(e=>e.earlier),a=L(e=>e.before),o=L(e=>e.partial),s=L(e=>e.requests),c=L(Ce),l=(0,H.useRef)(null),u=(0,H.useRef)(null),d=(0,H.useRef)(!0),f=(0,H.useRef)(null),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)([]),[_,v]=(0,H.useState)(null),y=L(e=>t===null?``:pt(e,t.machine,t.projectId)?.path??``),b=L(_t),x=L(e=>e.sentAt);(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&x!==0&&(d.current=!0,e.scrollTop=e.scrollHeight)},[x]),(0,H.useEffect)(()=>{let e=l.current;if(e===null||u.current===null)throw Error(`transcript is not mounted`);let t=new ResizeObserver(()=>{d.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e),t.observe(u.current),()=>t.disconnect()},[]),(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&d.current&&(e.scrollTop=e.scrollHeight)},[r,o,s,b]);let S=(0,H.useMemo)(()=>JP([...i,...r],c),[i,r,c]),C=yF(i,!1,``),w=[...C,...yF(r,b,o)],T=w.findIndex(e=>e.key===_?.key),E=Math.max(0,T===-1?w.length-GF:T-(_?.above??0));(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&f.current!==null&&(e.scrollTop=e.scrollHeight-f.current),f.current=null},[i,E]),(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&w.length!==0&&(T===-1?v({key:w[E].key,above:0}):D(e))});function D(e){E===0||e.scrollTop>=e.clientHeight||(f.current=e.scrollHeight-e.scrollTop,v({key:w[E].key,above:GF}))}let O=(0,H.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]);return(0,U.jsx)(`div`,{ref:l,className:`topbar-scroll-fade relative min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-8`,onScroll:e=>{let t=e.currentTarget;d.current=t.scrollHeight-t.scrollTop-t.clientHeight<40,D(t)},children:(0,U.jsx)(`div`,{ref:u,children:(0,U.jsxs)(Wu,{width:`chat`,className:`pt-3`,children:[!n&&(0,U.jsx)(`p`,{className:`text-muted-foreground py-6 text-center text-xs`,children:`Loading…`}),a!==null&&E===0&&(0,U.jsx)(`div`,{className:`flex justify-center pb-4`,children:(0,U.jsx)(V,{type:`button`,size:`xs`,variant:`ghost-muted`,disabled:p,onClick:async()=>{let e=l.current;e!==null&&(f.current=e.scrollHeight-e.scrollTop),v({key:w[0].key,above:GF}),m(!0),await st(),m(!1)},children:p?`Loading…`:`Load earlier conversation`})}),w.slice(E).map((t,n)=>{let r=E+n,i=w[r-1],a=r<C.length;return(0,U.jsx)(`div`,{className:R(i===void 0?void 0:t.kind===`user`?`pt-6`:t.kind===`working`?void 0:gF(t)&&gF(i)?`pt-2`:gF(t)||gF(i)?`pt-3`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,U.jsx)(YF,{row:t,agents:S.agents,tasks:S.tasks,running:b,compacting:c?.compacting===!0,fork:!a,expanded:h.includes(t.key),onToggle:O,onOpenTask:e.onOpenTask,rewind:!a,cwd:y})},t.key)})]})})})}var qF=(0,H.memo)(KF);function JF(e){let t=e.row;switch(t.kind){case`user`:return(0,U.jsx)(EF,{item:t.item,first:t.first,running:e.running,rewind:e.rewind});case`working`:return(0,U.jsx)(`div`,{className:`text-muted-foreground h-9 pt-3 text-[13px] leading-5 font-medium tracking-[-0.04px]`,children:(0,U.jsx)(ZP,{text:e.compacting?`Compacting conversation`:`Working`,active:!0})});case`group`:return(0,U.jsx)(HF,{entries:t.entries,cwd:e.cwd,live:t.live,open:e.expanded,onToggle:()=>e.onToggle(t.key)});case`agent`:return(0,U.jsx)(cF,{item:t.item,agents:e.agents,tasks:e.tasks,sending:t.live&&t.item.status===`running`,onOpen:e.onOpenTask});case`assistant`:return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(z,{text:t.text===``&&!t.streaming?`(empty response)`:t.text,streaming:t.streaming}),t.meta&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover/assistant:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100`,children:[(0,U.jsx)(DF,{text:t.text}),e.fork&&(0,U.jsx)(XF,{uuid:t.message}),t.time!==null&&(0,U.jsx)(yr,{label:ir(t.time),children:(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:gn(t.time)})})]})]});case`error`:return(0,U.jsxs)(`div`,{className:`text-destructive flex gap-1.5 text-[13px] leading-5 tracking-[-0.04px]`,children:[(0,U.jsx)(B,{icon:Fa,className:`mt-0.5 size-4 shrink-0`}),(0,U.jsx)(`p`,{className:`min-w-0 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:t.text})]});case`notice`:return(0,U.jsxs)(`div`,{className:`text-muted-foreground mx-auto flex w-full max-w-(--chat-content-max-width) items-center gap-3 py-1 text-xs`,children:[(0,U.jsx)(`span`,{className:`bg-border/70 h-px flex-1`}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.text===`Conversation compacted`&&(0,U.jsx)(B,{icon:Ao,className:`size-3`}),t.text]}),(0,U.jsx)(`span`,{className:`bg-border/70 h-px flex-1`})]});case`plan`:return(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(uF,{plan:t.plan})});case`question`:return(0,U.jsx)(hF,{item:t.item})}}var YF=(0,H.memo)(JF,(e,t)=>t.row.kind===`agent`?de(e,t):de(fi(e,[`agents`,`tasks`]),fi(t,[`agents`,`tasks`])));function XF(e){let[t,n]=(0,H.useState)(!1);return(0,U.jsx)(yr,{label:`Fork from this response`,children:(0,U.jsx)(V,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,disabled:t,"aria-label":`Fork from this response`,onClick:()=>{n(!0),Re(e.uuid).finally(()=>n(!1))},children:(0,U.jsx)(B,{icon:mo,className:R(`size-3.5`,t&&`animate-pulse`)})})})}var ZF=ze(`event`,[k({offsite:O(`browser`),event:O(`location`),url:te(),proxied:te(),back:a(),forward:a()}),k({offsite:O(`browser`),event:O(`navigate`)})]);function QF(e){let t=re({from:`__root__`,select:e=>e.browse??null}),[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(0),[o,s]=(0,H.useState)(0),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=L(t=>F(t,e.machine).status===`online`);(0,H.useEffect)(()=>{if(t===null||!m)return;if(p.current===t){p.current=null;return}let n=!0;return $F(e.machine,t).then(e=>{n&&(r({target:t,src:e,href:e,error:null}),s(e=>e+1),d(null),l(!0))},e=>{n&&(r({target:t,src:null,href:null,error:kt(e)}),d(null),l(!1))}),()=>{n=!1}},[e.machine,t,i,m]),(0,H.useEffect)(()=>{function e(e){if(e.source===null||e.source!==f.current?.contentWindow)return;let i=ZF.safeParse(e.data);if(!i.success)return;if(i.data.event===`navigate`){d(null),l(!0);return}if(d({back:i.data.back,forward:i.data.forward,proxied:i.data.proxied}),t===null||n===null)throw Error(`a page reported its location outside the browser`);let a=i.data.url;a!==t&&(p.current=a,r({...n,target:a,href:i.data.proxied}),se({browse:a}))}return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[t,n]);let h=t===null?null:n?.src??null,g=n?.target===t?n.href:null,_=n?.target===t?n.error:null,v=t!==null&&m&&(n?.target!==t||c);function y(e){if(u===null)throw Error(`no page is open to send a browser command to`);f.current?.contentWindow?.postMessage({offsite:`browser`,command:e},new URL(u.proxied).origin)}return(0,U.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-2 border-b pr-3 pl-3`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,U.jsx)(B,{icon:ct,className:`size-3.5`})}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Back`,"aria-label":`Back`,disabled:u?.back!==!0,onClick:()=>y(`back`),children:(0,U.jsx)(B,{icon:Ba,className:`size-3.5`})}),(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Forward`,"aria-label":`Forward`,disabled:u?.forward!==!0,onClick:()=>y(`forward`),children:(0,U.jsx)(B,{icon:En,className:`size-3.5`})}),(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Reload`,"aria-label":`Reload`,onClick:()=>{u===null?a(i+1):y(`reload`)},children:(0,U.jsx)(B,{icon:Fr,className:R(`size-3.5`,v&&`animate-spin`)})})]}),(0,U.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`address`);if(typeof t!=`string`)throw Error(`the address field is missing`);let n=t.trim();n!==``&&we(eI(n))},children:(0,U.jsx)(Ud,{name:`address`,className:`h-7 font-mono text-xs`,placeholder:`URL or file path`,"aria-label":`URL or file path`,defaultValue:t??``})},t),g!==null&&(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,asChild:!0,children:(0,U.jsx)(`a`,{href:g,target:`_blank`,rel:`noopener noreferrer`,title:`Open in a new tab`,"aria-label":`Open in a new tab`,children:(0,U.jsx)(B,{icon:Co,className:`size-3.5`})})})]}),_!==null&&(0,U.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:_}),t===null&&(0,U.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Type a URL or a file path above. URLs load from this machine.`}),h!==null&&(0,U.jsx)(`iframe`,{ref:f,src:h,title:t??``,className:`min-h-0 w-full flex-1 bg-white`,onLoad:()=>l(!1)},o)]})}async function $F(e,t){if(/^https?:\/\//i.test(t)){let n=new URL(t),r=new URL(S(e));return r.port=String(await M(e,`browser.proxy`,{origin:n.origin})),`${r.origin}${n.pathname}${n.search}${n.hash}`}let n=await M(e,`files.browse`,void 0);return`${S(e)}/api/browse/${n}${tI(t)}`}function eI(e){return/^(https?:\/\/|file:)/i.test(e)||/^[/.]/.test(e)||/^[a-z]:[\\/]/i.test(e)?e:/^(localhost|\d+(\.\d+){3}|[\w.-]+:\d+)([:/?#]\S*)?$/i.test(e)?`http://${e}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(e)?`https://${e}`:`https://www.google.com/search?q=${encodeURIComponent(e)}`}function tI(e){let t=e.replaceAll(`\\`,`/`).split(`/`).map(encodeURIComponent).join(`/`);return t.startsWith(`/`)?t:`/${t}`}function nI(e){let t=L(e=>e.items),n=L(e=>e.earlier),r=L(t=>De(t.machines,e.machine,e.sessionId)),i=[...n,...t],a=JP(i,r),o=a.agents.find(t=>t.item.id===e.selected),s=a.tasks.find(t=>t.item.id===e.selected),c=o===void 0?null:aF(o.item);return(0,U.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b pr-3 pl-3`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,U.jsx)(B,{icon:ct,className:`size-3.5`})}),o===void 0&&s===void 0&&(0,U.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Tasks`}),(o!==void 0||s!==void 0)&&(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Back to tasks`,"aria-label":`Back to tasks`,onClick:()=>e.onSelect(null),children:(0,U.jsx)(B,{icon:Ba,className:`size-3.5`})}),o!==void 0&&c!==null&&(0,U.jsxs)(U.Fragment,{children:[o.status===`Running`?(0,U.jsx)(sF,{className:c.tone}):(0,U.jsx)(oF,{className:c.tone}),(0,U.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:c.name}),c.description!==``&&(0,U.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:c.description}),o.status===`Running`&&o.agentId!==null&&e.sessionId!==null&&(0,U.jsx)(rI,{machine:e.machine,sessionId:e.sessionId,taskId:o.agentId})]}),s!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(B,{icon:io,className:`text-muted-foreground size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 truncate font-medium`,children:YP(s.item)}),(0,U.jsx)(`span`,{className:R(`text-muted-foreground shrink-0`,s.status===`Failed`&&`text-destructive`),children:s.status}),s.status===`Running`&&s.taskId!==null&&e.sessionId!==null&&(0,U.jsx)(rI,{machine:e.machine,sessionId:e.sessionId,taskId:s.taskId})]})]})]}),o===void 0&&s===void 0&&(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,U.jsx)(`h2`,{className:`text-muted-foreground px-1 pb-1.5 text-xs font-medium`,children:`Agents`}),a.agents.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No agents in this thread.`}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...a.agents.filter(e=>e.status===`Running`),...a.agents.filter(e=>e.status!==`Running`)].map(t=>{let n=aF(t.item);return(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Open ${n.name} agent: ${n.description}`,className:`bg-secondary hover:bg-accent focus-visible:ring-ring/70 flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[t.status===`Running`?(0,U.jsx)(sF,{className:n.tone}):(0,U.jsx)(oF,{className:n.tone}),(0,U.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:n.name}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:n.description}),(0,U.jsx)(`span`,{className:R(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`),children:t.status})]},t.item.id)})}),(0,U.jsx)(`h2`,{className:`text-muted-foreground px-1 pt-5 pb-1.5 text-xs font-medium`,children:`Tasks`}),a.tasks.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No background tasks in this thread.`}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...a.tasks.filter(e=>e.status===`Running`),...a.tasks.filter(e=>e.status!==`Running`)].map(t=>(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Open task: ${YP(t.item)}`,className:`bg-secondary hover:bg-accent focus-visible:ring-ring/70 flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[(0,U.jsx)(B,{icon:io,className:R(`size-4 shrink-0`,t.status===`Running`?`text-foreground animate-pulse`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:YP(t.item)}),(0,U.jsx)(`span`,{className:R(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`),children:t.status})]},t.item.id))})]}),o!==void 0&&(0,U.jsx)(aI,{item:o.item,agentId:o.agentId,running:o.status===`Running`,items:i,found:a,cwd:e.cwd,onSelect:e.onSelect},o.item.id),s!==void 0&&e.sessionId!==null&&(0,U.jsx)(iI,{machine:e.machine,sessionId:e.sessionId,command:s.item.command,path:s.path,events:s.events,running:s.status===`Running`},s.item.id)]})}function rI(e){return(0,U.jsx)(V,{size:`xs`,variant:`outline`,className:`shrink-0`,onClick:()=>Ne(e.machine,e.sessionId,e.taskId),children:`Stop`})}function iI(e){let[t,n]=(0,H.useState)(void 0),[r,i]=(0,H.useState)(null),a=(0,H.useRef)(null),o=(0,H.useRef)(!0);(0,H.useEffect)(()=>{let t=e.path;if(t===null)return;let r=!0;async function a(t){try{let a=await M(e.machine,`tasks.output`,{sessionId:e.sessionId,path:t});if(!r)return;n(a),i(null)}catch(e){r&&i(kt(e))}}a(t);let o=e.running?window.setInterval(()=>void a(t),2e3):null;return()=>{r=!1,o!==null&&window.clearInterval(o)}},[e.machine,e.sessionId,e.path,e.running]),(0,H.useLayoutEffect)(()=>{let e=a.current;e!==null&&o.current&&(e.scrollTop=e.scrollHeight)},[t,e.events]);let s=e.path===null?e.events.join(`
21
- `):t?.text??``;return(0,U.jsxs)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-3`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[e.command!==``&&(0,U.jsxs)(`p`,{className:`text-muted-foreground pb-2 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap`,children:[`$ `,e.command]}),r!==null&&(0,U.jsx)(`p`,{className:`text-destructive text-xs`,children:r}),r===null&&e.path!==null&&t===void 0&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading…`}),r===null&&e.path!==null&&t===null&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The output file no longer exists.`}),t?.truncated===!0&&(0,U.jsx)(`p`,{className:`text-muted-foreground pb-2 text-xs`,children:`Showing the end of the output.`}),e.path===null&&e.events.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No events yet.`}),t?.text===``&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.running?`No output yet.`:`No output.`}),s!==``&&(0,U.jsx)(`pre`,{className:`bg-secondary text-foreground rounded-lg p-3 font-mono text-xs leading-5 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:s})]})}function aI(e){let t=(0,H.useRef)(null),n=(0,H.useRef)(!0),[r,i]=(0,H.useState)([]);(0,H.useLayoutEffect)(()=>{let e=t.current;e!==null&&n.current&&(e.scrollTop=e.scrollHeight)},[e.items,e.running]);function a(e){i(r.includes(e)?r.filter(t=>t!==e):[...r,e])}let o=e.items.filter(t=>t.parent===e.item.id),s=o.length===0;(0,H.useEffect)(()=>{s&&e.agentId!==null&&Ze(e.item.id,e.agentId)},[s,e.item.id,e.agentId]);let c=o.at(0),l=c?.kind===`user`?c:null,u=_F({prompt:null,first:!1,items:l===null?o:o.slice(1)},e.running?{partial:``}:null);return(0,U.jsxs)(`div`,{ref:t,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 pt-1 pb-8`,onScroll:e=>{let t=e.currentTarget;n.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[l!==null&&(0,U.jsx)(eF,{title:`Prompt`,pending:!1,grouped:!0,open:r.includes(`prompt`),onToggle:()=>a(`prompt`),children:(0,U.jsx)(z,{text:l.text,className:`text-muted-foreground text-[13px]`})}),u.map((t,n)=>{let i=u[n-1];return(0,U.jsx)(`div`,{className:R(i===void 0?`pt-2`:t.kind===`working`?void 0:gF(t)&&gF(i)?`pt-2`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,U.jsx)(YF,{row:t,agents:e.found.agents,tasks:e.found.tasks,running:e.running,compacting:!1,fork:!1,expanded:r.includes(t.key),onToggle:a,onOpenTask:e.onSelect,rewind:!1,cwd:e.cwd})},t.key)})]})}var oI=(0,H.lazy)(async()=>({default:(await Lr(async()=>{let{EditorDialog:e}=await import(`./editor-dialog-B7QW5wuQ.js`);return{EditorDialog:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))).EditorDialog})),sI=(0,H.lazy)(async()=>({default:(await Lr(async()=>{let{DiffPanel:e}=await import(`./diff-panel-BKiJiAiZ.js`);return{DiffPanel:e}},__vite__mapDeps([22,1,23,3,8,14,4,5,7,24,25,11,26,27,12,16,28,29]))).DiffPanel})),cI=`text-foreground hover:bg-accent data-[pressed=true]:bg-accent relative grid h-7 min-w-7 cursor-pointer place-items-center rounded-lg border border-transparent [&_svg]:size-4 [&_svg]:opacity-80`;function lI(e){let[t,n]=(0,H.useState)(!1),r=dI(e,()=>n(!0));return(0,U.jsxs)(U.Fragment,{children:[r.map(e=>(0,U.jsxs)(`button`,{className:cI,"data-pressed":e.pressed,"aria-label":e.label,title:e.title,onClick:e.onSelect,children:[(0,U.jsx)(B,{icon:e.icon}),e.badge]},e.id)),t&&(0,U.jsx)(H.Suspense,{children:(0,U.jsx)(oI,{machine:e.selection.machine,projectId:e.selection.projectId,onClose:()=>n(!1)})})]})}function uI(e){let[t,n]=(0,H.useState)(!1),r=dI(e,()=>n(!0));return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsxs)($t,{open:e.open,onOpenChange:e.onOpenChange,children:[(0,U.jsx)(dn,{asChild:!0,children:(0,U.jsxs)(`button`,{className:R(cI,`data-[state=open]:bg-accent`),"aria-label":`More`,title:`More`,children:[(0,U.jsx)(B,{icon:No}),r.some(e=>e.attention)&&(0,U.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`})]})}),(0,U.jsxs)(nn,{className:`w-56`,align:`end`,children:[r.map(e=>(0,U.jsxs)(Kt,{onSelect:e.onSelect,children:[(0,U.jsx)(B,{icon:e.icon}),(0,U.jsx)(`span`,{className:`flex-1`,children:e.label}),e.detail]},e.id)),e.children]})]}),t&&(0,U.jsx)(H.Suspense,{children:(0,U.jsx)(oI,{machine:e.selection.machine,projectId:e.selection.projectId,onClose:()=>n(!1)})})]})}function dI(e,t){let n=(0,H.useSyncExternalStore)(rM,()=>iM().alerts.length>0),r=(0,H.useSyncExternalStore)(rM,()=>iM().layout.tabs.filter(t=>t.projectId===e.selection.projectId).length),i=L(e=>{if(e.selection?.sessionId===null)return 0;let t=JP([...e.earlier,...e.items],Ce(e));return[...t.agents,...t.tasks].filter(e=>e.status===`Running`).length});return[{id:`diff`,label:`Diff`,title:`Diff`,icon:po,pressed:e.panel===`diff`,attention:e.changed,badge:e.changed&&(0,U.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`}),detail:e.changed&&(0,U.jsx)(`span`,{className:`bg-muted-foreground size-1.5 rounded-full`}),onSelect:()=>e.onPanel(e.panel===`diff`?null:`diff`)},{id:`terminal`,label:`Terminal`,title:`Terminal (${Ot}+\`)`,icon:Qo,pressed:e.terminal,attention:n,badge:r>0&&(0,U.jsx)(`span`,{className:R(`absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full px-0.5 text-[8px] leading-none font-medium tabular-nums`,n?`bg-primary text-primary-foreground`:`text-foreground bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))]`),children:r}),detail:r>0&&(0,U.jsx)(`span`,{className:R(`text-xs tabular-nums`,n?`text-primary`:`text-muted-foreground`),children:r}),onSelect:()=>e.onTerminal(!e.terminal)},{id:`tasks`,label:`Tasks`,title:`Tasks`,icon:$o,pressed:e.panel===`tasks`,attention:i>0,badge:i>0&&(0,U.jsx)(`span`,{className:`text-foreground absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-0.5 text-[8px] leading-none font-medium tabular-nums`,children:i}),detail:i>0&&(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:i}),onSelect:()=>e.onPanel(e.panel===`tasks`?null:`tasks`)},{id:`browser`,label:`Browser`,title:`Browser`,icon:Ga,pressed:e.panel===`browser`,attention:!1,badge:null,detail:null,onSelect:()=>e.onPanel(e.panel===`browser`?null:`browser`)},{id:`editor`,label:`Editor`,title:`Editor`,icon:ns,pressed:!1,attention:!1,badge:null,detail:null,onSelect:t}]}function fI(e){return(0,U.jsxs)(U.Fragment,{children:[e.panel===`browser`&&(0,U.jsx)(QF,{machine:e.selection.machine,onClose:()=>e.onPanel(null)}),e.panel===`diff`&&(0,U.jsx)(H.Suspense,{children:(0,U.jsx)(sI,{machine:e.selection.machine,projectId:e.selection.projectId,running:e.running,onClose:()=>e.onPanel(null)},`${e.selection.machine} ${e.selection.projectId}`)}),e.panel===`tasks`&&(0,U.jsx)(nI,{machine:e.selection.machine,cwd:e.cwd,sessionId:e.selection.sessionId,selected:e.selectedTask,onSelect:e.onSelectTask,onClose:()=>e.onPanel(null)})]})}function pI(){let e=L(e=>e.selection),t=L(e=>e.machines.length>0),n=j();return n===null?e===null?t?(0,U.jsx)(`div`,{className:`bg-sidebar relative flex min-w-0 flex-1 pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,U.jsx)(KP,{className:`min-w-0 flex-1 border-r-0`,mobile:!0})}):(0,U.jsx)(`main`,{className:`bg-background flex flex-1 overflow-y-auto pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,U.jsx)(RT,{})}):(0,U.jsx)(mI,{selection:e}):(0,U.jsx)(pN,{machine:n,mobile:!0,leading:(0,U.jsx)(V,{variant:`ghost`,size:`icon-xs`,className:`h-full w-11 rounded-none`,"aria-label":`Back`,title:`Back`,onClick:()=>bt(`chat`,()=>void Ae.navigate({to:`/`,search:{},replace:!0})),children:(0,U.jsx)(B,{icon:Ba})})})}function mI(e){let t=L(t=>F(t,e.selection.machine)),n=L(t=>t.sessions.find(t=>t.machine===e.selection.machine&&t.id===e.selection.sessionId)),r=L(t=>pt(t,e.selection.machine,e.selection.projectId)?.path??``),i=Ns(e.selection.machine,e.selection.projectId),a=L(_t),o=af(e.selection.machine,t.status===`online`?e.selection.projectId:null,a),s=of({machine:e.selection.machine,projectId:e.selection.projectId,repos:o.repos,onRefresh:o.refresh}),c=(0,H.useSyncExternalStore)(rM,()=>iM().open),l=re({from:`__root__`,select:e=>e.panel??null}),[u,d]=(0,H.useState)(null),f=o.repos.some(e=>e.changed>0),p=l!==null||c,m=(0,H.useCallback)(e=>{p?se(e):vt(e,`overlay`)},[p]),h=(0,H.useCallback)(e=>{d(null),e===null?hI():m({panel:e,bottom:void 0})},[m]),g=(0,H.useCallback)(e=>{h(`tasks`),d(e)},[h]);function _(e){e?m({panel:void 0,bottom:`terminal`}):hI()}return(0,U.jsxs)(`main`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,U.jsxs)(`header`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-1.5 px-2`,children:[(0,U.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":`Back`,onClick:()=>bt(`chat`,ut),children:(0,U.jsx)(B,{icon:Ba,className:`text-foreground size-5`,strokeWidth:2})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`text-foreground truncate font-medium`,children:n?.title??`New thread`}),t.status===`online`&&(0,U.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1 text-xs`,children:[(0,U.jsx)(Vu,{icon:t.icon,className:`size-3.5 shrink-0`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[t.name,` / `,i]})]}),t.status!==`online`&&(0,U.jsxs)(`div`,{className:`text-warning-foreground truncate text-xs`,children:[t.status===`connecting`&&`Connecting to ${t.name}…`,t.status===`offline`&&`${t.name} is offline, reconnecting…`,t.status===`unpaired`&&`${t.name} needs pairing`]})]}),(0,U.jsx)(uI,{selection:e.selection,panel:l,terminal:c,changed:f,open:s.menuOpen,onOpenChange:s.setMenuOpen,onPanel:h,onTerminal:_,children:o.repos.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ut,{}),(0,U.jsx)(sf,{git:s,collapsed:!0})]})}),(0,U.jsx)(cf,{git:s})]}),(0,U.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(qF,{onOpenTask:g}),(0,U.jsx)(Ed,{})]},`${e.selection.machine} ${e.selection.sessionId??e.selection.projectId}`)}),(0,U.jsx)(Or,{open:p,onOpenChange:()=>h(null),children:(0,U.jsx)(Mr,{children:(0,U.jsxs)(wr,{"aria-describedby":void 0,className:`bg-background data-open:animate-in data-open:slide-in-from-right fixed inset-0 z-40 flex flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sm duration-200 outline-none [--workspace-topbar-height:44px] motion-reduce:animate-none`,children:[(0,U.jsxs)(Pr,{className:`sr-only`,children:[l===`diff`&&`Diff`,l===`tasks`&&`Tasks`,l===`browser`&&`Browser`,l===null&&`Terminal`]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[l!==null&&(0,U.jsx)(fI,{panel:l,selection:e.selection,cwd:r,running:a,selectedTask:u,onSelectTask:d,onPanel:h}),l===null&&c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`border-border/60 flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b px-3`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:()=>_(!1),children:(0,U.jsx)(B,{icon:ct,className:`size-3.5`})}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Terminal`})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,U.jsx)(cN,{view:e.selection.projectId})})]})]})]})})})]})}function hI(){bt(`overlay`,()=>se({panel:void 0,bottom:void 0}))}var gI=window.matchMedia(`(min-width: 768px)`),_I=800;function vI(e){return gI.addEventListener(`change`,e),()=>gI.removeEventListener(`change`,e)}function yI(){let e=(0,H.useSyncExternalStore)(vI,()=>gI.matches);return Ms(`mod+k`,()=>ce(!I().paletteOpen),{enableOnFormTags:!0,preventDefault:!0}),(0,U.jsxs)(`div`,{className:`flex h-dvh text-sm`,children:[e?(0,U.jsx)(xI,{}):(0,U.jsx)(pI,{}),(0,U.jsx)(zE,{}),e?(0,U.jsx)(MT,{}):(0,U.jsx)(LT,{}),(0,U.jsx)(Hd,{}),(0,U.jsx)(xl,{position:e?`bottom-right`:`top-center`,swipeDirections:e?[`right`,`bottom`]:[`left`,`right`,`top`]})]})}function bI(e){se({panel:e??void 0})}function xI(){let e=L(e=>e.selection),t=L(e=>e.sessions),n=j(),r=L(e=>e.selection===null?``:pt(e,e.selection.machine,e.selection.projectId)?.path??``),i=L(e=>{let t=Qe(e);return t===null?null:F(e,t)}),[a,o]=(0,H.useState)(!0),s=(0,H.useRef)(null),[c,l]=(0,H.useState)(!1),u=re({from:`__root__`,select:e=>e.panel??null}),d=(0,H.useRef)(`diff`),[f,p]=(0,H.useState)(null),m=(0,H.useCallback)(e=>{p(e),bI(`tasks`)},[]),[h,g]=dr(`panelWidth`,540),[_,v]=(0,H.useState)(280),y=(0,H.useSyncExternalStore)(rM,()=>iM().open),b=L(_t),x=af(e?.machine??``,i?.status===`online`?e?.projectId??null:null,b),S=of({machine:e?.machine??``,projectId:e?.projectId??``,repos:x.repos,onRefresh:x.refresh}),C=t.find(t=>t.machine===e?.machine&&t.id===e.sessionId),w=Ns(e?.machine??``,e?.projectId??``);return Ms([`meta+backquote`,`ctrl+backquote`],e=>{e.stopPropagation(),fM(!iM().open)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),Ms([`mod+j`,`mod+shift+b`],e=>{e.stopPropagation(),bI(mt().panel===void 0?d.current:null)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),(0,H.useEffect)(()=>{u!==null&&(d.current=u)},[u]),Ms([`mod+b`,`mod+shift+j`],()=>o(e=>!e),{enableOnFormTags:!0,preventDefault:!0}),(0,H.useEffect)(()=>{if(n!==null)return;let e=s.current;if(e===null)throw Error(`header is not mounted`);let t=new ResizeObserver(e=>l(e[0].contentRect.width<_I));return t.observe(e),()=>t.disconnect()},[n]),n===null?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(KP,{className:R(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),!a&&(0,U.jsx)(`div`,{className:`fixed top-0 left-3 z-50 flex h-(--workspace-topbar-height) items-center`,children:(0,U.jsx)(V,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show sidebar`,title:`Show sidebar (${Ot}+B)`,onClick:()=>o(!0),children:(0,U.jsx)(B,{icon:Yn})})}),(0,U.jsxs)(`main`,{className:`bg-background relative flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,U.jsxs)(`header`,{ref:s,className:R(`bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-3 pr-3 pl-[3.25rem]`,a&&`pl-5`),children:[e!==null&&i!==null&&(0,U.jsx)(`nav`,{className:`min-w-0 flex-1`,children:(0,U.jsxs)(`ol`,{className:`flex min-w-0 items-center gap-3 text-sm`,children:[(0,U.jsxs)(`li`,{className:`text-icon-muted flex shrink-0 items-center gap-1.5`,children:[(0,U.jsx)(Vu,{icon:i.icon,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`max-w-40 truncate`,children:i.name})]}),(0,U.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,U.jsxs)(`li`,{className:`text-muted-foreground flex min-w-0 shrink items-center gap-1.5 font-medium`,title:`${i.name}:${r}`,children:[(0,U.jsx)(zs,{machine:e.machine,projectId:e.projectId,className:`size-3.5`}),(0,U.jsx)(`span`,{className:`max-w-40 truncate`,children:w})]}),(0,U.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,U.jsx)(`li`,{className:R(`text-foreground min-w-10 truncate font-medium`,a&&`flex-1`),children:C?.title??`New thread`}),!a&&(0,U.jsx)(`li`,{className:`shrink-0`,children:(0,U.jsx)(VP,{hideDone:!0})})]})}),e===null&&!a&&(0,U.jsx)(VP,{hideDone:!0}),e===null&&(0,U.jsx)(`span`,{className:`flex-1`}),i!==null&&i.status!==`online`&&(0,U.jsxs)(`span`,{className:`text-warning-foreground shrink-0 text-xs`,children:[i.status===`connecting`&&`Connecting to ${i.name}…`,i.status===`offline`&&`${i.name} is offline, reconnecting…`,i.status===`unpaired`&&`${i.name} needs pairing`]}),e!==null&&(0,U.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[!c&&x.repos.length>0&&(0,U.jsx)(lf,{machine:e.machine,projectId:e.projectId,repos:x.repos,onRefresh:x.refresh}),c&&x.repos.length>0&&(0,U.jsxs)($t,{open:S.menuOpen,onOpenChange:S.setMenuOpen,children:[(0,U.jsx)(dn,{asChild:!0,children:(0,U.jsx)(V,{variant:`ghost`,size:`icon-sm`,"aria-label":`Git actions`,title:`Git actions`,children:(0,U.jsx)(B,{icon:No})})}),(0,U.jsx)(nn,{className:`w-56`,align:`end`,children:(0,U.jsx)(sf,{git:S,collapsed:!0})})]}),(0,U.jsx)(`span`,{className:`bg-foreground/15 mr-1 ml-2.5 h-4 w-px`}),(0,U.jsx)(lI,{selection:e,panel:u,terminal:y,changed:x.repos.some(e=>e.changed>0),onPanel:e=>{p(null),bI(e)},onTerminal:fM})]})]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden`,children:[(0,U.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[i===null&&(0,U.jsx)(RT,{}),e===null&&i!==null&&(0,U.jsx)(`div`,{className:`grid flex-1 place-items-center p-6 text-center`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-foreground text-3xl font-normal tracking-tight`,children:`Pick a thread, or start one`}),(0,U.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:`Open a project from the sidebar to talk to Claude.`})]})}),e!==null&&(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(qF,{onOpenTask:m}),(0,U.jsx)(Ed,{})]},`${e.machine} ${e.sessionId??e.projectId}`)]}),e!==null&&y&&(0,U.jsxs)(`aside`,{className:`border-border/80 bg-background relative shrink-0 overflow-hidden border-t`,style:{height:_},children:[(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,className:`group absolute inset-x-0 top-0 z-30 h-1.5 cursor-row-resize touch-none select-none`,onPointerDown:e=>Dt(e,e=>{let t=Math.max(120,Math.floor(window.innerHeight*.8));v(Math.min(t,Math.max(120,window.innerHeight-e.clientY)))}),children:(0,U.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-x-0 top-0 h-px transition-colors`})}),(0,U.jsx)(cN,{view:e.projectId})]})]}),e!==null&&u!==null&&(0,U.jsxs)(`div`,{className:`relative flex shrink-0`,style:{width:h},children:[(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,onPointerDown:e=>Dt(e,e=>{let t=Math.max(360,Math.floor(window.innerWidth*.7)),n=Math.min(t,Math.max(360,window.innerWidth-e.clientX));g(n)}),children:(0,U.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`})}),(0,U.jsx)(`div`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden rounded-tl-lg border-t border-l`,children:(0,U.jsx)(fI,{panel:u,selection:e,cwd:r,running:b,selectedTask:f,onSelectTask:p,onPanel:bI})})]})]})]}),(0,U.jsx)(cf,{git:S})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(KP,{className:R(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),(0,U.jsx)(pN,{machine:n,mobile:!1,leading:!a&&(0,U.jsx)(V,{variant:`ghost`,size:`icon-xs`,"aria-label":`Show sidebar`,title:`Show sidebar (${Ot}+B)`,onClick:()=>o(!0),children:(0,U.jsx)(B,{icon:Yn})})})]})}var SI=class extends H.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let e=this.state.error;return e===null?this.props.children:(0,U.jsxs)(`div`,{className:`flex h-dvh flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:`Something went wrong`}),(0,U.jsx)(`p`,{className:`text-muted-foreground max-w-xl text-sm whitespace-pre-wrap`,children:e.message}),(0,U.jsx)(V,{onClick:()=>location.reload(),children:`Reload`})]})}},CI=document.getElementById(`root`);if(!CI)throw Error(`root element missing`);if(`serviceWorker`in navigator){let e=navigator.serviceWorker.controller!==null,t=document.querySelector(`link[rel="manifest"]`)!==null;navigator.serviceWorker.addEventListener(`controllerchange`,()=>{e&&location.reload()}),navigator.serviceWorker.addEventListener(`message`,e=>{e.data.type===`openSession`&&Ue({machine:e.data.machine,projectId:e.data.project,sessionId:e.data.sessionId})}),navigator.serviceWorker.register(t?`/sw.js?pwa`:`/sw.js`,{type:`classic`}).catch(e=>console.error(`could not register the service worker`,e))}addEventListener(`keydown`,e=>{(e.metaKey||e.ctrlKey)&&e.key===`w`&&e.preventDefault()},{capture:!0}),await St(),P(),tt({open:e=>{da(e).catch(e=>console.error(`could not refresh the push subscription`,e))}}),xa(),Qj(),Ae.routeTree.update({component:yI}),(0,pi.createRoot)(CI).render((0,U.jsx)(H.StrictMode,{children:(0,U.jsx)(SI,{children:(0,U.jsx)(si,{router:Ae})})}));
20
+ `),children:t.items.map((t,n)=>(0,U.jsxs)(`span`,{children:[n>0&&` `,(0,U.jsx)(ZP,{text:q(t.input).split(`/`).at(-1)??``,active:e.live&&t.status===`running`})]},t.id))}),pending:e.live&&t.items.some(e=>e.status===`running`),grouped:!0,open:!1,onToggle:null});case`files`:return(0,U.jsx)(PF,{items:t.items,cwd:e.cwd,live:e.live})}}function WF(e){let t=[];return e.forEach((n,r)=>{if(n.kind===`reasoning`){t.push({kind:`thinking`,key:n.id,text:n.text,last:r===e.length-1});return}let i=t.at(-1);n.status!==`failed`&&n.kind===`file_change`?i?.kind===`files`?i.items.push(n):t.push({kind:`files`,key:n.id,items:[n]}):n.status!==`failed`&&n.kind===`tool`&&ed(n.name)===`read`?i?.kind===`reads`?i.items.push(n):t.push({kind:`reads`,key:n.id,items:[n]}):t.push({kind:`tool`,key:n.id,item:n})}),t}var GF=30;function KF(e){let t=L(e=>e.selection),n=L(e=>e.loaded),r=L(e=>e.items),i=L(e=>e.earlier),a=L(e=>e.before),o=L(e=>e.partial),s=L(e=>e.requests),c=L(Ce),l=(0,H.useRef)(null),u=(0,H.useRef)(null),d=(0,H.useRef)(!0),f=(0,H.useRef)(null),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)([]),[_,v]=(0,H.useState)(null),y=L(e=>t===null?``:pt(e,t.machine,t.projectId)?.path??``),b=L(_t),x=L(e=>e.sentAt);(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&x!==0&&(d.current=!0,e.scrollTop=e.scrollHeight)},[x]),(0,H.useEffect)(()=>{let e=l.current;if(e===null||u.current===null)throw Error(`transcript is not mounted`);let t=new ResizeObserver(()=>{d.current&&(e.scrollTop=e.scrollHeight)});return t.observe(e),t.observe(u.current),()=>t.disconnect()},[]),(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&d.current&&(e.scrollTop=e.scrollHeight)},[r,o,s,b]);let S=(0,H.useMemo)(()=>JP([...i,...r],c),[i,r,c]),C=yF(i,!1,``),w=[...C,...yF(r,b,o)],T=w.findIndex(e=>e.key===_?.key),E=Math.max(0,T===-1?w.length-GF:T-(_?.above??0));(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&f.current!==null&&(e.scrollTop=e.scrollHeight-f.current),f.current=null},[i,E]),(0,H.useLayoutEffect)(()=>{let e=l.current;e!==null&&w.length!==0&&(T===-1?v({key:w[E].key,above:0}):D(e))});function D(e){E===0||e.scrollTop>=e.clientHeight||(f.current=e.scrollHeight-e.scrollTop,v({key:w[E].key,above:GF}))}let O=(0,H.useCallback)(e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]);return(0,U.jsx)(`div`,{ref:l,className:`topbar-scroll-fade relative min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-8`,onScroll:e=>{let t=e.currentTarget;d.current=t.scrollHeight-t.scrollTop-t.clientHeight<40,D(t)},children:(0,U.jsx)(`div`,{ref:u,children:(0,U.jsxs)(Wu,{width:`chat`,className:`pt-3`,children:[!n&&(0,U.jsx)(`p`,{className:`text-muted-foreground py-6 text-center text-xs`,children:`Loading…`}),a!==null&&E===0&&(0,U.jsx)(`div`,{className:`flex justify-center pb-4`,children:(0,U.jsx)(V,{type:`button`,size:`xs`,variant:`ghost-muted`,disabled:p,onClick:async()=>{let e=l.current;e!==null&&(f.current=e.scrollHeight-e.scrollTop),v({key:w[0].key,above:GF}),m(!0),await st(),m(!1)},children:p?`Loading…`:`Load earlier conversation`})}),w.slice(E).map((t,n)=>{let r=E+n,i=w[r-1],a=r<C.length;return(0,U.jsx)(`div`,{className:R(i===void 0?void 0:t.kind===`user`?`pt-6`:t.kind===`working`?void 0:gF(t)&&gF(i)?`pt-2`:gF(t)||gF(i)?`pt-3`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,U.jsx)(YF,{row:t,agents:S.agents,tasks:S.tasks,running:b,compacting:c?.compacting===!0,fork:!a,expanded:h.includes(t.key),onToggle:O,onOpenTask:e.onOpenTask,rewind:!a,cwd:y})},t.key)})]})})})}var qF=(0,H.memo)(KF);function JF(e){let t=e.row;switch(t.kind){case`user`:return(0,U.jsx)(EF,{item:t.item,first:t.first,running:e.running,rewind:e.rewind});case`working`:return(0,U.jsx)(`div`,{className:`text-muted-foreground h-9 pt-3 text-[13px] leading-5 font-medium tracking-[-0.04px]`,children:(0,U.jsx)(ZP,{text:e.compacting?`Compacting conversation`:`Working`,active:!0})});case`group`:return(0,U.jsx)(HF,{entries:t.entries,cwd:e.cwd,live:t.live,open:e.expanded,onToggle:()=>e.onToggle(t.key)});case`agent`:return(0,U.jsx)(cF,{item:t.item,agents:e.agents,tasks:e.tasks,sending:t.live&&t.item.status===`running`,onOpen:e.onOpenTask});case`assistant`:return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(z,{text:t.text===``&&!t.streaming?`(empty response)`:t.text,streaming:t.streaming}),t.meta&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2 text-xs tabular-nums opacity-0 transition-opacity duration-200 group-hover/assistant:opacity-100 focus-within:opacity-100 pointer-coarse:opacity-100`,children:[(0,U.jsx)(DF,{text:t.text}),e.fork&&(0,U.jsx)(XF,{uuid:t.message}),t.time!==null&&(0,U.jsx)(yr,{label:ir(t.time),children:(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs tabular-nums`,children:gn(t.time)})})]})]});case`error`:return(0,U.jsxs)(`div`,{className:`text-destructive flex gap-1.5 text-[13px] leading-5 tracking-[-0.04px]`,children:[(0,U.jsx)(B,{icon:Fa,className:`mt-0.5 size-4 shrink-0`}),(0,U.jsx)(`p`,{className:`min-w-0 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:t.text})]});case`notice`:return(0,U.jsxs)(`div`,{className:`text-muted-foreground mx-auto flex w-full max-w-(--chat-content-max-width) items-center gap-3 py-1 text-xs`,children:[(0,U.jsx)(`span`,{className:`bg-border/70 h-px flex-1`}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.text===`Conversation compacted`&&(0,U.jsx)(B,{icon:Ao,className:`size-3`}),t.text]}),(0,U.jsx)(`span`,{className:`bg-border/70 h-px flex-1`})]});case`plan`:return(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(uF,{plan:t.plan})});case`question`:return(0,U.jsx)(hF,{item:t.item})}}var YF=(0,H.memo)(JF,(e,t)=>t.row.kind===`agent`?de(e,t):de(fi(e,[`agents`,`tasks`]),fi(t,[`agents`,`tasks`])));function XF(e){let[t,n]=(0,H.useState)(!1);return(0,U.jsx)(yr,{label:`Fork from this response`,children:(0,U.jsx)(V,{type:`button`,size:`icon-xs`,variant:`ghost-muted`,disabled:t,"aria-label":`Fork from this response`,onClick:()=>{n(!0),Re(e.uuid).finally(()=>n(!1))},children:(0,U.jsx)(B,{icon:mo,className:R(`size-3.5`,t&&`animate-pulse`)})})})}var ZF=ze(`event`,[k({offsite:O(`browser`),event:O(`location`),url:te(),replaced:a()}),k({offsite:O(`browser`),event:O(`open`),url:te()}),k({offsite:O(`browser`),event:O(`loading`)})]);function QF(e){let t=re({from:`__root__`,select:e=>e.browse??null}),[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(0),[o,s]=(0,H.useState)(0),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)({entries:[],index:-1}),h=L(t=>F(t,e.machine).status===`online`);(0,H.useEffect)(()=>{if(t===null||!h)return;let n=`${e.machine} ${i} ${t}`;if(p.current===n)return;let a=!0;return $F(e.machine,t).then(e=>{a&&(p.current=n,m.current={entries:[],index:-1},r({target:t,src:e,error:null}),s(e=>e+1),d(null),l(!0))},e=>{a&&(r({target:t,src:null,error:kt(e)}),d(null),l(!1))}),()=>{a=!1}},[e.machine,t,i,h]),(0,H.useEffect)(()=>{function a(a){if(a.source===null||a.source!==f.current?.contentWindow)return;let o=ZF.safeParse(a.data);if(!o.success)return;if(o.data.event===`loading`){d(null),l(!0);return}if(t===null||n===null)throw Error(`a page reported its location outside the browser`);let s=o.data.url;o.data.event===`open`?M(e.machine,`browser.open`,{url:s,fromPage:!0}).then(t=>{p.current=`${e.machine} ${i} ${s}`,r({target:s,src:`${S(e.machine)}${t}`,error:null}),l(!0),se({browse:s})},ht):(d(eI(m.current,s,o.data.replaced)),s!==t&&(p.current=`${e.machine} ${i} ${s}`,r({...n,target:s}),se({browse:s})))}return window.addEventListener(`message`,a),()=>window.removeEventListener(`message`,a)},[e.machine,i,t,n]);let g=t!==null&&/^https?:\/\//i.test(t),_=t===null?null:n?.src??null,v=!g&&n?.target===t?n.src:null,y=n?.target===t?n.error:null,b=t!==null&&h&&(n?.target!==t||c);function x(e){if(u===null)throw Error(`no page is open to send a browser command to`);f.current?.contentWindow?.postMessage({offsite:`browser`,command:e},`*`)}return(0,U.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-2 border-b pr-3 pl-3`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,U.jsx)(B,{icon:ct,className:`size-3.5`})}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Back`,"aria-label":`Back`,disabled:u?.back!==!0,onClick:()=>x(`back`),children:(0,U.jsx)(B,{icon:Ba,className:`size-3.5`})}),(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Forward`,"aria-label":`Forward`,disabled:u?.forward!==!0,onClick:()=>x(`forward`),children:(0,U.jsx)(B,{icon:En,className:`size-3.5`})}),(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Reload`,"aria-label":`Reload`,onClick:()=>{u===null?a(i+1):x(`reload`)},children:(0,U.jsx)(B,{icon:Fr,className:R(`size-3.5`,b&&`animate-spin`)})})]}),(0,U.jsx)(`form`,{className:`min-w-0 flex-1`,onSubmit:e=>{e.preventDefault();let t=new FormData(e.currentTarget).get(`address`);if(typeof t!=`string`)throw Error(`the address field is missing`);let n=t.trim();n!==``&&we(tI(n))},children:(0,U.jsx)(Ud,{name:`address`,className:`h-7 font-mono text-xs`,placeholder:`URL or file path`,"aria-label":`URL or file path`,defaultValue:t??``})},t),v!==null&&(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,asChild:!0,children:(0,U.jsx)(`a`,{href:v,target:`_blank`,rel:`noopener noreferrer`,title:`Open in a new tab`,"aria-label":`Open in a new tab`,children:(0,U.jsx)(B,{icon:Co,className:`size-3.5`})})})]}),y!==null&&(0,U.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:y}),t===null&&(0,U.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Type a URL or a file path above. URLs load from this machine.`}),_!==null&&(0,U.jsx)(`iframe`,{ref:f,src:_,sandbox:g?`allow-scripts allow-forms allow-popups allow-modals allow-downloads allow-presentation allow-pointer-lock`:void 0,title:t??``,className:`min-h-0 w-full flex-1 bg-white`,onLoad:()=>l(!1)},o)]})}async function $F(e,t){if(/^https?:\/\//i.test(t)){let n=await M(e,`browser.open`,{url:t,fromPage:!1});return`${S(e)}${n}`}let n=await M(e,`files.browse`,void 0);return`${S(e)}/api/browse/${n}${nI(t)}`}function eI(e,t,n){return n&&e.index>=0?e.entries[e.index]=t:e.entries[e.index-1]===t?--e.index:e.entries[e.index+1]===t?e.index+=1:e.entries[e.index]!==t&&(e.entries=[...e.entries.slice(0,e.index+1),t],e.index+=1),{back:e.index>0,forward:e.index<e.entries.length-1}}function tI(e){return/^(https?:\/\/|file:)/i.test(e)||/^[/.]/.test(e)||/^[a-z]:[\\/]/i.test(e)?e:/^(localhost|\d+(\.\d+){3}|[\w.-]+:\d+)([:/?#]\S*)?$/i.test(e)?`http://${e}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(e)?`https://${e}`:`https://www.google.com/search?q=${encodeURIComponent(e)}`}function nI(e){let t=e.replaceAll(`\\`,`/`).split(`/`).map(encodeURIComponent).join(`/`);return t.startsWith(`/`)?t:`/${t}`}function rI(e){let t=L(e=>e.items),n=L(e=>e.earlier),r=L(t=>De(t.machines,e.machine,e.sessionId)),i=[...n,...t],a=JP(i,r),o=a.agents.find(t=>t.item.id===e.selected),s=a.tasks.find(t=>t.item.id===e.selected),c=o===void 0?null:aF(o.item);return(0,U.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b pr-3 pl-3`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,U.jsx)(B,{icon:ct,className:`size-3.5`})}),o===void 0&&s===void 0&&(0,U.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Tasks`}),(o!==void 0||s!==void 0)&&(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Back to tasks`,"aria-label":`Back to tasks`,onClick:()=>e.onSelect(null),children:(0,U.jsx)(B,{icon:Ba,className:`size-3.5`})}),o!==void 0&&c!==null&&(0,U.jsxs)(U.Fragment,{children:[o.status===`Running`?(0,U.jsx)(sF,{className:c.tone}):(0,U.jsx)(oF,{className:c.tone}),(0,U.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:c.name}),c.description!==``&&(0,U.jsx)(`span`,{className:`text-muted-foreground min-w-0 truncate`,children:c.description}),o.status===`Running`&&o.agentId!==null&&e.sessionId!==null&&(0,U.jsx)(iI,{machine:e.machine,sessionId:e.sessionId,taskId:o.agentId})]}),s!==void 0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(B,{icon:io,className:`text-muted-foreground size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 truncate font-medium`,children:YP(s.item)}),(0,U.jsx)(`span`,{className:R(`text-muted-foreground shrink-0`,s.status===`Failed`&&`text-destructive`),children:s.status}),s.status===`Running`&&s.taskId!==null&&e.sessionId!==null&&(0,U.jsx)(iI,{machine:e.machine,sessionId:e.sessionId,taskId:s.taskId})]})]})]}),o===void 0&&s===void 0&&(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,U.jsx)(`h2`,{className:`text-muted-foreground px-1 pb-1.5 text-xs font-medium`,children:`Agents`}),a.agents.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No agents in this thread.`}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...a.agents.filter(e=>e.status===`Running`),...a.agents.filter(e=>e.status!==`Running`)].map(t=>{let n=aF(t.item);return(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Open ${n.name} agent: ${n.description}`,className:`bg-secondary hover:bg-accent focus-visible:ring-ring/70 flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[t.status===`Running`?(0,U.jsx)(sF,{className:n.tone}):(0,U.jsx)(oF,{className:n.tone}),(0,U.jsx)(`span`,{className:`text-foreground shrink-0 font-medium`,children:n.name}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:n.description}),(0,U.jsx)(`span`,{className:R(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`),children:t.status})]},t.item.id)})}),(0,U.jsx)(`h2`,{className:`text-muted-foreground px-1 pt-5 pb-1.5 text-xs font-medium`,children:`Tasks`}),a.tasks.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground px-1 py-1 text-xs`,children:`No background tasks in this thread.`}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[...a.tasks.filter(e=>e.status===`Running`),...a.tasks.filter(e=>e.status!==`Running`)].map(t=>(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Open task: ${YP(t.item)}`,className:`bg-secondary hover:bg-accent focus-visible:ring-ring/70 flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-left text-[13px] leading-5 tracking-[-0.04px] select-none focus-visible:ring-2 focus-visible:outline-none`,onClick:()=>e.onSelect(t.item.id),children:[(0,U.jsx)(B,{icon:io,className:R(`size-4 shrink-0`,t.status===`Running`?`text-foreground animate-pulse`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 flex-1 truncate`,children:YP(t.item)}),(0,U.jsx)(`span`,{className:R(`text-muted-foreground shrink-0 text-xs`,t.status===`Failed`&&`text-destructive`),children:t.status})]},t.item.id))})]}),o!==void 0&&(0,U.jsx)(oI,{item:o.item,agentId:o.agentId,running:o.status===`Running`,items:i,found:a,cwd:e.cwd,onSelect:e.onSelect},o.item.id),s!==void 0&&e.sessionId!==null&&(0,U.jsx)(aI,{machine:e.machine,sessionId:e.sessionId,command:s.item.command,path:s.path,events:s.events,running:s.status===`Running`},s.item.id)]})}function iI(e){return(0,U.jsx)(V,{size:`xs`,variant:`outline`,className:`shrink-0`,onClick:()=>Ne(e.machine,e.sessionId,e.taskId),children:`Stop`})}function aI(e){let[t,n]=(0,H.useState)(void 0),[r,i]=(0,H.useState)(null),a=(0,H.useRef)(null),o=(0,H.useRef)(!0);(0,H.useEffect)(()=>{let t=e.path;if(t===null)return;let r=!0;async function a(t){try{let a=await M(e.machine,`tasks.output`,{sessionId:e.sessionId,path:t});if(!r)return;n(a),i(null)}catch(e){r&&i(kt(e))}}a(t);let o=e.running?window.setInterval(()=>void a(t),2e3):null;return()=>{r=!1,o!==null&&window.clearInterval(o)}},[e.machine,e.sessionId,e.path,e.running]),(0,H.useLayoutEffect)(()=>{let e=a.current;e!==null&&o.current&&(e.scrollTop=e.scrollHeight)},[t,e.events]);let s=e.path===null?e.events.join(`
21
+ `):t?.text??``;return(0,U.jsxs)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-3`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[e.command!==``&&(0,U.jsxs)(`p`,{className:`text-muted-foreground pb-2 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap`,children:[`$ `,e.command]}),r!==null&&(0,U.jsx)(`p`,{className:`text-destructive text-xs`,children:r}),r===null&&e.path!==null&&t===void 0&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading…`}),r===null&&e.path!==null&&t===null&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The output file no longer exists.`}),t?.truncated===!0&&(0,U.jsx)(`p`,{className:`text-muted-foreground pb-2 text-xs`,children:`Showing the end of the output.`}),e.path===null&&e.events.length===0&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No events yet.`}),t?.text===``&&(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.running?`No output yet.`:`No output.`}),s!==``&&(0,U.jsx)(`pre`,{className:`bg-secondary text-foreground rounded-lg p-3 font-mono text-xs leading-5 [overflow-wrap:anywhere] whitespace-pre-wrap select-text`,children:s})]})}function oI(e){let t=(0,H.useRef)(null),n=(0,H.useRef)(!0),[r,i]=(0,H.useState)([]);(0,H.useLayoutEffect)(()=>{let e=t.current;e!==null&&n.current&&(e.scrollTop=e.scrollHeight)},[e.items,e.running]);function a(e){i(r.includes(e)?r.filter(t=>t!==e):[...r,e])}let o=e.items.filter(t=>t.parent===e.item.id),s=o.length===0;(0,H.useEffect)(()=>{s&&e.agentId!==null&&Ze(e.item.id,e.agentId)},[s,e.item.id,e.agentId]);let c=o.at(0),l=c?.kind===`user`?c:null,u=_F({prompt:null,first:!1,items:l===null?o:o.slice(1)},e.running?{partial:``}:null);return(0,U.jsxs)(`div`,{ref:t,className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-4 pt-1 pb-8`,onScroll:e=>{let t=e.currentTarget;n.current=t.scrollHeight-t.scrollTop-t.clientHeight<40},children:[l!==null&&(0,U.jsx)(eF,{title:`Prompt`,pending:!1,grouped:!0,open:r.includes(`prompt`),onToggle:()=>a(`prompt`),children:(0,U.jsx)(z,{text:l.text,className:`text-muted-foreground text-[13px]`})}),u.map((t,n)=>{let i=u[n-1];return(0,U.jsx)(`div`,{className:R(i===void 0?`pt-2`:t.kind===`working`?void 0:gF(t)&&gF(i)?`pt-2`:`pt-4`,t.kind===`assistant`&&`group/assistant`),children:(0,U.jsx)(YF,{row:t,agents:e.found.agents,tasks:e.found.tasks,running:e.running,compacting:!1,fork:!1,expanded:r.includes(t.key),onToggle:a,onOpenTask:e.onSelect,rewind:!1,cwd:e.cwd})},t.key)})]})}var sI=(0,H.lazy)(async()=>({default:(await Lr(async()=>{let{EditorDialog:e}=await import(`./editor-dialog-B7QW5wuQ.js`);return{EditorDialog:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))).EditorDialog})),cI=(0,H.lazy)(async()=>({default:(await Lr(async()=>{let{DiffPanel:e}=await import(`./diff-panel-BKiJiAiZ.js`);return{DiffPanel:e}},__vite__mapDeps([22,1,23,3,8,14,4,5,7,24,25,11,26,27,12,16,28,29]))).DiffPanel})),lI=`text-foreground hover:bg-accent data-[pressed=true]:bg-accent relative grid h-7 min-w-7 cursor-pointer place-items-center rounded-lg border border-transparent [&_svg]:size-4 [&_svg]:opacity-80`;function uI(e){let[t,n]=(0,H.useState)(!1),r=fI(e,()=>n(!0));return(0,U.jsxs)(U.Fragment,{children:[r.map(e=>(0,U.jsxs)(`button`,{className:lI,"data-pressed":e.pressed,"aria-label":e.label,title:e.title,onClick:e.onSelect,children:[(0,U.jsx)(B,{icon:e.icon}),e.badge]},e.id)),t&&(0,U.jsx)(H.Suspense,{children:(0,U.jsx)(sI,{machine:e.selection.machine,projectId:e.selection.projectId,onClose:()=>n(!1)})})]})}function dI(e){let[t,n]=(0,H.useState)(!1),r=fI(e,()=>n(!0));return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsxs)($t,{open:e.open,onOpenChange:e.onOpenChange,children:[(0,U.jsx)(dn,{asChild:!0,children:(0,U.jsxs)(`button`,{className:R(lI,`data-[state=open]:bg-accent`),"aria-label":`More`,title:`More`,children:[(0,U.jsx)(B,{icon:No}),r.some(e=>e.attention)&&(0,U.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`})]})}),(0,U.jsxs)(nn,{className:`w-56`,align:`end`,children:[r.map(e=>(0,U.jsxs)(Kt,{onSelect:e.onSelect,children:[(0,U.jsx)(B,{icon:e.icon}),(0,U.jsx)(`span`,{className:`flex-1`,children:e.label}),e.detail]},e.id)),e.children]})]}),t&&(0,U.jsx)(H.Suspense,{children:(0,U.jsx)(sI,{machine:e.selection.machine,projectId:e.selection.projectId,onClose:()=>n(!1)})})]})}function fI(e,t){let n=(0,H.useSyncExternalStore)(rM,()=>iM().alerts.length>0),r=(0,H.useSyncExternalStore)(rM,()=>iM().layout.tabs.filter(t=>t.projectId===e.selection.projectId).length),i=L(e=>{if(e.selection?.sessionId===null)return 0;let t=JP([...e.earlier,...e.items],Ce(e));return[...t.agents,...t.tasks].filter(e=>e.status===`Running`).length});return[{id:`diff`,label:`Diff`,title:`Diff`,icon:po,pressed:e.panel===`diff`,attention:e.changed,badge:e.changed&&(0,U.jsx)(`span`,{className:`bg-muted-foreground ring-background absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2`}),detail:e.changed&&(0,U.jsx)(`span`,{className:`bg-muted-foreground size-1.5 rounded-full`}),onSelect:()=>e.onPanel(e.panel===`diff`?null:`diff`)},{id:`terminal`,label:`Terminal`,title:`Terminal (${Ot}+\`)`,icon:Qo,pressed:e.terminal,attention:n,badge:r>0&&(0,U.jsx)(`span`,{className:R(`absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full px-0.5 text-[8px] leading-none font-medium tabular-nums`,n?`bg-primary text-primary-foreground`:`text-foreground bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))]`),children:r}),detail:r>0&&(0,U.jsx)(`span`,{className:R(`text-xs tabular-nums`,n?`text-primary`:`text-muted-foreground`),children:r}),onSelect:()=>e.onTerminal(!e.terminal)},{id:`tasks`,label:`Tasks`,title:`Tasks`,icon:$o,pressed:e.panel===`tasks`,attention:i>0,badge:i>0&&(0,U.jsx)(`span`,{className:`text-foreground absolute top-0 right-0 grid h-3 min-w-3 place-items-center rounded-full bg-[color-mix(in_srgb,var(--foreground)_22%,var(--background))] px-0.5 text-[8px] leading-none font-medium tabular-nums`,children:i}),detail:i>0&&(0,U.jsx)(`span`,{className:`text-muted-foreground text-xs tabular-nums`,children:i}),onSelect:()=>e.onPanel(e.panel===`tasks`?null:`tasks`)},{id:`browser`,label:`Browser`,title:`Browser`,icon:Ga,pressed:e.panel===`browser`,attention:!1,badge:null,detail:null,onSelect:()=>e.onPanel(e.panel===`browser`?null:`browser`)},{id:`editor`,label:`Editor`,title:`Editor`,icon:ns,pressed:!1,attention:!1,badge:null,detail:null,onSelect:t}]}function pI(e){return(0,U.jsxs)(U.Fragment,{children:[e.panel===`browser`&&(0,U.jsx)(QF,{machine:e.selection.machine,onClose:()=>e.onPanel(null)}),e.panel===`diff`&&(0,U.jsx)(H.Suspense,{children:(0,U.jsx)(cI,{machine:e.selection.machine,projectId:e.selection.projectId,running:e.running,onClose:()=>e.onPanel(null)},`${e.selection.machine} ${e.selection.projectId}`)}),e.panel===`tasks`&&(0,U.jsx)(rI,{machine:e.selection.machine,cwd:e.cwd,sessionId:e.selection.sessionId,selected:e.selectedTask,onSelect:e.onSelectTask,onClose:()=>e.onPanel(null)})]})}function mI(){let e=L(e=>e.selection),t=L(e=>e.machines.length>0),n=j();return n===null?e===null?t?(0,U.jsx)(`div`,{className:`bg-sidebar relative flex min-w-0 flex-1 pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,U.jsx)(KP,{className:`min-w-0 flex-1 border-r-0`,mobile:!0})}):(0,U.jsx)(`main`,{className:`bg-background flex flex-1 overflow-y-auto pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:(0,U.jsx)(RT,{})}):(0,U.jsx)(hI,{selection:e}):(0,U.jsx)(pN,{machine:n,mobile:!0,leading:(0,U.jsx)(V,{variant:`ghost`,size:`icon-xs`,className:`h-full w-11 rounded-none`,"aria-label":`Back`,title:`Back`,onClick:()=>bt(`chat`,()=>void Ae.navigate({to:`/`,search:{},replace:!0})),children:(0,U.jsx)(B,{icon:Ba})})})}function hI(e){let t=L(t=>F(t,e.selection.machine)),n=L(t=>t.sessions.find(t=>t.machine===e.selection.machine&&t.id===e.selection.sessionId)),r=L(t=>pt(t,e.selection.machine,e.selection.projectId)?.path??``),i=Ns(e.selection.machine,e.selection.projectId),a=L(_t),o=af(e.selection.machine,t.status===`online`?e.selection.projectId:null,a),s=of({machine:e.selection.machine,projectId:e.selection.projectId,repos:o.repos,onRefresh:o.refresh}),c=(0,H.useSyncExternalStore)(rM,()=>iM().open),l=re({from:`__root__`,select:e=>e.panel??null}),[u,d]=(0,H.useState)(null),f=o.repos.some(e=>e.changed>0),p=l!==null||c,m=(0,H.useCallback)(e=>{p?se(e):vt(e,`overlay`)},[p]),h=(0,H.useCallback)(e=>{d(null),e===null?gI():m({panel:e,bottom:void 0})},[m]),g=(0,H.useCallback)(e=>{h(`tasks`),d(e)},[h]);function _(e){e?m({panel:void 0,bottom:`terminal`}):gI()}return(0,U.jsxs)(`main`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,U.jsxs)(`header`,{className:`flex h-(--workspace-topbar-height) shrink-0 items-center gap-1.5 px-2`,children:[(0,U.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":`Back`,onClick:()=>bt(`chat`,ut),children:(0,U.jsx)(B,{icon:Ba,className:`text-foreground size-5`,strokeWidth:2})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`text-foreground truncate font-medium`,children:n?.title??`New thread`}),t.status===`online`&&(0,U.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1 text-xs`,children:[(0,U.jsx)(Vu,{icon:t.icon,className:`size-3.5 shrink-0`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[t.name,` / `,i]})]}),t.status!==`online`&&(0,U.jsxs)(`div`,{className:`text-warning-foreground truncate text-xs`,children:[t.status===`connecting`&&`Connecting to ${t.name}…`,t.status===`offline`&&`${t.name} is offline, reconnecting…`,t.status===`unpaired`&&`${t.name} needs pairing`]})]}),(0,U.jsx)(dI,{selection:e.selection,panel:l,terminal:c,changed:f,open:s.menuOpen,onOpenChange:s.setMenuOpen,onPanel:h,onTerminal:_,children:o.repos.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Ut,{}),(0,U.jsx)(sf,{git:s,collapsed:!0})]})}),(0,U.jsx)(cf,{git:s})]}),(0,U.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(qF,{onOpenTask:g}),(0,U.jsx)(Ed,{})]},`${e.selection.machine} ${e.selection.sessionId??e.selection.projectId}`)}),(0,U.jsx)(Or,{open:p,onOpenChange:()=>h(null),children:(0,U.jsx)(Mr,{children:(0,U.jsxs)(wr,{"aria-describedby":void 0,className:`bg-background data-open:animate-in data-open:slide-in-from-right fixed inset-0 z-40 flex flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] text-sm duration-200 outline-none [--workspace-topbar-height:44px] motion-reduce:animate-none`,children:[(0,U.jsxs)(Pr,{className:`sr-only`,children:[l===`diff`&&`Diff`,l===`tasks`&&`Tasks`,l===`browser`&&`Browser`,l===null&&`Terminal`]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[l!==null&&(0,U.jsx)(pI,{panel:l,selection:e.selection,cwd:r,running:a,selectedTask:u,onSelectTask:d,onPanel:h}),l===null&&c&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`border-border/60 flex h-(--workspace-topbar-height) shrink-0 items-center gap-1 border-b px-3`,children:[(0,U.jsx)(V,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:()=>_(!1),children:(0,U.jsx)(B,{icon:ct,className:`size-3.5`})}),(0,U.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Terminal`})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,U.jsx)(cN,{view:e.selection.projectId})})]})]})]})})})]})}function gI(){bt(`overlay`,()=>se({panel:void 0,bottom:void 0}))}var _I=window.matchMedia(`(min-width: 768px)`),vI=800;function yI(e){return _I.addEventListener(`change`,e),()=>_I.removeEventListener(`change`,e)}function bI(){let e=(0,H.useSyncExternalStore)(yI,()=>_I.matches);return Ms(`mod+k`,()=>ce(!I().paletteOpen),{enableOnFormTags:!0,preventDefault:!0}),(0,U.jsxs)(`div`,{className:`flex h-dvh text-sm`,children:[e?(0,U.jsx)(SI,{}):(0,U.jsx)(mI,{}),(0,U.jsx)(zE,{}),e?(0,U.jsx)(MT,{}):(0,U.jsx)(LT,{}),(0,U.jsx)(Hd,{}),(0,U.jsx)(xl,{position:e?`bottom-right`:`top-center`,swipeDirections:e?[`right`,`bottom`]:[`left`,`right`,`top`]})]})}function xI(e){se({panel:e??void 0})}function SI(){let e=L(e=>e.selection),t=L(e=>e.sessions),n=j(),r=L(e=>e.selection===null?``:pt(e,e.selection.machine,e.selection.projectId)?.path??``),i=L(e=>{let t=Qe(e);return t===null?null:F(e,t)}),[a,o]=(0,H.useState)(!0),s=(0,H.useRef)(null),[c,l]=(0,H.useState)(!1),u=re({from:`__root__`,select:e=>e.panel??null}),d=(0,H.useRef)(`diff`),[f,p]=(0,H.useState)(null),m=(0,H.useCallback)(e=>{p(e),xI(`tasks`)},[]),[h,g]=dr(`panelWidth`,540),[_,v]=(0,H.useState)(280),y=(0,H.useSyncExternalStore)(rM,()=>iM().open),b=L(_t),x=af(e?.machine??``,i?.status===`online`?e?.projectId??null:null,b),S=of({machine:e?.machine??``,projectId:e?.projectId??``,repos:x.repos,onRefresh:x.refresh}),C=t.find(t=>t.machine===e?.machine&&t.id===e.sessionId),w=Ns(e?.machine??``,e?.projectId??``);return Ms([`meta+backquote`,`ctrl+backquote`],e=>{e.stopPropagation(),fM(!iM().open)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),Ms([`mod+j`,`mod+shift+b`],e=>{e.stopPropagation(),xI(mt().panel===void 0?d.current:null)},{enableOnFormTags:!0,preventDefault:!0,eventListenerOptions:{capture:!0}}),(0,H.useEffect)(()=>{u!==null&&(d.current=u)},[u]),Ms([`mod+b`,`mod+shift+j`],()=>o(e=>!e),{enableOnFormTags:!0,preventDefault:!0}),(0,H.useEffect)(()=>{if(n!==null)return;let e=s.current;if(e===null)throw Error(`header is not mounted`);let t=new ResizeObserver(e=>l(e[0].contentRect.width<vI));return t.observe(e),()=>t.disconnect()},[n]),n===null?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(KP,{className:R(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),!a&&(0,U.jsx)(`div`,{className:`fixed top-0 left-3 z-50 flex h-(--workspace-topbar-height) items-center`,children:(0,U.jsx)(V,{variant:`ghost`,size:`icon-sm`,"aria-label":`Show sidebar`,title:`Show sidebar (${Ot}+B)`,onClick:()=>o(!0),children:(0,U.jsx)(B,{icon:Yn})})}),(0,U.jsxs)(`main`,{className:`bg-background relative flex min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,U.jsxs)(`header`,{ref:s,className:R(`bg-background flex h-(--workspace-topbar-height) shrink-0 items-center gap-3 pr-3 pl-[3.25rem]`,a&&`pl-5`),children:[e!==null&&i!==null&&(0,U.jsx)(`nav`,{className:`min-w-0 flex-1`,children:(0,U.jsxs)(`ol`,{className:`flex min-w-0 items-center gap-3 text-sm`,children:[(0,U.jsxs)(`li`,{className:`text-icon-muted flex shrink-0 items-center gap-1.5`,children:[(0,U.jsx)(Vu,{icon:i.icon,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`max-w-40 truncate`,children:i.name})]}),(0,U.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,U.jsxs)(`li`,{className:`text-muted-foreground flex min-w-0 shrink items-center gap-1.5 font-medium`,title:`${i.name}:${r}`,children:[(0,U.jsx)(zs,{machine:e.machine,projectId:e.projectId,className:`size-3.5`}),(0,U.jsx)(`span`,{className:`max-w-40 truncate`,children:w})]}),(0,U.jsx)(`li`,{"aria-hidden":!0,className:`text-icon-muted shrink-0`,children:`/`}),(0,U.jsx)(`li`,{className:R(`text-foreground min-w-10 truncate font-medium`,a&&`flex-1`),children:C?.title??`New thread`}),!a&&(0,U.jsx)(`li`,{className:`shrink-0`,children:(0,U.jsx)(VP,{hideDone:!0})})]})}),e===null&&!a&&(0,U.jsx)(VP,{hideDone:!0}),e===null&&(0,U.jsx)(`span`,{className:`flex-1`}),i!==null&&i.status!==`online`&&(0,U.jsxs)(`span`,{className:`text-warning-foreground shrink-0 text-xs`,children:[i.status===`connecting`&&`Connecting to ${i.name}…`,i.status===`offline`&&`${i.name} is offline, reconnecting…`,i.status===`unpaired`&&`${i.name} needs pairing`]}),e!==null&&(0,U.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[!c&&x.repos.length>0&&(0,U.jsx)(lf,{machine:e.machine,projectId:e.projectId,repos:x.repos,onRefresh:x.refresh}),c&&x.repos.length>0&&(0,U.jsxs)($t,{open:S.menuOpen,onOpenChange:S.setMenuOpen,children:[(0,U.jsx)(dn,{asChild:!0,children:(0,U.jsx)(V,{variant:`ghost`,size:`icon-sm`,"aria-label":`Git actions`,title:`Git actions`,children:(0,U.jsx)(B,{icon:No})})}),(0,U.jsx)(nn,{className:`w-56`,align:`end`,children:(0,U.jsx)(sf,{git:S,collapsed:!0})})]}),(0,U.jsx)(`span`,{className:`bg-foreground/15 mr-1 ml-2.5 h-4 w-px`}),(0,U.jsx)(uI,{selection:e,panel:u,terminal:y,changed:x.repos.some(e=>e.changed>0),onPanel:e=>{p(null),xI(e)},onTerminal:fM})]})]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden`,children:[(0,U.jsxs)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:[i===null&&(0,U.jsx)(RT,{}),e===null&&i!==null&&(0,U.jsx)(`div`,{className:`grid flex-1 place-items-center p-6 text-center`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h1`,{className:`text-foreground text-3xl font-normal tracking-tight`,children:`Pick a thread, or start one`}),(0,U.jsx)(`p`,{className:`text-muted-foreground mt-2 text-sm`,children:`Open a project from the sidebar to talk to Claude.`})]})}),e!==null&&(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(qF,{onOpenTask:m}),(0,U.jsx)(Ed,{})]},`${e.machine} ${e.sessionId??e.projectId}`)]}),e!==null&&y&&(0,U.jsxs)(`aside`,{className:`border-border/80 bg-background relative shrink-0 overflow-hidden border-t`,style:{height:_},children:[(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,className:`group absolute inset-x-0 top-0 z-30 h-1.5 cursor-row-resize touch-none select-none`,onPointerDown:e=>Dt(e,e=>{let t=Math.max(120,Math.floor(window.innerHeight*.8));v(Math.min(t,Math.max(120,window.innerHeight-e.clientY)))}),children:(0,U.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-x-0 top-0 h-px transition-colors`})}),(0,U.jsx)(cN,{view:e.projectId})]})]}),e!==null&&u!==null&&(0,U.jsxs)(`div`,{className:`relative flex shrink-0`,style:{width:h},children:[(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,className:`group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none`,onPointerDown:e=>Dt(e,e=>{let t=Math.max(360,Math.floor(window.innerWidth*.7)),n=Math.min(t,Math.max(360,window.innerWidth-e.clientX));g(n)}),children:(0,U.jsx)(`span`,{className:`group-hover:bg-border group-active:bg-primary/60 pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors`})}),(0,U.jsx)(`div`,{className:`bg-background flex min-w-0 flex-1 flex-col overflow-hidden rounded-tl-lg border-t border-l`,children:(0,U.jsx)(pI,{panel:u,selection:e,cwd:r,running:b,selectedTask:f,onSelectTask:p,onPanel:xI})})]})]})]}),(0,U.jsx)(cf,{git:S})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(KP,{className:R(`relative`,!a&&`hidden`),mobile:!1,onHide:()=>o(!1)}),(0,U.jsx)(pN,{machine:n,mobile:!1,leading:!a&&(0,U.jsx)(V,{variant:`ghost`,size:`icon-xs`,"aria-label":`Show sidebar`,title:`Show sidebar (${Ot}+B)`,onClick:()=>o(!0),children:(0,U.jsx)(B,{icon:Yn})})})]})}var CI=class extends H.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(e,t.componentStack)}render(){let e=this.state.error;return e===null?this.props.children:(0,U.jsxs)(`div`,{className:`flex h-dvh flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:`Something went wrong`}),(0,U.jsx)(`p`,{className:`text-muted-foreground max-w-xl text-sm whitespace-pre-wrap`,children:e.message}),(0,U.jsx)(V,{onClick:()=>location.reload(),children:`Reload`})]})}},wI=document.getElementById(`root`);if(!wI)throw Error(`root element missing`);if(`serviceWorker`in navigator){let e=navigator.serviceWorker.controller!==null,t=document.querySelector(`link[rel="manifest"]`)!==null;navigator.serviceWorker.addEventListener(`controllerchange`,()=>{e&&location.reload()}),navigator.serviceWorker.addEventListener(`message`,e=>{e.data.type===`openSession`&&Ue({machine:e.data.machine,projectId:e.data.project,sessionId:e.data.sessionId})}),navigator.serviceWorker.register(t?`/sw.js?pwa`:`/sw.js`,{type:`classic`}).catch(e=>console.error(`could not register the service worker`,e))}addEventListener(`keydown`,e=>{(e.metaKey||e.ctrlKey)&&e.key===`w`&&e.preventDefault()},{capture:!0}),await St(),P(),tt({open:e=>{da(e).catch(e=>console.error(`could not refresh the push subscription`,e))}}),xa(),Qj(),Ae.routeTree.update({component:bI}),(0,pi.createRoot)(wI).render((0,U.jsx)(H.StrictMode,{children:(0,U.jsx)(CI,{children:(0,U.jsx)(si,{router:Ae})})}));
@@ -10,7 +10,7 @@
10
10
  name="viewport"
11
11
  content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content"
12
12
  />
13
- <script type="module" crossorigin src="/assets/index-CSAtswoY.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-C6uF49Ez.js"></script>
14
14
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-COiEfhsA.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/utils-U6QfaJBO.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/tags-DrTyXsO5.js">