codexui-android 0.1.97 → 0.1.99

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.
@@ -1,39 +0,0 @@
1
- import{_ as Cn,o as r,c as l,a as d,d as As,u as Es,r as C,w as X,n as mt,b as Fs,e as Bs,t as h,f as k,F as g,g as w,h as x,i as Rs,j as bn,k as Ws,l as vt,m as J,I as Os,p as zs,q as js,s as xn,v as He,x as kt,y as Y,T as Hs,z as L,A as Ds}from"./index-Bqk3qCGk.js";const Vs={},Ns={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Us(M,ve){return r(),l("svg",Ns,[...ve[0]||(ve[0]=[d("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const qs=Cn(Vs,[["render",Us]]),Ks={key:0,class:"conversation-loading"},Zs={key:1,class:"conversation-empty"},Gs={key:0,class:"conversation-load-more"},Xs=["disabled"],Js=["data-role","data-message-type"],Ys={key:0,class:"message-row","data-role":"system"},Qs={class:"message-stack","data-role":"system"},ei=["onClick"],ti={class:"cmd-group-label"},ni={class:"cmd-status"},si={class:"cmd-group-inner"},ii=["onClick"],oi={class:"cmd-label"},ai={class:"cmd-status"},ri={class:"cmd-output-inner"},li=["textContent"],ci=["onClick"],ui={class:"cmd-label"},di={class:"cmd-status"},fi={class:"cmd-output-inner"},hi=["textContent"],pi=["data-role","data-message-type"],mi=["data-role"],vi=["data-role"],ki={key:0,class:"file-change-summary-block"},gi=["onClick"],yi={class:"file-change-summary-label"},_i={class:"file-change-summary-status"},wi=["data-tone"],bi={class:"file-change-panel-inner"},xi={class:"file-change-list"},Ci=["data-operation"],$i=["title","onClick"],Li={key:0,class:"file-change-arrow"},Ti=["title","onClick"],Mi={key:2,class:"file-change-delta"},Si=["data-tone"],Pi=["data-role","data-message-type"],Ii=["data-role"],Ai=["data-role"],Ei=["data-role"],Fi=["onClick"],Bi=["src","alt"],Ri={key:1,class:"message-file-attachments"},Wi=["href","title"],Oi=["data-role"],zi={key:0,class:"worked-separator-wrap","aria-live":"polite"},ji=["onClick"],Hi={class:"worked-separator-text"},Di={key:0,class:"worked-details"},Vi=["onClick"],Ni={class:"cmd-label"},Ui={class:"cmd-status"},qi={class:"cmd-output-inner"},Ki=["textContent"],Zi=["data-streaming"],Gi={class:"plan-card-header"},Xi={key:0,class:"plan-card-badge"},Ji=["innerHTML"],Yi={key:1,class:"plan-step-list"},Qi=["data-status"],eo=["data-status"],to=["innerHTML"],no=["innerHTML"],so={key:2,class:"message-text-flow"},io={key:0,class:"message-text"},oo={key:0},ao={key:1,class:"message-bold-text"},ro={key:2,class:"message-italic-text"},lo={key:3,class:"message-strikethrough-text"},co=["href","title"],uo=["href","title"],fo={key:6,class:"message-inline-code"},ho={key:0},po={key:1,class:"message-bold-text"},mo={key:2,class:"message-italic-text"},vo={key:3,class:"message-strikethrough-text"},ko=["href","title"],go=["href","title"],yo={key:6,class:"message-inline-code"},_o={key:2,class:"message-blockquote"},wo={key:0},bo={key:1,class:"message-bold-text"},xo={key:2,class:"message-italic-text"},Co={key:3,class:"message-strikethrough-text"},$o=["href","title"],Lo=["href","title"],To={key:6,class:"message-inline-code"},Mo={key:3,class:"message-list message-list-unordered"},So=["innerHTML"],Po={key:4,class:"message-list message-task-list"},Io=["data-checked"],Ao={class:"message-list-item-text"},Eo={key:0},Fo={key:1,class:"message-bold-text"},Bo={key:2,class:"message-italic-text"},Ro={key:3,class:"message-strikethrough-text"},Wo=["href","title"],Oo=["href","title"],zo={key:6,class:"message-inline-code"},jo=["start"],Ho=["innerHTML"],Do={key:6,class:"message-table-wrap"},Vo={class:"message-table"},No={key:0},Uo={key:1,class:"message-bold-text"},qo={key:2,class:"message-italic-text"},Ko={key:3,class:"message-strikethrough-text"},Zo=["href","title"],Go=["href","title"],Xo={key:6,class:"message-inline-code"},Jo={key:0},Yo={key:0},Qo={key:1,class:"message-bold-text"},ea={key:2,class:"message-italic-text"},ta={key:3,class:"message-strikethrough-text"},na=["href","title"],sa=["href","title"],ia={key:6,class:"message-inline-code"},oa={key:7,class:"message-code-block"},aa={key:0,class:"message-code-language"},ra={class:"message-code-pre"},la=["innerHTML"],ca={key:8,class:"message-divider"},ua={key:9,class:"message-text"},da=["onClick"],fa=["src","alt","onError"],ha={key:3,class:"file-change-summary-block file-change-summary-block-inline"},pa=["onClick"],ma={class:"file-change-summary-label"},va={class:"file-change-summary-status"},ka=["data-tone"],ga={class:"file-change-panel-inner"},ya={class:"file-change-list"},_a=["data-operation"],wa=["title","onClick"],ba={key:0,class:"file-change-arrow"},xa=["title","onClick"],Ca={key:2,class:"file-change-delta"},$a=["data-tone"],La=["data-role"],Ta=["onClick"],Ma=["onClick"],Sa=["data-copied","aria-label","title","onClick"],Pa={class:"message-copy-label"},Ia={key:1,class:"conversation-item conversation-item-overlay"},Aa={class:"message-row"},Ea={class:"message-stack"},Fa={class:"live-overlay-inline","aria-live":"polite"},Ba={class:"live-overlay-label"},Ra={key:0,class:"live-overlay-reasoning"},Wa={key:1,class:"live-overlay-error"},Oa=["src"],za={key:0,class:"diff-viewer-sidebar"},ja={class:"diff-viewer-sidebar-header"},Ha={class:"diff-viewer-sidebar-count"},Da={class:"diff-viewer-sidebar-list"},Va=["data-active","onClick"],Na=["data-operation"],Ua={class:"diff-viewer-file-label"},qa={key:0,class:"diff-viewer-file-delta"},Ka={class:"diff-viewer-main"},Za={class:"diff-viewer-toolbar"},Ga={class:"diff-viewer-title-wrap"},Xa={class:"diff-viewer-title"},Ja={class:"diff-viewer-subtitle"},Ya={key:0},Qa={class:"diff-viewer-toolbar-actions"},er={key:0,class:"diff-viewer-empty"},tr={key:1,class:"diff-viewer-panel"},nr={class:"diff-viewer-meta"},sr={class:"diff-viewer-language"},ir={class:"diff-viewer-lines"},or=["data-kind"],ar={class:"diff-viewer-line-number"},rr={class:"diff-viewer-line-number"},lr={class:"diff-viewer-line-marker"},cr=["innerHTML"],ur={class:"diff-viewer-mobile-sheet-header"},dr={class:"diff-viewer-sidebar-count"},fr={class:"diff-viewer-mobile-sheet-list"},hr=["data-active","onClick"],pr=["data-operation"],mr={class:"diff-viewer-file-label"},vr={key:0,class:"diff-viewer-file-delta"},kr=16,gt=50,gr=30,yr=200,_r=As({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","forkThread","rollback","respondServerRequest"],setup(M,{expose:ve,emit:$n}){var wn;const le=C(new Set),O=C(new Set),ce=C(new Set),De=C(new Set),ue=C(new Set),Ve=C(null),ke=C(""),D=C(!1),yt=C(null),de=C(!1),_t=C(0),wt=C(0),Ne=C(""),Ue=C(""),{isMobile:ge}=Es();function Ln(e){var i;const n=e.replace(/\r\n/g,`
2
- `).trim();if(!n)return null;const t=[],s=[];for(const a of n.split(`
3
- `)){const u=a.trim();if(!u){t.length===0&&s.push("");continue}const o=u.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(o){const f=(o[1]??" ").toLowerCase();let c="pending";f==="x"&&(c="completed"),(f==="~"||f===">"||f==="-")&&(c="inProgress"),t.push({step:((i=o[2])==null?void 0:i.trim())??"",status:c});continue}s.push(u)}return t.length===0?null:{explanation:s.join(`
4
- `).trim(),steps:t.filter(a=>a.step.length>0)}}function qe(e){var n;return e.plan&&e.plan.steps.length>0?{explanation:((n=e.plan.explanation)==null?void 0:n.trim())??"",steps:e.plan.steps}:Ln(e.text)}function A(e){return e.messageType==="commandExecution"&&!!e.commandExecution}function bt(e){return e.messageType==="plan"||e.messageType==="plan.live"}function Ke(e){return e.messageType==="fileChange"&&e.fileChangeStatus==="completed"&&Array.isArray(e.fileChanges)&&e.fileChanges.length>0}function ye(e){return e.role==="assistant"&&!A(e)&&e.messageType!=="worked"&&!(e.messageType??"").endsWith(".live")}const Ze=L(()=>{var e;for(let n=v.messages.length-1;n>=0;n-=1){const t=v.messages[n];if(t.messageType==="commandExecution"&&((e=t.commandExecution)==null?void 0:e.status)==="inProgress")return t.id}return""}),xt=L(()=>v.messages.some(e=>e.role==="assistant"&&e.messageType==="agentMessage.live"&&e.text.trim().length>0)),Ct=L(()=>!!v.liveOverlay||Ze.value.length>0||xt.value),Ge=L(()=>{const e={};for(let n=0;n<v.messages.length;){const t=v.messages[n];if(!A(t)){n+=1;continue}const s=[];for(;n<v.messages.length&&A(v.messages[n]);)s.push(v.messages[n]),n+=1;if(s.length<=1)continue;const i=s[s.length-1];e[i.id]=s.slice(0,-1)}return e}),Tn=L(()=>{const e=new Set;for(const n of Object.values(Ge.value))for(const t of n)e.add(t.id);return e});function $t(e){var n;return((n=qe(e))==null?void 0:n.explanation)??""}function Lt(e){var n;return((n=qe(e))==null?void 0:n.steps)??[]}function Mn(e){switch(e){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function Tt(e){return!xt.value&&e.id===Ze.value}function E(e){return A(e)?le.value.has(e.id)||!O.value.has(e.id)&&Tt(e):!1}function Xe(e){return A(e)&&Ct.value}function Je(e){var n;return A(e)&&(Ct.value||((n=e.commandExecution)==null?void 0:n.status)==="inProgress")}function Ye(e){if(!A(e))return;const n=new Set(le.value),t=new Set(O.value),s=Tt(e);n.has(e.id)?(n.delete(e.id),s&&t.add(e.id)):s&&!t.has(e.id)?t.add(e.id):(n.add(e.id),t.delete(e.id)),le.value=n,O.value=t}function _e(e){return Ge.value[e.id]??[]}function Mt(e){return A(e)?[..._e(e),e]:[]}function Sn(e){if(_e(e).length===0)return;const t=new Set(ce.value);t.has(e.id)?t.delete(e.id):t.add(e.id),ce.value=t}function Qe(e){return ce.value.has(e.id)}function Pn(e){var a,u;const t=Mt(e).length,s=((u=(a=e.commandExecution)==null?void 0:a.command)==null?void 0:u.trim())||"(command)";return`${t===1?"1 command":`${t} commands`} · latest: ${s}`}function In(e){return be(e)}function An(e){const n=new Set(De.value);n.has(e.id)?n.delete(e.id):n.add(e.id),De.value=n}function St(e){return De.value.has(e.id)}function Pt(e){const n=new Set(ue.value);n.has(e.id)?n.delete(e.id):n.add(e.id),ue.value=n}function Q(e){return ue.value.has(e.id)}function T(e){return`${e.path}\0${e.movedToPath??""}`}function we(e,n){e&&(Ve.value=e,ke.value=T(n),D.value=!1)}function It(){Ve.value=null,ke.value="",D.value=!1}function En(){D.value=!D.value}function Fn(){D.value=!1}function At(e){ke.value=T(e),ge.value&&(D.value=!1)}function be(e){const n=e.commandExecution;if(!n)return"";const t=Xe(e);switch(n.status){case"inProgress":return t?"Running":"⟳ Running";case"completed":return n.exitCode===0?t?"Done":"✓ Completed":`Exit ${n.exitCode??"?"}`;case"failed":return t?"Failed":"✗ Failed";case"declined":return t?"Declined":"⊘ Declined";case"interrupted":return t?"Stopped":"⊘ Interrupted";default:return""}}function xe(e){var t,s;const n=(t=e.commandExecution)==null?void 0:t.status;return n==="inProgress"?"cmd-status-running":n==="completed"&&((s=e.commandExecution)==null?void 0:s.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function Ce(e,n){if(e.size===0)return e;const t=new Set;for(const s of e)n.has(s)&&t.add(s);return t.size===e.size?e:t}function Bn(e,n){const t=[];for(let s=n-1;s>=0;s--){const i=e[s];if(i.messageType==="commandExecution")t.unshift(i);else if(i.role==="user"||i.messageType==="worked")break}return t}const v=M,et=$n,V=C(null),Et=C(null),fe=C(""),N=C(""),Rn=C(null),z=C(((wn=v.scrollState)==null?void 0:wn.isAtBottom)!==!1),Ft={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",md:"markdown","c++":"cpp","c#":"csharp",ps1:"powershell"};let ee=0,F=0,$e=0,te=null;const Bt=new WeakSet,Le=C(null);let Te=null;const B=C(0),U=C(!1),Wn=L(()=>v.messages.slice(B.value)),tt=L(()=>B.value>0),On=L(()=>!z.value&&(v.messages.length>0||v.pendingRequests.length>0||!!v.liveOverlay));function zn(){return Le.value?Promise.resolve():(Te||(Te=Ds(()=>import("./common-BeuopZEI.js"),[]).then(e=>{Le.value=e.default}).finally(()=>{Te=null})),Te)}function jn(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const n=e.startsWith("/"),t=/^[A-Za-z]:[\\/]/u.test(e),s=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return n||t||s?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function Me(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function ne(e){return e.replace(/\\/gu,"/")}function Rt(e){if(!e.startsWith("file://"))return e;let n=e.replace(/^file:\/\//u,"");try{n=decodeURIComponent(n)}catch{}return/^\/[A-Za-z]:\//u.test(n)&&(n=n.slice(1)),n}function Hn(e){const n=ne(e),t=n.match(/^\/Users\/([^/]+)/u);if(t)return`/Users/${t[1]}`;const s=n.match(/^\/home\/([^/]+)/u);return s?`/home/${s[1]}`:""}function se(e){const n=ne(e);if(!n)return n;let t="",s=n;const i=s.match(/^([A-Za-z]:)(\/.*)?$/u);i?(t=`${i[1]}/`,s=(i[2]??"").replace(/^\/+/u,"")):s.startsWith("/")&&(t="/",s=s.slice(1));const a=s.split("/").filter(Boolean),u=[];for(const f of a)if(f!=="."){if(f===".."){u.length>0&&u.pop();continue}u.push(f)}const o=u.join("/");return t?`${t}${o}`.replace(/\/+$/u,"")||t:o||n}function Wt(e,n){const t=ne(Rt(e.trim()));if(!t)return"";if(t.startsWith("/")||/^[A-Za-z]:\//u.test(t))return se(t);if(t.startsWith("~/")){const a=Hn(n);if(a)return se(`${a}/${t.slice(2)}`)}const i=ne(n.trim());return se(i?`${i.replace(/\/+$/u,"")}/${t}`:t)}function he(e){if(!e)return null;let n=e.trim();n=Se(n).core.trim();let s=null;const i=n.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(i)n=i[1],s=Number(i[2]);else{const a=n.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(n=a[1],s=Number(a[2]))}return n=Rt(n),jn(n)?{path:n,line:s}:null}function Se(e){let n=e,t="",s="";const i={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;n.length>0;){const a=n[0],u=Object.prototype.hasOwnProperty.call(i,a)?i[a]:"";if(!u||!n.endsWith(u))break;t+=a,s+=u,n=n.slice(1,-1)}return{core:n,leading:t,trailing:s}}function nt(e){const n=e.trim();if(!n.startsWith("[")||!n.endsWith(")"))return null;const t=n.indexOf("]");if(t<=1||n[t+1]!=="(")return null;const s=n.slice(1,t).trim(),i=n.slice(t+2,-1).trim();if(s.includes(`
5
- `)||i.includes(`
6
- `))return null;const a=Se(s).core.trim()||s,u=Se(i).core.trim();return u?{label:a,target:u}:null}function Ot(e){const n=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(n)}`}function zt(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function Dn(e){switch(e){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function Vn(e){var s;const n=qe(e);if(!n)return"";const t=[];return(s=n.explanation)!=null&&s.trim()&&t.push(n.explanation.trim()),n.steps.length>0&&t.push(n.steps.map(i=>`- ${Dn(i.status)} ${i.step}`.trim()).join(`
7
- `)),t.join(`
8
-
9
- `).trim()}function Nn(e){const n=[],t=e.text.trim()||Vn(e),s=bt(e)&&t?`Plan
10
- ${t}`:t;s&&n.push(s);const i=(e.fileAttachments??[]).map(u=>u.path.trim()).filter(u=>u.length>0);i.length>0&&n.push(`Files:
11
- ${i.join(`
12
- `)}`);const a=(e.images??[]).map(u=>u.trim()).filter(u=>u.length>0);return a.length>0&&n.push(`Images:
13
- ${a.join(`
14
- `)}`),n.join(`
15
-
16
- `).trim()}const jt=L(()=>{var t;const e=new Map;for(const s of v.messages){if(!ye(s))continue;const i=Nn(s);if(!i)continue;const a=typeof s.turnIndex=="number"?`turn:${s.turnIndex}`:`message:${s.id}`,u=e.get(a);if(u){u.anchorMessageId=s.id,u.parts.push(i);continue}e.set(a,{anchorMessageId:s.id,parts:[i]})}const n={};for(const s of e.values()){const i=s.parts.join(`
17
-
18
- `).trim();i&&(n[s.anchorMessageId]=i)}for(const[s,i]of Object.entries(Pe.value)){if(i.source!=="metadata")continue;const a=Jn(i);if(!a)continue;const u=(t=n[s])==null?void 0:t.trim();n[s]=u?`${u}
19
-
20
- ${a}`:a}return n}),Ht=L(()=>{const e=new Map;for(const t of v.messages){if(!ye(t)||typeof t.turnIndex!="number")continue;const s=`turn:${t.turnIndex}`,i=e.get(s);if(i){i.anchorMessageId=t.id,i.turnIndex=t.turnIndex;continue}e.set(s,{anchorMessageId:t.id,turnIndex:t.turnIndex})}const n={};for(const t of e.values())n[t.anchorMessageId]=t.turnIndex;return n});function Dt(e){return typeof jt.value[e.id]=="string"}function Un(e){return typeof Ht.value[e.id]=="number"}function qn(e,n){return e?!n||e===n?e:`${e}
21
- ${n}`.trim():n}function Kn(e,n){const t=e.operation==="add"||n.operation==="add"?"add":e.operation==="delete"||n.operation==="delete"?"delete":"update";return{path:n.path||e.path,operation:t,movedToPath:n.movedToPath??e.movedToPath??null,diff:qn(e.diff,n.diff),addedLineCount:e.addedLineCount+n.addedLineCount,removedLineCount:e.removedLineCount+n.removedLineCount}}function Zn(e,n){const t=e.operation==="add"?0:e.operation==="update"?1:2,s=n.operation==="add"?0:n.operation==="update"?1:2;if(t!==s)return t-s;const i=`${e.path}\0${e.movedToPath??""}`,a=`${n.path}\0${n.movedToPath??""}`;return i.localeCompare(a)}function st(e){const n=new Map;for(const t of e){const s=`${t.path}\0${t.movedToPath??""}`,i=n.get(s);n.set(s,i?Kn(i,t):{...t})}return Array.from(n.values()).sort(Zn)}const Pe=L(()=>{const e=new Map,n=new Map,t=new Map;for(const i of v.messages){if(ye(i)&&typeof i.turnIndex=="number"&&(e.set(`turn:${i.turnIndex}`,i.id),Array.isArray(i.fileChanges)&&i.fileChanges.length>0&&n.set(i.id,{changes:st(i.fileChanges),sourceMessageIds:[],source:"assistant"})),!Ke(i))continue;const a=typeof i.turnIndex=="number"?`turn:${i.turnIndex}`:`message:${i.id}`,u=t.get(a);u?u.push(i):t.set(a,[i])}const s={};for(const[i,a]of t.entries()){const u=e.get(i);u&&(s[u]={changes:st(a.flatMap(o=>o.fileChanges??[])),sourceMessageIds:a.map(o=>o.id),source:"metadata"})}for(const[i,a]of n.entries())s[i]||(s[i]=a);return s}),it=L(()=>{const e=new Map,n=new Map;for(const s of v.messages){if(ye(s)&&typeof s.turnIndex=="number"&&e.set(`turn:${s.turnIndex}`,s.id),!Ke(s))continue;const i=typeof s.turnIndex=="number"?`turn:${s.turnIndex}`:`message:${s.id}`,a=n.get(i);a?a.push(s):n.set(i,[s])}const t={};for(const[s,i]of n.entries()){if(e.has(s))continue;const a=i[i.length-1];a&&(t[a.id]={changes:st(i.flatMap(u=>u.fileChanges??[])),sourceMessageIds:i.map(u=>u.id),source:"metadata"})}return t}),Gn=L(()=>{const e=new Set;for(const n of Object.values(Pe.value))for(const t of n.sourceMessageIds)e.add(t);for(const[n,t]of Object.entries(it.value))for(const s of t.sourceMessageIds)s!==n&&e.add(s);return e});function ie(e){return Pe.value[e.id]??null}function oe(e){return it.value[e.id]??null}function ae(e){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?"Moved + edited":"Moved":e.operation==="add"?"Added":e.operation==="delete"?"Deleted":"Edited"}function Ie(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function q(e){const n=[];return e.addedLineCount>0&&n.push(`+${e.addedLineCount}`),e.removedLineCount>0&&n.push(`-${e.removedLineCount}`),n.join(" ")}function Vt(e,n,t=""){const s=[];return e>0&&s.push({tone:"add",label:`+${e}`}),n>0&&s.push({tone:"remove",label:`-${n}`}),s.length>0?s:t?[{tone:"neutral",label:t}]:[]}function Nt(e){return Vt(e.addedLineCount,e.removedLineCount)}function Ae(e){return e===1?"1 file changed":`${e} files changed`}function Xn(e){if(!e||e.changes.length===0)return"";let n=0,t=0,s=0,i=0;for(const u of e.changes){if(u.operation==="add"){n+=1;continue}if(u.operation==="delete"){t+=1;continue}if(u.movedToPath){i+=1;continue}s+=1}const a=[];return s>0&&a.push(`${s} edited`),n>0&&a.push(`${n} added`),t>0&&a.push(`${t} deleted`),i>0&&a.push(`${i} moved`),a.join(", ")}function Ut(e){if(!e||e.changes.length===0)return"Modified files";const n=Ae(e.changes.length),t=Xn(e);return t?`${n} · ${t}`:n}function qt(e){if(!e||e.changes.length===0)return[];const n=e.changes.reduce((i,a)=>i+a.addedLineCount,0),t=e.changes.reduce((i,a)=>i+a.removedLineCount,0),s=e.changes.some(i=>i.movedToPath)?"Moved":"Ready";return Vt(n,t,s)}function S(e){const n=Wt(e,v.cwd),t=se(ne(v.cwd.trim())),s=se(ne(n));return t&&s.startsWith(`${t}/`)?s.slice(t.length+1):e}function Jn(e){return!e||e.changes.length===0?"":`Modified files:
22
- ${e.changes.map(t=>{const s=S(t.path),i=t.movedToPath?` -> ${S(t.movedToPath)}`:"",a=q(t);return`- ${ae(t)}: ${s}${i}${a?` (${a})`:""}`}).join(`
23
- `)}`.trim()}const re=L(()=>{var e;return((e=Ve.value)==null?void 0:e.changes)??[]}),P=L(()=>{const e=re.value;return e.length===0?null:e.find(n=>T(n)===ke.value)??e[0]});function Yn(e){var s;const t=((s=(e.movedToPath||e.path).split(".").pop())==null?void 0:s.toLowerCase())??"";return Ft[t]??t??""}function Qn(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function es(e){const n=e.diff.replace(/\r\n/g,`
24
- `),t=n.length>0?n.split(`
25
- `):[];return t.length>0&&t[t.length-1]===""&&t.pop(),t.map((s,i)=>({key:`${T(e)}:synthetic:${i}`,kind:e.operation==="delete"?"remove":"add",oldLine:e.operation==="delete"?i+1:null,newLine:e.operation==="delete"?null:i+1,text:s}))}function ts(e){const n=e.diff.replace(/\r\n/g,`
26
- `),t=n.length>0?n.split(`
27
- `):[];t.length>0&&t[t.length-1]===""&&t.pop();const s=[];let i=0,a=0;for(const[u,o]of t.entries()){const f=o.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(f){i=Number(f[1]),a=Number(f[2]),s.push({key:`${T(e)}:hunk:${u}`,kind:"hunk",oldLine:null,newLine:null,text:o});continue}if(o.startsWith("+")&&!o.startsWith("+++")){s.push({key:`${T(e)}:add:${u}`,kind:"add",oldLine:null,newLine:a,text:o.slice(1)}),a+=1;continue}if(o.startsWith("-")&&!o.startsWith("---")){s.push({key:`${T(e)}:remove:${u}`,kind:"remove",oldLine:i,newLine:null,text:o.slice(1)}),i+=1;continue}if(o.startsWith(" ")){s.push({key:`${T(e)}:context:${u}`,kind:"context",oldLine:i,newLine:a,text:o.slice(1)}),i+=1,a+=1;continue}s.push({key:`${T(e)}:meta:${u}`,kind:"meta",oldLine:null,newLine:null,text:o})}return s}function ns(e){return!e||!e.diff.trim()?[]:Qn(e)?ts(e):es(e)}const ss=L(()=>ns(P.value));function is(e){return!!(e!=null&&e.diff.trim())}function os(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}function as(e){if(typeof document>"u")return!1;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.left="-9999px",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.focus(),n.select(),n.setSelectionRange(0,e.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(n)}}async function rs(e){var s;const n=jt.value[e]??"";if(!n)return;let t=!1;if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.writeText))try{await navigator.clipboard.writeText(n),t=!0}catch{t=!1}t||(t=as(n)),t&&(N.value=e,te&&clearTimeout(te),te=setTimeout(()=>{N.value===e&&(N.value=""),te=null},1800))}function ls(e){const n=Ht.value[e];typeof n=="number"&&v.activeThreadId&&et("forkThread",{threadId:v.activeThreadId,turnIndex:n})}const Kt=L(()=>{const e={};for(const n of v.messages){if(n.role!=="user"||typeof n.turnIndex!="number")continue;const t=typeof n.turnId=="string"&&n.turnId.length>0?n.turnId:"";!t||n.text.trim().length===0||(e[n.id]=t)}return e});function Zt(e){return typeof Kt.value[e.id]=="string"}function cs(e){const n=Kt.value[e];n&&et("rollback",{turnId:n})}function ot(e){const n=[],t=/https?:\/\/[^\s<>"'`,。;:!?、()[\]{}「」『』《》]+|file:\/\/[^\n<>"'`,。;:!?、[\]{}「」『』《》]+|["'](?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^\n"']+["']|`(?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^`\n]+`/gu;let s=0;for(const i of e.matchAll(t)){if(typeof i.index!="number")continue;const a=i.index,u=a+i[0].length;a>s&&n.push({kind:"text",value:e.slice(s,a)});let o=i[0],f="";for(;/[.,;:!?,。;:!?、]$/u.test(o);)f=o.slice(-1)+f,o=o.slice(0,-1);const c=Se(o);o=c.core;const m=c.leading,p=c.trailing+f;if(m&&n.push({kind:"text",value:m}),o.startsWith("**")&&o.endsWith("**")&&o.length>4)n.push({kind:"bold",value:o.slice(2,-2)}),p&&n.push({kind:"text",value:p});else if(/^https?:\/\//u.test(o))n.push({kind:"url",value:o,href:o}),p&&n.push({kind:"text",value:p});else{const y=he(o);y?(n.push({kind:"file",value:o,path:y.path,displayPath:o,downloadName:Me(y.path)}),p&&n.push({kind:"text",value:p})):n.push({kind:"text",value:i[0]})}s=u}return s<e.length&&n.push({kind:"text",value:e.slice(s)}),us(n)}function at(e,n){const t=[];let s=!1,i="";const a=u=>{u&&t.push({kind:"text",value:u})};for(const u of e){if(u.kind!=="text"){s&&(a(`${n.marker}${i}`),s=!1,i=""),t.push(u);continue}let o=u.value;for(;o.length>0;){const f=o.indexOf(n.marker);if(f<0){s?i+=o:a(o);break}const c=o.slice(0,f);if(s?i+=c:a(c),o=o.slice(f+n.marker.length),s){const m=i;m.length>0&&(!n.isValidContent||n.isValidContent(m))?t.push({kind:n.kind,value:m}):a(`${n.marker}${m}${n.marker}`),i="",s=!1}else s=!0}}return s&&a(`${n.marker}${i}`),t}function us(e){const n=s=>s.trim().length>0&&!/^\s/u.test(s)&&!/\s$/u.test(s);let t=at(e,{marker:"**",kind:"bold",isValidContent:n});return t=at(t,{marker:"~~",kind:"strikethrough",isValidContent:n}),t=at(t,{marker:"*",kind:"italic",isValidContent:n}),t}function Ee(e){const n=[];let t=0,s=0;const i=(a,u)=>{let o=a.indexOf("[",u);for(;o>=0;){const f=a.indexOf("]",o+1);if(f<0)return null;if(a[f+1]!=="("){o=a.indexOf("[",o+1);continue}let c=1,m=f+2,p=!1;for(;m<a.length;){const y=a[m];if(y===`
28
- `){p=!0;break}if(y==="("&&(c+=1),y===")"&&(c-=1,c===0)){const b=a.slice(o,m+1);if(nt(b))return{start:o,end:m+1,token:b};break}m+=1}if(p){o=a.indexOf("[",o+1);continue}o=a.indexOf("[",o+1)}return null};for(;s<e.length;){const a=i(e,s);if(!a)break;const{start:u,end:o,token:f}=a;u>t&&n.push(...ot(e.slice(t,u)));const c=nt(f);if(!c){n.push(...ot(e.slice(u,o))),t=o,s=o;continue}const m=c.label,p=c.target;if(/^https?:\/\//u.test(p))n.push({kind:"url",value:m||p,href:p});else{const y=he(p);y?n.push({kind:"file",value:p,path:y.path,displayPath:m||p,downloadName:Me(y.path)}):n.push({kind:"text",value:f})}t=o,s=o}return t<e.length&&n.push(...ot(e.slice(t))),n}function K(e){if(e.includes("](")){const i=Ee(e);if(i.some(a=>a.kind==="file"||a.kind==="url"))return i}if(!e.includes("`"))return Ee(e);const n=[];let t=0,s=0;for(;t<e.length;){if(e[t]!=="`"){t+=1;continue}let i=1;for(;t+i<e.length&&e[t+i]==="`";)i+=1;const a="`".repeat(i);let u=t+i,o=-1;for(;u<e.length;){const c=e.indexOf(a,u);if(c<0)break;const m=c>0&&e[c-1]==="`",p=c+i<e.length&&e[c+i]==="`",y=e.slice(t+i,c).includes(`
29
- `);if(!m&&!p&&!y){o=c;break}u=c+1}if(o<0){t+=i;continue}t>s&&n.push(...Ee(e.slice(s,t)));const f=e.slice(t+i,o);if(f.length>0){const c=nt(f);if(c)if(/^https?:\/\//u.test(c.target))n.push({kind:"url",value:c.label||c.target,href:c.target});else{const m=he(c.target);m?n.push({kind:"file",value:c.target,path:m.path,displayPath:c.label||c.target,downloadName:Me(m.path)}):n.push({kind:"code",value:f})}else if(/^https?:\/\/[^\s]+$/u.test(f))n.push({kind:"url",value:f,href:f});else{const m=he(f);if(m){const p=m.line?`${m.path}:${String(m.line)}`:m.path;n.push({kind:"file",value:f,path:m.path,displayPath:p,downloadName:Me(m.path)})}else n.push({kind:"code",value:f})}}else n.push({kind:"text",value:`${a}${a}`});t=o+i,s=t}return s<e.length&&n.push(...Ee(e.slice(s))),n}function ds(e){const n=e.trim();if(!n)return"";if(n.startsWith("data:")||n.startsWith("blob:")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("/codex-local-image?"))return n;if(n.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(n)}`;const t=n.startsWith("/"),s=/^[A-Za-z]:[\\/]/u.test(n);return t||s?`/codex-local-image?path=${encodeURIComponent(n)}`:n}function j(e){const n=e.trim();if(!n)return"#";const t=u=>u.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(u),s=he(n),i=(s==null?void 0:s.path)??n,a=Wt(i,v.cwd);if(t(a)){const u=a.startsWith("/")?a:`/${a}`;return`/codex-local-browse${encodeURI(u)}`}return"#"}const fs=L(()=>({left:`${String(_t.value)}px`,top:`${String(wt.value)}px`}));function hs(e){const n=e.trim();if(!n)return"";try{const t=new URL(n,window.location.href);return t.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${t.pathname.slice(19)}`}${t.search}${t.hash}`:""}catch{return""}}function ps(e){const n=e.target;if(!(n instanceof Element))return;const t=n.closest("a.message-file-link");if(!(t instanceof HTMLAnchorElement))return;const s=(t.getAttribute("href")??"").trim();!s||s==="#"||(e.preventDefault(),e.stopPropagation(),Ne.value=s,Ue.value=hs(s),_t.value=e.clientX,wt.value=e.clientY,de.value=!0)}function Z(){de.value&&(de.value=!1)}function ms(){const e=Ne.value;Z(),!(!e||e==="#")&&window.open(e,"_blank","noopener,noreferrer")}function vs(){const e=Ue.value;Z(),!(!e||e==="#")&&window.open(e,"_blank","noopener,noreferrer")}async function ks(){const e=Ne.value;if(Z(),!(!e||e==="#"))try{await navigator.clipboard.writeText(e)}catch{const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}function Gt(e){if(!de.value)return;const n=yt.value;if(!n){Z();return}const t=e.target;t instanceof Node&&n.contains(t)||Z()}function Xt(){Z()}function Jt(e){e.key==="Escape"&&Z()}function Yt(e){return e.replace(/\r\n/gu,`
30
- `)}function R(e){var t;return(((t=e.match(/^\s*/u))==null?void 0:t[0])??"").replace(/\t/gu," ").length}function Qt(e,n){if(n<=0)return e.trimStart();let t=0,s=0;for(;t<e.length&&s<n;){const i=e[t];s+=i===" "?4:1,t+=1}return e.slice(t)}function W(e){return e.trim().length===0}function rt(e){const n=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return n?{level:n[1].length,value:n[2].trim()}:null}function Fe(e){const n=e.match(/^\s{0,3}>\s?(.*)$/u);return n?n[1]??"":null}function pe(e){var t;const n=e.match(/^\s*[-*+]\s+(.+)$/u);return((t=n==null?void 0:n[1])==null?void 0:t.trim())??null}function gs(e){var t;const n=e.match(/^(\s*)[-*+]\s+(.+)$/u);return n?{indent:R(n[1]??""),text:((t=n[2])==null?void 0:t.trim())??""}:null}function me(e){var t;const n=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{checked:(n[1]??" ").toLowerCase()==="x",text:((t=n[2])==null?void 0:t.trim())??""}:null}function en(e){var t;const n=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{indent:R(n[1]??""),item:{checked:(n[2]??" ").toLowerCase()==="x",text:((t=n[3])==null?void 0:t.trim())??""}}:null}function tn(e){var t;const n=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return n?{indent:R(n[1]??""),start:Number.parseInt(n[2]??"1",10)||1,text:((t=n[3])==null?void 0:t.trim())??""}:null}function lt(e){var n;return((n=tn(e))==null?void 0:n.text)??null}function nn(e){return tn(e)}function ct(e){const n=e.trim();if(!n.includes("|"))return null;let t=n;t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1));const s=[];let i="",a=0;for(let u=0;u<t.length;u+=1){const o=t[u];if(o==="\\"&&t[u+1]==="|"){i+="|",u+=1;continue}if(o==="`"){let f=1;for(;t[u+f]==="`";)f+=1;i+=t.slice(u,u+f),a===0?a=f:a===f&&(a=0),u+=f-1;continue}if(o==="|"&&a===0){s.push(i.trim()),i="";continue}i+=o}return s.push(i.trim()),s.some(u=>u.length>0)?s:null}function ys(e){const n=ct(e);if(!n||n.length===0)return null;const t=n.map(s=>{const i=s.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(i))return null;const a=i.startsWith(":"),u=i.endsWith(":");return a&&u?"center":u?"right":a?"left":null});return t.every((s,i)=>s!==null||/^-+$/u.test(n[i].replace(/\s+/gu,"")))?t:null}function sn(e,n){return e.length===n?e:e.length>n?e.slice(0,n):[...e,...Array.from({length:n-e.length},()=>"")]}function on(e,n){var m;if(n+1>=e.length)return null;const t=e[n],s=e[n+1],i=ct(t),a=ys(s);if(!i||!a||i.length!==a.length)return null;const u=t.trim();if(!u.startsWith("|")&&(((m=u.match(/\|/gu))==null?void 0:m.length)??0)<2)return null;const o=i.length,f=[];let c=n+2;for(;c<e.length&&!W(e[c]);){const p=ct(e[c]);if(!p)break;f.push(sn(p,o)),c+=1}return{kind:"table",headers:sn(i,o),rows:f,alignments:a}}function _s(e){return W(e)||Be(e)!==null||ut(e)||rt(e)!==null||Fe(e)!==null||me(e)!==null||pe(e)!==null||lt(e)!==null}function ws(e,n,t=-1){const s=[];let i=n;for(;i<e.length&&!(_s(e[i])||t>=0&&R(e[i])<=t);)s.push(t>=0?Qt(e[i],t+1):e[i]),i+=1;const a=s.join(`
31
- `).trim();return a?{value:a,nextIndex:i}:null}function an(e,n){for(let t=n;t<e.length;t+=1)if(!W(e[t]))return t;return-1}function bs(e,n,t,s=null,i=!1){const a=[];let u=n;for(;u<e.length;){const o=e[u];if(W(o)){const p=an(e,u+1);if(p===-1){a.push(""),u=e.length;break}const y=s==null?void 0:s(e[p]);if(y&&y.indent===t||R(e[p])<=t)break;a.push(""),u+=1;continue}const f=s==null?void 0:s(o);if(f&&f.indent===t)break;const c=R(o),m=i&&(me(o)!==null||pe(o)!==null);if(c<=t&&!m)break;a.push(c>t?Qt(o,t+1):o.trimStart()),u+=1}for(;a.length>0&&W(a[0]);)a.shift();for(;a.length>0&&W(a[a.length-1]);)a.pop();return a.length===0?null:{blocks:Re(a.join(`
32
- `)),nextIndex:u}}function rn(e,n,t,s=!1){const i=[];let a=n;const u=t(e[n]);if(!u)return null;const o=u.indent;for(;a<e.length;){const f=t(e[a]);if(f===null||f.indent!==o)break;const c=[f.text],m=[];for(a+=1;a<e.length;){if(W(e[a])){const _=an(e,a+1);if(_===-1){a=e.length;break}const I=t(e[_]);if(I&&I.indent===o){a=_;break}if(R(e[_])<=o){a=_;break}a+=1;continue}const p=t(e[a]);if(p&&p.indent===o)break;const y=R(e[a])>o,b=s&&(me(e[a])!==null||pe(e[a])!==null);if(y||b){const _=bs(e,a,o,t,s);if(_){m.push(..._.blocks),a=_.nextIndex;continue}}if(R(e[a])<=o)break;const H=ws(e,a,o);if(!H)break;c.push(H.value),a=H.nextIndex}i.push(m.length>0?{paragraphs:c,children:m}:{paragraphs:c})}return i.length>0?{items:i,nextIndex:a}:null}function ut(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}function Be(e){const n=e.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return n?{marker:n[1],language:(n[2]??"").trim()}:null}function Re(e){var a;const t=Yt(e).split(`
33
- `),s=[];let i=0;for(;i<t.length;){if(W(t[i])){i+=1;continue}const u=Be(t[i]);if(u){i+=1;const _=[];for(;i<t.length;){if(t[i].trim()===u.marker){i+=1;break}_.push(t[i]),i+=1}s.push({kind:"codeBlock",language:u.language,value:_.join(`
34
- `)});continue}if(ut(t[i])){s.push({kind:"thematicBreak"}),i+=1;continue}const o=rt(t[i]);if(o){s.push({kind:"heading",level:o.level,value:o.value}),i+=1;continue}if(Fe(t[i])!==null){const _=[];for(;i<t.length;){const I=Fe(t[i]);if(I===null)break;_.push(I),i+=1}s.push({kind:"blockquote",value:_.join(`
35
- `).trim()});continue}const c=on(t,i);if(c){s.push(c),i+=2+c.rows.length;continue}if(me(t[i])!==null){const _=[],I=((a=en(t[i]))==null?void 0:a.indent)??0;for(;i<t.length;){const pt=en(t[i]);if(pt===null||pt.indent!==I)break;_.push(pt.item),i+=1}if(_.length>0){s.push({kind:"taskList",items:_});continue}}const p=pe(t[i]);if(p!==null){const _=rn(t,i,gs);if(_){s.push({kind:"unorderedList",items:_.items}),i=_.nextIndex;continue}if(p.length>0){s.push({kind:"unorderedList",items:[{paragraphs:[p]}]}),i+=1;continue}}const y=lt(t[i]);if(y!==null){const _=nn(t[i]),I=rn(t,i,nn,!0);if(I){s.push({kind:"orderedList",items:I.items,start:(_==null?void 0:_.start)??1}),i=I.nextIndex;continue}if(y.length>0){s.push({kind:"orderedList",items:[{paragraphs:[y]}],start:(_==null?void 0:_.start)??1}),i+=1;continue}}const b=[];for(;i<t.length&&!(W(t[i])||Be(t[i])||ut(t[i])||rt(t[i])||on(t,i)||Fe(t[i])!==null||me(t[i])!==null||pe(t[i])!==null||lt(t[i])!==null);)b.push(t[i]),i+=1;const H=b.join(`
36
- `).trim();H&&s.push({kind:"paragraph",value:H})}return s}function xs(e){if(!e.includes("![")||!e.includes("]("))return Re(e);const n=[],t=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let s=0;for(const i of e.matchAll(t)){const[a,u,o]=i;if(typeof i.index!="number")continue;const f=i.index,c=f+a.length,m=ds(o.trim());m&&(f>s&&n.push(...Re(e.slice(s,f))),n.push({kind:"image",url:m,alt:u.trim(),markdown:a}),s=c)}return s<e.length&&n.push(...Re(e.slice(s))),n}function ln(e){const t=Yt(e).split(`
37
- `),s=[];let i=0,a=0;const u=o=>{if(o<=a)return;const f=t.slice(a,o).join(`
38
- `);s.push(...xs(f))};for(;i<t.length;){const o=Be(t[i]);if(!o){i+=1;continue}u(i),i+=1;const f=[];for(;i<t.length;){if(t[i].trim()===o.marker){i+=1;break}f.push(t[i]),i+=1}s.push({kind:"codeBlock",language:o.language,value:f.join(`
39
- `)}),a=i}return u(t.length),s.length>0?s:[{kind:"paragraph",value:e}]}function $(e){return e.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function Cs(e){var t;const n=((t=e.trim().split(/\s+/u)[0])==null?void 0:t.toLowerCase())??"";return n?Ft[n]??n:""}function cn(e,n){const t=Cs(e);if(!t)return $(n);const s=Le.value;if(!s)return $(n);try{if(s.getLanguage(t))return s.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{}return $(n)}function G(e){return K(e).map(n=>n.kind==="text"?$(n.value):n.kind==="bold"?`<strong class="message-bold-text">${$(n.value)}</strong>`:n.kind==="italic"?`<em class="message-italic-text">${$(n.value)}</em>`:n.kind==="strikethrough"?`<s class="message-strikethrough-text">${$(n.value)}</s>`:n.kind==="file"?`<a class="message-file-link" href="${$(j(n.path))}" target="_blank" rel="noopener noreferrer" title="${$(n.path)}">${$(n.displayPath)}</a>`:n.kind==="url"?`<a class="message-file-link" href="${$(n.href)}" target="_blank" rel="noopener noreferrer" title="${$(n.href)}">${$(n.value)}</a>`:`<code class="message-inline-code">${$(n.value)}</code>`).join("")}function $s(e){return e.paragraphs.map(n=>`<div class="message-list-item-text message-list-item-paragraph">${G(n)}</div>`).join("")}function We(e){var s;const n=$s(e),t=((s=e.children)==null?void 0:s.map(i=>dn(i)).join(""))??"";return n+t}function un(e){return e?` style="text-align:${e}"`:""}function dn(e){if(e.kind==="paragraph")return`<p class="message-text">${G(e.value)}</p>`;if(e.kind==="heading"){const n=Math.min(6,Math.max(1,Math.trunc(e.level))),t=Ot(n),s=`message-heading ${zt(n)}`;return`<${t} class="${s}">${G(e.value)}</${t}>`}if(e.kind==="blockquote")return`<blockquote class="message-blockquote">${G(e.value)}</blockquote>`;if(e.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${e.items.map(t=>`<li class="message-list-item"><div class="message-list-item-content">${We(t)}</div></li>`).join("")}</ul>`;if(e.kind==="taskList")return`<ul class="message-list message-task-list">${e.items.map(t=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${t.checked?"true":"false"}">${t.checked?"☑":"☐"}</span><div class="message-list-item-text">${G(t.text)}</div></li>`).join("")}</ul>`;if(e.kind==="orderedList"){const n=e.items.map(t=>`<li class="message-list-item"><div class="message-list-item-content">${We(t)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${e.start}">${n}</ol>`}if(e.kind==="table"){const n=e.headers.map((i,a)=>`<th class="message-table-head-cell"${un(e.alignments[a]??null)}>${G(i)}</th>`).join(""),t=e.rows.map(i=>'<tr class="message-table-body-row">'+i.map((a,u)=>`<td class="message-table-cell"${un(e.alignments[u]??null)}>${G(a)}</td>`).join("")+"</tr>").join(""),s=t?`<tbody>${t}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${n}</tr></thead>${s}</table></div>`}return e.kind==="codeBlock"?`<div class="message-code-block">${e.language?`<div class="message-code-language">${$(e.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${cn(e.language,e.value)}</code></pre></div>`:e.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${$(e.url)}" alt="${$(e.alt||"Embedded message image")}" loading="lazy">`}function dt(e){return ln(e).map(n=>dn(n)).join("")}function Ls(){const e=V.value,n=Et.value;!e||!n||(e.scrollTop=e.scrollHeight,n.scrollIntoView({block:"end"}))}function fn(e){return e.scrollHeight-(e.scrollTop+e.clientHeight)<=kr}function Oe(e){if(!v.activeThreadId)return;const n=Math.max(e.scrollHeight-e.clientHeight,0),t=n>0?Math.min(Math.max(e.scrollTop/n,0),1):1;et("updateScrollState",{threadId:v.activeThreadId,state:{scrollTop:e.scrollTop,isAtBottom:fn(e),scrollRatio:t}})}function Ts(){const e=V.value;if(!e)return;if(z.value){ze();return}const n=v.scrollState;if(!n||n.isAtBottom){Oe(e);return}const t=Math.max(e.scrollHeight-e.clientHeight,0),s=n.scrollTop;e.scrollTop=Math.min(Math.max(s,0),t),Oe(e)}function ze(){const e=V.value;e&&(Ls(),Oe(e))}function ft(){return z.value}function hn(){if(!ft()){$e=0,F=0;return}if(ze(),$e-=1,$e<=0){F=0;return}F=requestAnimationFrame(hn)}function je(e=6){ft()&&(F&&(cancelAnimationFrame(F),F=0),$e=Math.max(e,1),F=requestAnimationFrame(hn))}function pn(){je(3)}function mn(){z.value=!0,ze(),je(4)}async function vn(){const e=V.value;if(!e||!tt.value||U.value)return;U.value=!0;const n=v.activeThreadId,t=e.scrollHeight,s=e.scrollTop;B.value=Math.max(0,B.value-gr),await mt(),v.activeThreadId===n&&(e.scrollTop=s+(e.scrollHeight-t),U.value=!1)}ve({jumpToLatest:mn});function Ms(){if(!ft())return;const e=V.value;if(!e)return;const n=e.querySelectorAll("img.message-image-preview");for(const t of n)t.complete||Bt.has(t)||(Bt.add(t),t.addEventListener("load",pn,{once:!0}),t.addEventListener("error",pn,{once:!0}))}async function ht(){await mt(),ee&&cancelAnimationFrame(ee),ee=requestAnimationFrame(()=>{ee=0,Ts(),Ms(),je()})}X(()=>v.messages,async e=>{if(v.isLoading)return;const n=new Set(e.filter(t=>t.messageType==="commandExecution"&&t.commandExecution).map(t=>t.id));le.value=Ce(le.value,n),O.value=Ce(O.value,n),ce.value=Ce(ce.value,new Set(Object.keys(Ge.value))),ue.value=Ce(ue.value,new Set([...Object.keys(Pe.value),...Object.keys(it.value)])),z.value?B.value=Math.max(0,e.length-gt):B.value=Math.min(B.value,Math.max(0,e.length-1)),await ht()}),X(()=>v.messages.some(e=>e.text.includes("```")),e=>{!e||Le.value||zn()},{immediate:!0}),X(Ze,(e,n)=>{if(!n||n===e||!O.value.has(n))return;const t=new Set(O.value);t.delete(n),O.value=t}),X(()=>v.pendingRequests,async()=>{v.isLoading||await ht()},{deep:!0}),X(()=>v.liveOverlay,async e=>{e&&z.value&&(await mt(),ze(),je(8))},{deep:!0}),X(()=>v.isLoading,async e=>{e||(B.value=Math.max(0,v.messages.length-gt),await ht())}),X(()=>v.activeThreadId,()=>{Rn.value=null,z.value=!0,fe.value="",U.value=!1,B.value=Math.max(0,v.messages.length-gt)},{flush:"post"});function Ss(){const e=V.value;!e||v.isLoading||(z.value=fn(e),Oe(e),tt.value&&!U.value&&e.scrollTop<yr&&vn())}const kn=C(new Set);function gn(e,n){return`${e}:${n}`}function Ps(e,n){return kn.value.has(gn(e,n))}function Is(e,n){kn.value.add(gn(e,n))}function yn(e){fe.value=e}function _n(){fe.value=""}return Fs(()=>{window.addEventListener("pointerdown",Gt),window.addEventListener("blur",Xt),window.addEventListener("keydown",Jt)}),Bs(()=>{ee&&cancelAnimationFrame(ee),F&&cancelAnimationFrame(F),te&&clearTimeout(te),window.removeEventListener("pointerdown",Gt),window.removeEventListener("blur",Xt),window.removeEventListener("keydown",Jt)}),(e,n)=>(r(),l("section",{class:"conversation-root",onContextmenuCapture:ps},[M.isLoading?(r(),l("p",Ks,"Loading messages...")):M.messages.length===0&&M.pendingRequests.length===0&&!M.liveOverlay?(r(),l("p",Zs," No messages in this thread yet. ")):(r(),l("ul",{key:2,ref_key:"conversationListRef",ref:V,class:"conversation-list",onScroll:Ss},[tt.value?(r(),l("li",Gs,[d("button",{type:"button",class:"load-more-button",disabled:U.value,onClick:vn},h(U.value?"Loading…":"Load earlier messages"),9,Xs)])):k("",!0),(r(!0),l(g,null,w(Wn.value,t=>{var s,i,a,u;return r(),l(g,{key:t.id},[!Tn.value.has(t.id)&&!Gn.value.has(t.id)?(r(),l("li",{key:0,class:"conversation-item","data-role":t.role,"data-message-type":t.messageType||""},[A(t)?(r(),l("div",Ys,[d("div",Qs,[_e(t).length>0?(r(),l("button",{key:0,type:"button",class:x(["cmd-row cmd-row-group cmd-compact",[xe(t),{"cmd-expanded":Qe(t)}]]),onClick:o=>Sn(t)},[d("span",{class:x(["cmd-chevron",{"cmd-chevron-open":Qe(t)}])},"▶",2),d("span",ti,h(Pn(t)),1),d("span",ni,h(In(t)),1)],10,ei)):k("",!0),_e(t).length>0?(r(),l("div",{key:1,class:x(["cmd-group-wrap",{"cmd-group-visible":Qe(t)}])},[d("div",si,[(r(!0),l(g,null,w(Mt(t),o=>{var f,c;return r(),l("div",{key:`grouped-cmd-${o.id}`,class:"worked-cmd-item"},[d("button",{type:"button",class:x(["cmd-row",[xe(o),{"cmd-expanded":E(o),"cmd-compact":!0}]]),onClick:m=>Ye(o)},[d("span",{class:x(["cmd-chevron",{"cmd-chevron-open":E(o)}])},"▶",2),d("code",oi,h(((f=o.commandExecution)==null?void 0:f.command)||"(command)"),1),d("span",ai,h(be(o)),1)],10,ii),d("div",{class:x(["cmd-output-wrap",{"cmd-output-visible":E(o)}])},[d("div",ri,[d("pre",{class:x(["cmd-output",{"cmd-output-condensed":Je(o)}]),textContent:h(((c=o.commandExecution)==null?void 0:c.aggregatedOutput)||"(no output)")},null,10,li)])],2)])}),128))])],2)):(r(),l(g,{key:2},[d("button",{type:"button",class:x(["cmd-row",[xe(t),{"cmd-expanded":E(t),"cmd-compact":Xe(t)}]]),onClick:o=>Ye(t)},[d("span",{class:x(["cmd-chevron",{"cmd-chevron-open":E(t)}])},"▶",2),d("code",ui,h(((s=t.commandExecution)==null?void 0:s.command)||"(command)"),1),d("span",di,h(be(t)),1)],10,ci),d("div",{class:x(["cmd-output-wrap",{"cmd-output-visible":E(t)}])},[d("div",fi,[d("pre",{class:x(["cmd-output",{"cmd-output-condensed":Je(t)}]),textContent:h(((i=t.commandExecution)==null?void 0:i.aggregatedOutput)||"(no output)")},null,10,hi)])],2)],64))])])):Ke(t)?(r(),l("div",{key:1,class:"message-row","data-role":t.role,"data-message-type":t.messageType||""},[d("div",{class:"message-stack","data-role":t.role},[d("article",{class:"message-body","data-role":t.role},[oe(t)?(r(),l("section",ki,[d("button",{type:"button",class:x(["cmd-row cmd-row-group cmd-compact file-change-summary-row",{"cmd-expanded":Q(t)}]),onClick:o=>Pt(t)},[d("span",{class:x(["cmd-chevron",{"cmd-chevron-open":Q(t)}])},"▶",2),d("span",yi,h(Ut(oe(t))),1),d("span",_i,[(r(!0),l(g,null,w(qt(oe(t)),o=>(r(),l("span",{key:`summary-status:${t.id}:${o.tone}:${o.label}`,class:"file-change-signed-count","data-tone":o.tone},h(o.label),9,wi))),128))])],10,gi),d("div",{class:x(["cmd-group-wrap",{"cmd-group-visible":Q(t)}])},[d("div",bi,[d("ul",xi,[(r(!0),l(g,null,w(((a=oe(t))==null?void 0:a.changes)??[],o=>(r(),l("li",{key:`file-change:${t.id}:${o.path}:${o.movedToPath||""}`,class:"file-change-item"},[d("span",{class:"file-change-badge","data-operation":Ie(o)},h(ae(o)),9,Ci),d("button",{type:"button",class:"file-change-path-button",title:o.path,onClick:f=>we(oe(t),o)},h(S(o.path)),9,$i),o.movedToPath?(r(),l("span",Li,"→")):k("",!0),o.movedToPath?(r(),l("button",{key:1,type:"button",class:"file-change-path-button",title:o.movedToPath,onClick:f=>we(oe(t),o)},h(S(o.movedToPath)),9,Ti)):k("",!0),o.addedLineCount>0||o.removedLineCount>0?(r(),l("span",Mi,[(r(!0),l(g,null,w(Nt(o),f=>(r(),l("span",{key:`change-delta:${t.id}:${o.path}:${f.tone}:${f.label}`,class:"file-change-signed-count","data-tone":f.tone},h(f.label),9,Si))),128))])):k("",!0)]))),128))])])],2)])):k("",!0)],8,vi)],8,mi)],8,pi)):(r(),l("div",{key:2,class:"message-row","data-role":t.role,"data-message-type":t.messageType||""},[d("div",{class:"message-stack","data-role":t.role},[d("article",{class:"message-body","data-role":t.role},[t.images&&t.images.length>0?(r(),l("ul",{key:0,class:x(["message-image-list",{"message-generated-image-list":t.messageType==="imageView"}]),"data-role":t.role},[(r(!0),l(g,null,w(t.images,o=>(r(),l("li",{key:o,class:"message-image-item"},[d("button",{class:"message-image-button",type:"button",onClick:f=>yn(o)},[d("img",{class:x(["message-image-preview",{"message-generated-image-preview":t.messageType==="imageView"}]),src:o,alt:t.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,Bi)],8,Fi)]))),128))],10,Ei)):k("",!0),t.fileAttachments&&t.fileAttachments.length>0?(r(),l("div",Ri,[(r(!0),l(g,null,w(t.fileAttachments,o=>(r(),l("span",{key:`${t.id}:${o.path}`,class:"message-file-chip"},[n[4]||(n[4]=d("span",{class:"message-file-chip-icon"},"📄",-1)),d("a",{class:"message-file-link message-file-chip-name",href:j(o.path),target:"_blank",rel:"noopener noreferrer",title:o.path},h(o.label),9,Wi)]))),128))])):k("",!0),t.text.length>0?(r(),l("article",{key:2,class:"message-card","data-role":t.role},[t.messageType==="worked"?(r(),l("div",zi,[d("button",{type:"button",class:"worked-separator",onClick:o=>An(t)},[n[5]||(n[5]=d("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),d("span",{class:x(["worked-chevron",{"worked-chevron-open":St(t)}])},"▶",2),d("p",Hi,h(t.text),1),n[6]||(n[6]=d("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,ji),St(t)?(r(),l("div",Di,[(r(!0),l(g,null,w(Bn(M.messages,M.messages.indexOf(t)),o=>{var f,c;return r(),l("div",{key:`worked-cmd-${o.id}`,class:"worked-cmd-item"},[d("button",{type:"button",class:x(["cmd-row",[xe(o),{"cmd-expanded":E(o),"cmd-compact":Xe(o)}]]),onClick:m=>Ye(o)},[d("span",{class:x(["cmd-chevron",{"cmd-chevron-open":E(o)}])},"▶",2),d("code",Ni,h(((f=o.commandExecution)==null?void 0:f.command)||"(command)"),1),d("span",Ui,h(be(o)),1)],10,Vi),d("div",{class:x(["cmd-output-wrap",{"cmd-output-visible":E(o)}])},[d("div",qi,[d("pre",{class:x(["cmd-output",{"cmd-output-condensed":Je(o)}]),textContent:h(((c=o.commandExecution)==null?void 0:c.aggregatedOutput)||"(no output)")},null,10,Ki)])],2)])}),128))])):k("",!0)])):bt(t)?(r(),l("div",{key:1,class:"plan-card","data-streaming":t.messageType==="plan.live"},[d("div",Gi,[n[7]||(n[7]=d("p",{class:"plan-card-title"},"Plan",-1)),t.messageType==="plan.live"?(r(),l("span",Xi,"Updating")):k("",!0)]),$t(t)?(r(),l("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:dt($t(t))},null,8,Ji)):k("",!0),Lt(t).length>0?(r(),l("ol",Yi,[(r(!0),l(g,null,w(Lt(t),(o,f)=>(r(),l("li",{key:`${t.id}:plan-step:${f}`,class:"plan-step-item","data-status":o.status},[d("span",{class:"plan-step-status","data-status":o.status},h(Mn(o.status)),9,eo),d("div",{class:"plan-step-text plan-card-markdown",innerHTML:dt(o.step)},null,8,to)],8,Qi))),128))])):(r(),l("div",{key:2,class:"plan-card-markdown",innerHTML:dt(t.text)},null,8,no))],8,Zi)):(r(),l("div",so,[(r(!0),l(g,null,w(ln(t.text),(o,f)=>(r(),l(g,{key:`block-${f}`},[o.kind==="paragraph"?(r(),l("p",io,[(r(!0),l(g,null,w(K(o.value),(c,m)=>(r(),l(g,{key:`seg-${f}-${m}`},[c.kind==="text"?(r(),l("span",oo,h(c.value),1)):c.kind==="bold"?(r(),l("strong",ao,h(c.value),1)):c.kind==="italic"?(r(),l("em",ro,h(c.value),1)):c.kind==="strikethrough"?(r(),l("s",lo,h(c.value),1)):c.kind==="file"?(r(),l("a",{key:4,class:"message-file-link",href:j(c.path),target:"_blank",rel:"noopener noreferrer",title:c.path},h(c.displayPath),9,co)):c.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:c.href,target:"_blank",rel:"noopener noreferrer",title:c.href},h(c.value),9,uo)):(r(),l("code",fo,h(c.value),1))],64))),128))])):o.kind==="heading"?(r(),Rs(Ws(Ot(o.level)),{key:1,class:x(["message-heading",zt(o.level)])},{default:bn(()=>[(r(!0),l(g,null,w(K(o.value),(c,m)=>(r(),l(g,{key:`heading-seg-${f}-${m}`},[c.kind==="text"?(r(),l("span",ho,h(c.value),1)):c.kind==="bold"?(r(),l("strong",po,h(c.value),1)):c.kind==="italic"?(r(),l("em",mo,h(c.value),1)):c.kind==="strikethrough"?(r(),l("s",vo,h(c.value),1)):c.kind==="file"?(r(),l("a",{key:4,class:"message-file-link",href:j(c.path),target:"_blank",rel:"noopener noreferrer",title:c.path},h(c.displayPath),9,ko)):c.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:c.href,target:"_blank",rel:"noopener noreferrer",title:c.href},h(c.value),9,go)):(r(),l("code",yo,h(c.value),1))],64))),128))]),_:2},1032,["class"])):o.kind==="blockquote"?(r(),l("blockquote",_o,[(r(!0),l(g,null,w(K(o.value),(c,m)=>(r(),l(g,{key:`quote-seg-${f}-${m}`},[c.kind==="text"?(r(),l("span",wo,h(c.value),1)):c.kind==="bold"?(r(),l("strong",bo,h(c.value),1)):c.kind==="italic"?(r(),l("em",xo,h(c.value),1)):c.kind==="strikethrough"?(r(),l("s",Co,h(c.value),1)):c.kind==="file"?(r(),l("a",{key:4,class:"message-file-link",href:j(c.path),target:"_blank",rel:"noopener noreferrer",title:c.path},h(c.displayPath),9,$o)):c.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:c.href,target:"_blank",rel:"noopener noreferrer",title:c.href},h(c.value),9,Lo)):(r(),l("code",To,h(c.value),1))],64))),128))])):o.kind==="unorderedList"?(r(),l("ul",Mo,[(r(!0),l(g,null,w(o.items,(c,m)=>(r(),l("li",{key:`ul-${f}-${m}`,class:"message-list-item"},[d("div",{class:"message-list-item-content",innerHTML:We(c)},null,8,So)]))),128))])):o.kind==="taskList"?(r(),l("ul",Po,[(r(!0),l(g,null,w(o.items,(c,m)=>(r(),l("li",{key:`task-${f}-${m}`,class:"message-task-item"},[d("span",{class:"message-task-checkbox","data-checked":c.checked},h(c.checked?"☑":"☐"),9,Io),d("div",Ao,[(r(!0),l(g,null,w(K(c.text),(p,y)=>(r(),l(g,{key:`task-seg-${f}-${m}-${y}`},[p.kind==="text"?(r(),l("span",Eo,h(p.value),1)):p.kind==="bold"?(r(),l("strong",Fo,h(p.value),1)):p.kind==="italic"?(r(),l("em",Bo,h(p.value),1)):p.kind==="strikethrough"?(r(),l("s",Ro,h(p.value),1)):p.kind==="file"?(r(),l("a",{key:4,class:"message-file-link",href:j(p.path),target:"_blank",rel:"noopener noreferrer",title:p.path},h(p.displayPath),9,Wo)):p.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:p.href,target:"_blank",rel:"noopener noreferrer",title:p.href},h(p.value),9,Oo)):(r(),l("code",zo,h(p.value),1))],64))),128))])]))),128))])):o.kind==="orderedList"?(r(),l("ol",{key:5,class:"message-list message-list-ordered",start:o.start},[(r(!0),l(g,null,w(o.items,(c,m)=>(r(),l("li",{key:`ol-${f}-${m}`,class:"message-list-item"},[d("div",{class:"message-list-item-content",innerHTML:We(c)},null,8,Ho)]))),128))],8,jo)):o.kind==="table"?(r(),l("div",Do,[d("table",Vo,[d("thead",null,[d("tr",null,[(r(!0),l(g,null,w(o.headers,(c,m)=>(r(),l("th",{key:`th-${f}-${m}`,class:"message-table-head-cell",style:vt({textAlign:o.alignments[m]??"left"})},[(r(!0),l(g,null,w(K(c),(p,y)=>(r(),l(g,{key:`th-seg-${f}-${m}-${y}`},[p.kind==="text"?(r(),l("span",No,h(p.value),1)):p.kind==="bold"?(r(),l("strong",Uo,h(p.value),1)):p.kind==="italic"?(r(),l("em",qo,h(p.value),1)):p.kind==="strikethrough"?(r(),l("s",Ko,h(p.value),1)):p.kind==="file"?(r(),l("a",{key:4,class:"message-file-link",href:j(p.path),target:"_blank",rel:"noopener noreferrer",title:p.path},h(p.displayPath),9,Zo)):p.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:p.href,target:"_blank",rel:"noopener noreferrer",title:p.href},h(p.value),9,Go)):(r(),l("code",Xo,h(p.value),1))],64))),128))],4))),128))])]),o.rows.length>0?(r(),l("tbody",Jo,[(r(!0),l(g,null,w(o.rows,(c,m)=>(r(),l("tr",{key:`tr-${f}-${m}`,class:"message-table-body-row"},[(r(!0),l(g,null,w(c,(p,y)=>(r(),l("td",{key:`td-${f}-${m}-${y}`,class:"message-table-cell",style:vt({textAlign:o.alignments[y]??"left"})},[(r(!0),l(g,null,w(K(p),(b,H)=>(r(),l(g,{key:`td-seg-${f}-${m}-${y}-${H}`},[b.kind==="text"?(r(),l("span",Yo,h(b.value),1)):b.kind==="bold"?(r(),l("strong",Qo,h(b.value),1)):b.kind==="italic"?(r(),l("em",ea,h(b.value),1)):b.kind==="strikethrough"?(r(),l("s",ta,h(b.value),1)):b.kind==="file"?(r(),l("a",{key:4,class:"message-file-link",href:j(b.path),target:"_blank",rel:"noopener noreferrer",title:b.path},h(b.displayPath),9,na)):b.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:b.href,target:"_blank",rel:"noopener noreferrer",title:b.href},h(b.value),9,sa)):(r(),l("code",ia,h(b.value),1))],64))),128))],4))),128))]))),128))])):k("",!0)])])):o.kind==="codeBlock"?(r(),l("div",oa,[o.language?(r(),l("div",aa,h(o.language),1)):k("",!0),d("pre",ra,[d("code",{class:"hljs",innerHTML:cn(o.language,o.value)},null,8,la)])])):o.kind==="thematicBreak"?(r(),l("hr",ca)):Ps(t.id,f)?(r(),l("p",ua,h(o.markdown),1)):(r(),l("button",{key:10,class:"message-image-button",type:"button",onClick:c=>yn(o.url)},[d("img",{class:"message-image-preview message-markdown-image",src:o.url,alt:o.alt||"Embedded message image",loading:"lazy",onError:c=>Is(t.id,f)},null,40,fa)],8,da))],64))),128))]))],8,Oi)):k("",!0),ie(t)?(r(),l("section",ha,[d("button",{type:"button",class:x(["cmd-row cmd-row-group cmd-compact file-change-summary-row",{"cmd-expanded":Q(t)}]),onClick:o=>Pt(t)},[d("span",{class:x(["cmd-chevron",{"cmd-chevron-open":Q(t)}])},"▶",2),d("span",ma,h(Ut(ie(t))),1),d("span",va,[(r(!0),l(g,null,w(qt(ie(t)),o=>(r(),l("span",{key:`summary-status:${t.id}:${o.tone}:${o.label}`,class:"file-change-signed-count","data-tone":o.tone},h(o.label),9,ka))),128))])],10,pa),d("div",{class:x(["cmd-group-wrap",{"cmd-group-visible":Q(t)}])},[d("div",ga,[d("ul",ya,[(r(!0),l(g,null,w(((u=ie(t))==null?void 0:u.changes)??[],o=>(r(),l("li",{key:`file-change:inline:${t.id}:${o.path}:${o.movedToPath||""}`,class:"file-change-item"},[d("span",{class:"file-change-badge","data-operation":Ie(o)},h(ae(o)),9,_a),d("button",{type:"button",class:"file-change-path-button",title:o.path,onClick:f=>we(ie(t),o)},h(S(o.path)),9,wa),o.movedToPath?(r(),l("span",ba,"→")):k("",!0),o.movedToPath?(r(),l("button",{key:1,type:"button",class:"file-change-path-button",title:o.movedToPath,onClick:f=>we(ie(t),o)},h(S(o.movedToPath)),9,xa)):k("",!0),o.addedLineCount>0||o.removedLineCount>0?(r(),l("span",Ca,[(r(!0),l(g,null,w(Nt(o),f=>(r(),l("span",{key:`change-delta:inline:${t.id}:${o.path}:${f.tone}:${f.label}`,class:"file-change-signed-count","data-tone":f.tone},h(f.label),9,$a))),128))])):k("",!0)]))),128))])])],2)])):k("",!0),Dt(t)||Zt(t)?(r(),l("div",{key:4,class:"message-toolbar","data-role":t.role},[Zt(t)?(r(),l("button",{key:0,type:"button",class:"message-edit-button","aria-label":"Edit this message",title:"Edit this message",onClick:o=>cs(t.id)},[J(Os,{class:"icon-svg message-edit-icon"}),n[8]||(n[8]=d("span",{class:"message-edit-label"},"Edit message",-1))],8,Ta)):k("",!0),Un(t)?(r(),l("button",{key:1,type:"button",class:"message-fork-button","aria-label":"Fork thread from this response",title:"Fork thread from this response",onClick:o=>ls(t.id)},[J(zs,{class:"icon-svg message-fork-icon"}),n[9]||(n[9]=d("span",{class:"message-fork-label"},"Fork",-1))],8,Ma)):k("",!0),Dt(t)?(r(),l("button",{key:2,type:"button",class:"message-copy-button","data-copied":N.value===t.id,"aria-label":N.value===t.id?"Response copied":"Copy response",title:N.value===t.id?"Response copied":"Copy response",onClick:o=>rs(t.id)},[J(qs,{class:"icon-svg message-copy-icon"}),d("span",Pa,h(N.value===t.id?"Copied":"Copy"),1)],8,Sa)):k("",!0)],8,La)):k("",!0)],8,Ai)],8,Ii)],8,Pi))],8,Js)):k("",!0)],64)}),128)),M.liveOverlay?(r(),l("li",Ia,[d("div",Aa,[d("div",Ea,[d("article",Fa,[d("p",Ba,h(M.liveOverlay.activityLabel),1),M.liveOverlay.reasoningText?(r(),l("p",Ra,h(M.liveOverlay.reasoningText),1)):k("",!0),M.liveOverlay.errorText?(r(),l("p",Wa,h(M.liveOverlay.errorText),1)):k("",!0)])])])])):k("",!0),d("li",{ref_key:"bottomAnchorRef",ref:Et,class:"conversation-bottom-anchor"},null,512)],544)),On.value?(r(),l("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:mn},[J(js,{class:"icon-svg jump-to-latest-icon"})])):k("",!0),fe.value.length>0?(r(),l("div",{key:4,class:"image-modal-backdrop",onClick:_n},[d("div",{class:"image-modal-content",onClick:n[0]||(n[0]=He(()=>{},["stop"]))},[d("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:_n},[J(xn,{class:"icon-svg"})]),d("img",{class:"image-modal-image",src:fe.value,alt:"Expanded message image"},null,8,Oa)])])):k("",!0),de.value?(r(),l("div",{key:5,ref_key:"fileLinkContextMenuRef",ref:yt,class:"file-link-context-menu",style:vt(fs.value),onClick:n[1]||(n[1]=He(()=>{},["stop"]))},[d("button",{type:"button",class:"file-link-context-menu-item",onClick:ms}," Open link "),d("button",{type:"button",class:"file-link-context-menu-item",onClick:ks}," Copy link "),Ue.value?(r(),l("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:vs}," Edit file ")):k("",!0)],4)):k("",!0),P.value?(r(),l("div",{key:6,class:"diff-viewer-backdrop",onClick:It},[d("div",{class:"diff-viewer-shell",onClick:n[3]||(n[3]=He(()=>{},["stop"]))},[kt(ge)?k("",!0):(r(),l("aside",za,[d("div",ja,[n[10]||(n[10]=d("p",{class:"diff-viewer-sidebar-title"},"Changed files",-1)),d("p",Ha,h(Ae(re.value.length)),1)]),d("div",Da,[(r(!0),l(g,null,w(re.value,t=>(r(),l("button",{key:`diff-viewer:${T(t)}`,type:"button",class:"diff-viewer-file-button","data-active":T(t)===T(P.value),onClick:s=>At(t)},[d("span",{class:"file-change-badge","data-operation":Ie(t)},h(ae(t)),9,Na),d("span",Ua,[Y(h(S(t.path))+" ",1),t.movedToPath?(r(),l(g,{key:0},[Y(" → "+h(S(t.movedToPath)),1)],64)):k("",!0)]),q(t)?(r(),l("span",qa,h(q(t)),1)):k("",!0)],8,Va))),128))])])),d("section",Ka,[d("div",Za,[d("div",Ga,[d("p",Xa,[Y(h(S(P.value.path))+" ",1),P.value.movedToPath?(r(),l(g,{key:0},[Y(" → "+h(S(P.value.movedToPath)),1)],64)):k("",!0)]),d("p",Ja,[Y(h(ae(P.value))+" ",1),q(P.value)?(r(),l("span",Ya," · "+h(q(P.value)),1)):k("",!0)])]),d("div",Qa,[kt(ge)?(r(),l("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:En},h(Ae(re.value.length)),1)):k("",!0),d("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":"Close diff viewer",onClick:It},[J(xn,{class:"icon-svg"})])])]),is(P.value)?(r(),l("div",tr,[d("div",nr,[d("span",sr,h(Yn(P.value)||"diff"),1)]),d("div",ir,[(r(!0),l(g,null,w(ss.value,t=>(r(),l("div",{key:t.key,class:"diff-viewer-line","data-kind":t.kind},[d("span",ar,h(t.oldLine??""),1),d("span",rr,h(t.newLine??""),1),d("span",lr,h(os(t)),1),d("code",{class:"diff-viewer-line-code",innerHTML:$(t.text)||" "},null,8,cr)],8,or))),128))])])):(r(),l("div",er,[...n[11]||(n[11]=[d("p",{class:"diff-viewer-empty-title"},"No diff available",-1),d("p",{class:"diff-viewer-empty-text"},"This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.",-1)])]))]),J(Hs,{name:"diff-viewer-sheet"},{default:bn(()=>[kt(ge)&&D.value?(r(),l("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:Fn},[d("div",{class:"diff-viewer-mobile-sheet",onClick:n[2]||(n[2]=He(()=>{},["stop"]))},[n[13]||(n[13]=d("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),d("div",ur,[n[12]||(n[12]=d("p",{class:"diff-viewer-sidebar-title"},"Changed files",-1)),d("p",dr,h(Ae(re.value.length)),1)]),d("div",fr,[(r(!0),l(g,null,w(re.value,t=>(r(),l("button",{key:`diff-viewer-sheet:${T(t)}`,type:"button",class:"diff-viewer-file-button","data-active":T(t)===T(P.value),onClick:s=>At(t)},[d("span",{class:"file-change-badge","data-operation":Ie(t)},h(ae(t)),9,pr),d("span",mr,[Y(h(S(t.path))+" ",1),t.movedToPath?(r(),l(g,{key:0},[Y(" → "+h(S(t.movedToPath)),1)],64)):k("",!0)]),q(t)?(r(),l("span",vr,h(q(t)),1)):k("",!0)],8,hr))),128))])])])):k("",!0)]),_:1})])])):k("",!0)],32))}}),br=Cn(_r,[["__scopeId","data-v-4e7bdbb5"]]);export{br as default};