codex-mobile-re 0.1.133 → 0.1.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AutomationsPanel-B9A37CNa.js → AutomationsPanel-BrxpYd3F.js} +1 -1
- package/dist/assets/{DirectoryHub-D_TdDpHF.js → DirectoryHub-CbWz81wr.js} +1 -1
- package/dist/assets/{QueuedMessages-CsAVexKb.js → QueuedMessages-BYByp2ES.js} +1 -1
- package/dist/assets/{ReviewPane-XhRr3646.js → ReviewPane-BzcuGGZz.js} +1 -1
- package/dist/assets/{RightFilePreview-Ch_neGS2.js → RightFilePreview-BRXbHofi.js} +1 -1
- package/dist/assets/{RightFilesPanel-5fMx5J84.js → RightFilesPanel-mG5aaeVI.js} +1 -1
- package/dist/assets/{RightGitPanel-irYPFJZZ.js → RightGitPanel-BsVCibLZ.js} +2 -2
- package/dist/assets/{SettingsDialog-Dg10TF-D.js → SettingsDialog-D34lKAxd.js} +3 -3
- package/dist/assets/ThreadConversation-BiyKia_7.js +25 -0
- package/dist/assets/{ThreadConversation-Dx1ZKW94.css → ThreadConversation-DynLmaDw.css} +1 -1
- package/dist/assets/{ThreadPendingRequestPanel-DorbAtp9.js → ThreadPendingRequestPanel-Bg_3qi-T.js} +1 -1
- package/dist/assets/{ThreadTerminalPanel-CKhCiseu.js → ThreadTerminalPanel-BlisDnyv.js} +1 -1
- package/dist/assets/index-ChD_mFyW.js +98 -0
- package/dist/assets/{index-Dm1iQsik.css → index-CuSbagu4.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-cli/index.js +0 -0
- package/package.json +81 -79
- package/dist/assets/ThreadConversation-8TMOUqdg.js +0 -25
- package/dist/assets/index-CMrfiiel.js +0 -98
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{r as Ro,n as vo,a as po,c as _,b as q,g as ba,o as xt,d as Rt,e as yo,f as bt,h as ce,i as a,j as de,k as l,w as et,l as f,t as w,m as oe,p as I,T as Ho,_ as se,u as c,F as N,q as z,s as Re,v as te,I as Oo,x as Ca,y as lt,z as be,A as we,B as Ie,C as No,D as xa,E as Ge,G as $a,H as qo,J as ln,K as _a,L as wo,M as Ta,N as Ia,O as Sa,P as Vo,Q as Wo,R as Ma,S as ko,U as Te,V as bo,W as La,X as Aa,Y as Fa,Z as Co,$ as Pa,a0 as Ea,a1 as xo,a2 as Ba,a3 as Da,a4 as $o,a5 as Ra,a6 as Ha,a7 as _o,a8 as Oa,a9 as Na,aa as qa,ab as Va,ac as Wa,ad as ja,ae as Ua,af as Ka}from"./index-ChD_mFyW.js";import{s as sn}from"./sanitizeHtml-Bd3No2dT.js";const Ga=30*60*1e3;function za(e,n){const o=new Date(e),i=new Date(n);return o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate()}function Ya(e,n){return typeof n!="number"||!Number.isFinite(n)?!1:e==null||!Number.isFinite(e)||!za(e,n)?!0:n-e>=Ga}function Xa(e){const n=new Set;let o=null;for(const i of e){const m=i.timestampMs;typeof m!="number"||!Number.isFinite(m)||Ya(o,m)&&(n.add(i.key),o=m)}return n}function Ja(e,n){const o=new Date(e),i=new Date(n),m=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),r=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime();return Math.round((r-m)/864e5)}function Bt(e){return String(e).padStart(2,"0")}function Qa(e,n={}){if(typeof e!="number"||!Number.isFinite(e))return"";const o=new Date(e);if(Number.isNaN(o.getTime()))return"";const i=n.translate??(p=>p),m=n.now??Date.now(),r=`${Bt(o.getHours())}:${Bt(o.getMinutes())}`,h=Ja(e,m);if(h===0)return`${i("Today")} ${r}`;if(h===1)return`${i("Yesterday")} ${r}`;const u=`${Bt(o.getMonth()+1)}-${Bt(o.getDate())}`;return new Date(m).getFullYear()===o.getFullYear()?`${u} ${r}`:`${o.getFullYear()}-${u} ${r}`}const cn=16;function Ct(e){return Number.isFinite(e)?e:0}function jo(e){const n=Ct(e.scrollHeightPx),o=Ct(e.clientHeightPx);return Math.max(0,n-o)}function Uo(e){const n=Ct(e.scrollHeightPx)-Ct(e.scrollTopPx)-Ct(e.clientHeightPx);return Math.max(0,n)}function Za(e,n=cn){const o=Number.isFinite(n)?n:cn;return Uo(e)<=o}function ei(e,n){return Number.isFinite(n)?Math.min(jo(e),Math.max(0,n)):0}function To(e,n){const o=jo(e),i=ei(e,n);return Math.min(o,Math.max(0,o-i))}function Dt(e){return{scrollHeightPx:e.scrollHeight,scrollTopPx:e.scrollTop,clientHeightPx:e.clientHeight}}const Ko={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"};function pe(e){return`${e.path}\0${e.movedToPath??""}`}function ti(e,n){return e?!n||e===n?e:`${e}
|
|
2
|
+
${n}`.trim():n}function ni(e,n){const o=e.operation==="add"||n.operation==="add"?"add":e.operation==="delete"||n.operation==="delete"?"delete":"update";return{path:n.path||e.path,operation:o,movedToPath:n.movedToPath??e.movedToPath??null,diff:ti(e.diff,n.diff),addedLineCount:e.addedLineCount+n.addedLineCount,removedLineCount:e.removedLineCount+n.removedLineCount}}function oi(e,n){const o=e.operation==="add"?0:e.operation==="update"?1:2,i=n.operation==="add"?0:n.operation==="update"?1:2;if(o!==i)return o-i;const m=`${e.path}\0${e.movedToPath??""}`,r=`${n.path}\0${n.movedToPath??""}`;return m.localeCompare(r)}function an(e){const n=new Map;for(const o of e){const i=`${o.path}\0${o.movedToPath??""}`,m=n.get(i);n.set(i,m?ni(m,o):{...o})}return Array.from(n.values()).sort(oi)}function fn(e,n){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?n("Moved + edited"):n("Moved"):e.operation==="add"?n("Added"):e.operation==="delete"?n("Deleted"):n("Edited")}function si(e){return e.operation==="update"&&e.movedToPath?"→":e.operation==="add"?"+":e.operation==="delete"?"−":"M"}function un(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function Ze(e){const n=[];return e.addedLineCount>0&&n.push(`+${e.addedLineCount}`),e.removedLineCount>0&&n.push(`-${e.removedLineCount}`),n.join(" ")}function Go(e,n,o=""){const i=[];return e>0&&i.push({tone:"add",label:`+${e}`}),n>0&&i.push({tone:"remove",label:`-${n}`}),i.length>0?i:o?[{tone:"neutral",label:o}]:[]}function ai(e){return Go(e.addedLineCount,e.removedLineCount)}function zo(e,n){return e===1?`1 ${n("file changed")}`:`${e} ${n("files changed")}`}function ii(e,n){if(!e||e.changes.length===0)return"";let o=0,i=0,m=0,r=0;for(const u of e.changes){if(u.operation==="add"){o+=1;continue}if(u.operation==="delete"){i+=1;continue}if(u.movedToPath){r+=1;continue}m+=1}const h=[];return m>0&&h.push(`${m} ${n("edited")}`),o>0&&h.push(`${o} ${n("added")}`),i>0&&h.push(`${i} ${n("deleted")}`),r>0&&h.push(`${r} ${n("moved")}`),h.join(", ")}function ri(e,n){if(!e||e.changes.length===0)return n("Modified files");const o=zo(e.changes.length,n),i=ii(e,n);return i?`${o} · ${i}`:o}function li(e){if(!e||e.changes.length===0)return[];const n=e.changes.reduce((m,r)=>m+r.addedLineCount,0),o=e.changes.reduce((m,r)=>m+r.removedLineCount,0),i=e.changes.some(m=>m.movedToPath)?"Moved":"Ready";return Go(n,o,i)}function ct(e,n){const o=Ro(e,n),i=vo(po(n.trim())),m=vo(po(o));return i&&m.startsWith(`${i}/`)?m.slice(i.length+1):e}function ci(e,n,o){if(!e||e.changes.length===0)return"";const i=e.changes.map(m=>{const r=ct(m.path,n),h=m.movedToPath?` -> ${ct(m.movedToPath,n)}`:"",u=Ze(m);return`- ${fn(m,o)}: ${r}${h}${u?` (${u})`:""}`});return`${o("Modified files")}:
|
|
3
|
+
${i.join(`
|
|
4
|
+
`)}`.trim()}function ui(e){var i;const o=((i=(e.movedToPath||e.path).split(".").pop())==null?void 0:i.toLowerCase())??"";return Ko[o]??o??""}function di(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function fi(e){const n=e.diff.replace(/\r\n/g,`
|
|
5
|
+
`),o=n.length>0?n.split(`
|
|
6
|
+
`):[];return o.length>0&&o[o.length-1]===""&&o.pop(),o.map((i,m)=>({key:`${pe(e)}:synthetic:${m}`,kind:e.operation==="delete"?"remove":"add",oldLine:e.operation==="delete"?m+1:null,newLine:e.operation==="delete"?null:m+1,text:i}))}function mi(e){const n=e.diff.replace(/\r\n/g,`
|
|
7
|
+
`),o=n.length>0?n.split(`
|
|
8
|
+
`):[];o.length>0&&o[o.length-1]===""&&o.pop();const i=[];let m=0,r=0;for(const[h,u]of o.entries()){const p=u.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(p){m=Number(p[1]),r=Number(p[2]),i.push({key:`${pe(e)}:hunk:${h}`,kind:"hunk",oldLine:null,newLine:null,text:u});continue}if(u.startsWith("+")&&!u.startsWith("+++")){i.push({key:`${pe(e)}:add:${h}`,kind:"add",oldLine:null,newLine:r,text:u.slice(1)}),r+=1;continue}if(u.startsWith("-")&&!u.startsWith("---")){i.push({key:`${pe(e)}:remove:${h}`,kind:"remove",oldLine:m,newLine:null,text:u.slice(1)}),m+=1;continue}if(u.startsWith(" ")){i.push({key:`${pe(e)}:context:${h}`,kind:"context",oldLine:m,newLine:r,text:u.slice(1)}),m+=1,r+=1;continue}i.push({key:`${pe(e)}:meta:${h}`,kind:"meta",oldLine:null,newLine:null,text:u})}return i}function hi(e){return!e||!e.diff.trim()?[]:di(e)?mi(e):fi(e)}function gi(e){return!!(e!=null&&e.diff.trim())}function vi(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}function pi(e,n){if(e.size===0)return e;const o=new Set;for(const i of e)n.has(i)&&o.add(i);return o.size===e.size?e:o}function yi(e){const{getMessages:n,getLiveTurnId:o,isFileChangeMessage:i,isCopyableAssistantMessage:m,isReasoningMessage:r,isPlanMessage:h,isFoldMember:u,getHiddenGroupedCommandIds:p,isMobile:v}=e,S=q(new Set),y=q(null),F=q(""),M=q(!1),H=_(()=>{var he,xe;const D=new Map,G=new Map,ye=new Map,Ce=j=>!i(j)&&!r(j)&&!h(j)&&!p().has(j.id)&&!u(j);for(const j of n()){const $e=typeof j.turnIndex=="number"?`turn:${j.turnIndex}`:`message:${j.id}`;if(Ce(j)&&D.set($e,j.id),m(j)&&typeof j.turnIndex=="number"&&Array.isArray(j.fileChanges)&&j.fileChanges.length>0&&G.set(j.id,{changes:an(j.fileChanges),sourceMessageIds:[],source:"assistant",turnId:j.turnId??""}),!i(j))continue;const He=ye.get($e);He?He.push(j):ye.set($e,[j])}const me={};for(const[j,$e]of ye.entries()){const He=D.get(j);if(!He)continue;const $t=((he=G.get(He))==null?void 0:he.turnId)??"";me[He]={changes:an($e.flatMap(Oe=>Oe.fileChanges??[])),sourceMessageIds:$e.map(Oe=>Oe.id),source:"metadata",turnId:((xe=$e.find(Oe=>typeof Oe.turnId=="string"&&Oe.turnId.length>0))==null?void 0:xe.turnId)??$t}}for(const[j,$e]of G.entries())me[j]||(me[j]=$e);return me}),J=_(()=>{var Ce;const D=new Map,G=new Set;for(const me of Object.values(H.value))for(const he of me.sourceMessageIds)G.add(he);for(const me of n()){if(!i(me))continue;const he=typeof me.turnIndex=="number"?`turn:${me.turnIndex}`:`message:${me.id}`,xe=D.get(he);xe?xe.push(me):D.set(he,[me])}const ye={};for(const[me,he]of D.entries()){if(he.some(j=>G.has(j.id)))continue;const xe=he[he.length-1];xe&&(ye[xe.id]={changes:an(he.flatMap(j=>j.fileChanges??[])),sourceMessageIds:he.map(j=>j.id),source:"metadata",turnId:xe.turnId??((Ce=he.find(j=>typeof j.turnId=="string"&&j.turnId.length>0))==null?void 0:Ce.turnId)??""})}return ye}),U=_(()=>{const D=new Set;for(const G of Object.values(H.value))for(const ye of G.sourceMessageIds)D.add(ye);for(const[G,ye]of Object.entries(J.value))for(const Ce of ye.sourceMessageIds)Ce!==G&&D.add(Ce);return D}),P=_(()=>{var D;return((D=y.value)==null?void 0:D.changes)??[]}),C=_(()=>{const D=P.value;return D.length===0?null:D.find(G=>pe(G)===F.value)??D[0]}),L=_(()=>hi(C.value));function $(D){const G=new Set(S.value);G.has(D.id)?G.delete(D.id):G.add(D.id),S.value=G}function E(D){return S.value.has(D.id)}function B(D,G){D&&(y.value=D,F.value=pe(G),M.value=!1)}function b(){y.value=null,F.value="",M.value=!1}function Y(){M.value=!M.value}function V(){M.value=!1}function ve(D){F.value=pe(D),v()&&(M.value=!1)}function tt(D){return H.value[D]??null}function ut(D){return S.value.has(D)}function T(D){const G=n().find(ye=>ye.id===D);G&&$(G)}function A(D){return tt(D.id)}function O(D){return J.value[D.id]??null}function Q(D){if(!D)return!1;const G=o();return G?(D.turnId??"")!==G:!0}function fe(){const D=new Set([...Object.keys(H.value),...Object.keys(J.value)]);S.value=pi(S.value,D)}return{anchoredFileChangeSummaryByAnchorId:H,standaloneFileChangeSummaryByMessageId:J,hiddenFileChangeMessageIds:U,isDiffViewerFileListOpen:M,diffViewerChanges:P,activeDiffViewerChange:C,activeDiffViewerLines:L,toggleFileChangeSummary:$,isFileChangeSummaryExpanded:E,openDiffViewer:B,closeDiffViewer:b,toggleDiffViewerFileList:Y,closeDiffViewerFileList:V,selectDiffViewerChange:ve,readAnchoredFileChangeSummaryById:tt,isFileChangeSummaryExpandedById:ut,toggleFileChangeSummaryById:T,readAnchoredFileChangeSummary:A,readStandaloneFileChangeSummary:O,isFileChangeSummaryVisible:Q,pruneFileChangeSummaryIds:fe}}function wi(e){const{getMessages:n,isCopyableAssistantMessage:o,isPlanMessage:i,planStepCopyMarker:m,buildFileChangeCopyText:r,getAnchoredFileChangeSummaries:h}=e,u=q("");let p=null;function v(L){var B;const $=bt(L);if(!$)return"";const E=[];return(B=$.explanation)!=null&&B.trim()&&E.push($.explanation.trim()),$.steps.length>0&&E.push($.steps.map(b=>`- ${m(b.status)} ${b.step}`.trim()).join(`
|
|
9
|
+
`)),E.join(`
|
|
10
|
+
|
|
11
|
+
`).trim()}function S(L){const $=[],E=L.text.trim()||v(L),B=i(L)&&E?`Plan
|
|
12
|
+
${E}`:E;B&&$.push(B);const b=(L.fileAttachments??[]).map(V=>V.path.trim()).filter(V=>V.length>0);b.length>0&&$.push(`Files:
|
|
13
|
+
${b.join(`
|
|
14
|
+
`)}`);const Y=(L.images??[]).map(V=>V.trim()).filter(V=>V.length>0);return Y.length>0&&$.push(`Images:
|
|
15
|
+
${Y.join(`
|
|
16
|
+
`)}`),$.join(`
|
|
17
|
+
|
|
18
|
+
`).trim()}const y=_(()=>{var E;const L=new Map;for(const B of n()){if(!o(B))continue;const b=S(B);if(!b)continue;const Y=typeof B.turnIndex=="number"?`turn:${B.turnIndex}`:`message:${B.id}`,V=L.get(Y);if(V){V.anchorMessageId=B.id,V.parts.push(b);continue}L.set(Y,{anchorMessageId:B.id,parts:[b]})}const $={};for(const B of L.values()){const b=B.parts.join(`
|
|
19
|
+
|
|
20
|
+
`).trim();b&&($[B.anchorMessageId]=b)}for(const[B,b]of Object.entries(h())){if(b.source!=="metadata")continue;const Y=r(b);if(!Y)continue;const V=(E=$[B])==null?void 0:E.trim();$[B]=V?`${V}
|
|
21
|
+
|
|
22
|
+
${Y}`:Y}return $}),F=_(()=>{const L=new Map;for(const E of n()){if(!o(E)||typeof E.turnIndex!="number")continue;const B=`turn:${E.turnIndex}`,b=L.get(B);if(b){b.anchorMessageId=E.id,b.turnIndex=E.turnIndex;continue}L.set(B,{anchorMessageId:E.id,turnIndex:E.turnIndex})}const $={};for(const E of L.values())$[E.anchorMessageId]=E.turnIndex;return $});function M(L){return typeof y.value[L.id]=="string"}function H(L){return L.role==="user"&&S(L).length>0}function J(L){u.value=L,p&&clearTimeout(p),p=setTimeout(()=>{u.value===L&&(u.value=""),p=null},1800)}ba()&&xt(()=>{p&&(clearTimeout(p),p=null)});async function U(L){const $=n().find(b=>b.id===L);if(!$)return;const E=S($);if(!E)return;let B=!1;try{await Rt(E),B=!0}catch{B=!1}B||(B=yo(E)),B&&J(L)}function P(L){return typeof F.value[L.id]=="number"}async function C(L){const $=y.value[L]??"";if(!$)return;let E=!1;try{await Rt($),E=!0}catch{E=!1}E||(E=yo($)),E&&J(L)}return{copiedResponseAnchorId:u,copyableResponseContentByAnchorId:y,forkableTurnIndexByAnchorId:F,showCopyResponseButton:M,isCopyableUserMessage:H,copyUserMessage:U,showForkResponseButton:P,copyResponse:C}}function ki(e){const{getMessages:n,getLiveOverlay:o,isCommandMessage:i}=e,m=q(new Set),r=_(()=>{var L;const C=n();for(let $=C.length-1;$>=0;$-=1){const E=C[$];if(E.messageType==="commandExecution"&&((L=E.commandExecution)==null?void 0:L.status)==="inProgress")return E.id}return""}),h=_(()=>n().some(C=>C.role==="assistant"&&C.messageType==="agentMessage.live"&&C.text.trim().length>0)),u=_(()=>!!o()||r.value.length>0||h.value),p=_(()=>{const C=n(),L={};for(let $=0;$<C.length;){const E=C[$];if(!i(E)){$+=1;continue}const B=[];for(;$<C.length&&i(C[$]);)B.push(C[$]),$+=1;if(B.length<=1)continue;const b=B[B.length-1];L[b.id]=B.slice(0,-1)}return L}),v=_(()=>{const C=new Set;for(const L of Object.values(p.value))for(const $ of L)C.add($.id);return C});function S(C){return i(C)&&m.value.has(C.id)}function y(C){return i(C)&&u.value}function F(C){var L;return i(C)&&(u.value||((L=C.commandExecution)==null?void 0:L.status)==="inProgress")}function M(C){if(!i(C))return;const L=new Set(m.value);L.has(C.id)?L.delete(C.id):L.add(C.id),m.value=L}function H(C){return p.value[C.id]??[]}function J(C){return i(C)?[...H(C),C]:[]}function U(C,L){if(C.size===0)return C;const $=new Set;for(const E of C)L.has(E)&&$.add(E);return $.size===C.size?C:$}function P(C){m.value=U(m.value,C)}return{expandedCommandIds:m,activeCommandMessageId:r,hasLiveAssistantText:h,isLiveTurnRuntime:u,groupedCommandsByLatestId:p,hiddenGroupedCommandIds:v,isCommandExpanded:S,isCommandCompact:y,isCommandOutputCondensed:F,toggleCommandExpand:M,getGroupedCommandsForLatest:H,getWorkBlockCommands:J,pruneCommandIdSets:P}}function bi(e){const{getActiveThreadId:n,getCwd:o,onFileChangesChanged:i,updateThreadFileChanges:m,t:r}=e,h=q({}),u=q({}),p=q({});function v(P){const C=n();return P!=null&&P.turnId&&C?`thread:${C}:turn:${P.turnId}`:""}function S(P){return v(P).length>0}function y(P){const C=v(P);return C?h.value[C]??"idle":"idle"}function F(P){const C=v(P);return C?u.value[C]??"":""}function M(P){const C=y(P);return C==="undone"||C==="redoing"?"redo":"undo"}function H(P){const C=y(P);return C==="undoing"?r("Undoing"):C==="redoing"?r("Redoing"):M(P)==="redo"?r("Redo"):r("Undo")}async function J(P,C,L){const $=v(P),E=n(),B=o();if(!P||!$||!E||!B)return;const b=y(P),Y=C==="undo"?"undoing":"redoing";h.value={...h.value,[$]:Y},u.value={...u.value,[$]:""};let V;try{const ve=p.value[$]??[];V=await m(E,P.turnId,B,C,ve.length>0?ve:void 0,"single_turn",L)}catch(ve){h.value={...h.value,[$]:b},u.value={...u.value,[$]:ve instanceof Error?ve.message:r("Failed to update file changes.")};return}if(V.errors.length>0){C==="undo"?(p.value={...p.value,[$]:V.revertedPatchIds??[]},h.value={...h.value,[$]:"undone"}):((V.appliedPatchIds??[]).length>0&&(p.value={...p.value,[$]:V.appliedPatchIds??[]}),h.value={...h.value,[$]:"undone"}),u.value={...u.value,[$]:V.errors.join("; ")};return}if((V.changed??0)<=0){h.value={...h.value,[$]:b},u.value={...u.value,[$]:V.message||r(C==="undo"?"No file changes to undo.":"No file changes to redo.")};return}C==="undo"?(p.value={...p.value,[$]:V.revertedPatchIds??[]},h.value={...h.value,[$]:"undone"}):(p.value={...p.value,[$]:V.appliedPatchIds??[]},h.value={...h.value,[$]:"redone"}),i()}function U(){h.value={},u.value={},p.value={}}return{fileChangeActionState:h,fileChangeActionError:u,fileChangeRedoPatchIds:p,fileChangeActionKey:v,isFileChangeActionable:S,fileChangeActionStatus:y,fileChangeActionErrorText:F,fileChangeNextAction:M,fileChangeActionLabel:H,runFileChangeAction:J,resetFileChangeActions:U}}function Ci(e){const{toEditUrlFromBrowseHref:n}=e,o=q(!1),i=q(0),m=q(0),r=q(""),h=q("");function u(v){var M,H;const S=v.target,y=(M=S==null?void 0:S.closest)==null?void 0:M.call(S,"a.message-file-link");if(!y)return;const F=(((H=y.getAttribute)==null?void 0:H.call(y,"href"))??"").trim();!F||F==="#"||(v.preventDefault(),v.stopPropagation(),r.value=F,h.value=n(F),i.value=v.clientX,m.value=v.clientY,o.value=!0)}function p(){o.value&&(o.value=!1)}return{isFileLinkContextMenuVisible:o,fileLinkContextMenuX:i,fileLinkContextMenuY:m,fileLinkContextBrowseUrl:r,fileLinkContextEditUrl:h,handleConversationContextMenu:u,closeFileLinkContextMenu:p}}function xi(e){const{isVideo:n}=e,o=q(""),i=q(!1),m=q(0),r=q(new Set);function h(y,F){return`${y}:${F}`}function u(y,F){return r.value.has(h(y,F))}function p(y,F){const M=new Set(r.value);M.add(h(y,F)),r.value=M,m.value+=1}function v(y){o.value=y,i.value=n(y)}function S(){o.value="",i.value=!1}return{modalImageUrl:o,modalIsVideo:i,markdownImageFailureVersion:m,isMarkdownImageFailed:u,onMarkdownImageError:p,openImageModal:v,closeImageModal:S}}const $i=["aria-label"],_i={class:"confirm-dialog-title"},Ti={class:"confirm-dialog-message"},Ii={class:"confirm-dialog-actions"},Si=ce({__name:"ConfirmDialog",props:{visible:{type:Boolean},title:{},message:{},confirmLabel:{default:""},cancelLabel:{default:""},danger:{type:Boolean,default:!1}},emits:["confirm","cancel"],setup(e){return(n,o)=>(a(),de(Ho,{to:"body"},[e.visible?(a(),l("div",{key:0,class:"confirm-dialog-overlay",onClick:o[2]||(o[2]=et(i=>n.$emit("cancel"),["self"]))},[f("div",{class:"confirm-dialog-panel",role:"alertdialog","aria-modal":"true","aria-label":e.title},[f("h3",_i,w(e.title),1),f("p",Ti,w(e.message),1),f("div",Ii,[f("button",{class:"confirm-dialog-btn confirm-dialog-btn-cancel",type:"button",onClick:o[0]||(o[0]=i=>n.$emit("cancel"))},w(e.cancelLabel||"Cancel"),1),f("button",{class:oe(["confirm-dialog-btn confirm-dialog-btn-confirm",{"is-danger":e.danger}]),type:"button",onClick:o[1]||(o[1]=i=>n.$emit("confirm"))},w(e.confirmLabel||"Confirm"),3)])],8,$i)])):I("",!0)]))}}),Mi=se(Si,[["__scopeId","data-v-860b1449"]]),Li={key:0,class:"diff-viewer-sidebar"},Ai={class:"diff-viewer-sidebar-header"},Fi={class:"diff-viewer-sidebar-title"},Pi={class:"diff-viewer-sidebar-count"},Ei={class:"diff-viewer-sidebar-list"},Bi=["data-active","onClick"],Di=["data-operation"],Ri={class:"diff-viewer-file-label"},Hi={key:0,class:"diff-viewer-file-delta"},Oi={class:"diff-viewer-main"},Ni={class:"diff-viewer-toolbar"},qi={class:"diff-viewer-title-wrap"},Vi={class:"diff-viewer-title"},Wi={class:"diff-viewer-subtitle"},ji={key:0},Ui={class:"diff-viewer-toolbar-actions"},Ki=["aria-label"],Gi={key:0,class:"diff-viewer-empty"},zi={class:"diff-viewer-empty-title"},Yi={class:"diff-viewer-empty-text"},Xi={key:1,class:"diff-viewer-panel"},Ji={class:"diff-viewer-meta"},Qi={class:"diff-viewer-language"},Zi={class:"diff-viewer-lines"},er=["data-kind"],tr={class:"diff-viewer-line-number"},nr={class:"diff-viewer-line-number"},or={class:"diff-viewer-line-marker"},sr=["innerHTML"],ar={class:"diff-viewer-mobile-sheet-header"},ir={class:"diff-viewer-sidebar-title"},rr={class:"diff-viewer-sidebar-count"},lr={class:"diff-viewer-mobile-sheet-list"},cr=["data-active","onClick"],ur=["data-operation"],dr={class:"diff-viewer-file-label"},fr={key:0,class:"diff-viewer-file-delta"},mr=ce({__name:"DiffViewer",props:{change:{},changes:{},lines:{},isMobile:{type:Boolean},isFileListOpen:{type:Boolean},cwd:{}},emits:["close","select-change","toggle-file-list","close-file-list"],setup(e){const n=e,{t:o}=be();function i(u){return u.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}const m=_(()=>u=>fn(u,o)),r=_(()=>u=>zo(u,o)),h=_(()=>u=>ct(u,n.cwd));return(u,p)=>(a(),de(Ho,{to:"body"},[e.change?(a(),l("div",{key:0,class:"diff-viewer-backdrop",onClick:p[5]||(p[5]=v=>u.$emit("close"))},[f("div",{class:"diff-viewer-shell",onClick:p[4]||(p[4]=et(()=>{},["stop"]))},[e.isMobile?I("",!0):(a(),l("aside",Li,[f("div",Ai,[f("p",Fi,w(c(o)("Changed files")),1),f("p",Pi,w(r.value(e.changes.length)),1)]),f("div",Ei,[(a(!0),l(N,null,z(e.changes,v=>(a(),l("button",{key:`diff-viewer:${c(pe)(v)}`,type:"button",class:"diff-viewer-file-button","data-active":c(pe)(v)===c(pe)(e.change),onClick:S=>u.$emit("select-change",v)},[f("span",{class:"file-change-badge","data-operation":c(un)(v)},w(m.value(v)),9,Di),f("span",Ri,[Re(w(h.value(v.path))+" ",1),v.movedToPath?(a(),l(N,{key:0},[Re(" → "+w(h.value(v.movedToPath)),1)],64)):I("",!0)]),c(Ze)(v)?(a(),l("span",Hi,w(c(Ze)(v)),1)):I("",!0)],8,Bi))),128))])])),f("section",Oi,[f("div",Ni,[f("div",qi,[f("p",Vi,[Re(w(h.value(e.change.path))+" ",1),e.change.movedToPath?(a(),l(N,{key:0},[Re(" → "+w(h.value(e.change.movedToPath)),1)],64)):I("",!0)]),f("p",Wi,[Re(w(m.value(e.change))+" ",1),c(Ze)(e.change)?(a(),l("span",ji," · "+w(c(Ze)(e.change)),1)):I("",!0)])]),f("div",Ui,[e.isMobile?(a(),l("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:p[0]||(p[0]=v=>u.$emit("toggle-file-list"))},w(r.value(e.changes.length)),1)):I("",!0),f("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":c(o)("Close diff viewer"),onClick:p[1]||(p[1]=v=>u.$emit("close"))},[te(Oo,{class:"icon-svg"})],8,Ki)])]),c(gi)(e.change)?(a(),l("div",Xi,[f("div",Ji,[f("span",Qi,w(c(ui)(e.change)||"diff"),1)]),f("div",Zi,[(a(!0),l(N,null,z(e.lines,v=>(a(),l("div",{key:v.key,class:"diff-viewer-line","data-kind":v.kind},[f("span",tr,w(v.oldLine??""),1),f("span",nr,w(v.newLine??""),1),f("span",or,w(c(vi)(v)),1),f("code",{class:"diff-viewer-line-code",innerHTML:i(v.text)||" "},null,8,sr)],8,er))),128))])])):(a(),l("div",Gi,[f("p",zi,w(c(o)("No diff available")),1),f("p",Yi,w(c(o)("This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.")),1)]))]),te(Ca,{name:"diff-viewer-sheet"},{default:lt(()=>[e.isMobile&&e.isFileListOpen?(a(),l("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:p[3]||(p[3]=v=>u.$emit("close-file-list"))},[f("div",{class:"diff-viewer-mobile-sheet",onClick:p[2]||(p[2]=et(()=>{},["stop"]))},[p[6]||(p[6]=f("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),f("div",ar,[f("p",ir,w(c(o)("Changed files")),1),f("p",rr,w(r.value(e.changes.length)),1)]),f("div",lr,[(a(!0),l(N,null,z(e.changes,v=>(a(),l("button",{key:`diff-viewer-sheet:${c(pe)(v)}`,type:"button",class:"diff-viewer-file-button","data-active":c(pe)(v)===c(pe)(e.change),onClick:S=>u.$emit("select-change",v)},[f("span",{class:"file-change-badge","data-operation":c(un)(v)},w(m.value(v)),9,ur),f("span",dr,[Re(w(h.value(v.path))+" ",1),v.movedToPath?(a(),l(N,{key:0},[Re(" → "+w(h.value(v.movedToPath)),1)],64)):I("",!0)]),c(Ze)(v)?(a(),l("span",fr,w(c(Ze)(v)),1)):I("",!0)],8,cr))),128))])])])):I("",!0)]),_:1})])])):I("",!0)]))}}),hr=se(mr,[["__scopeId","data-v-a9ed279d"]]),gr={},vr={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function pr(e,n){return a(),l("svg",vr,[...n[0]||(n[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Io=se(gr,[["render",pr]]),yr={class:"file-change-summary-label"},wr={class:"file-change-summary-status"},kr=["data-tone"],br={class:"file-change-panel-inner"},Cr={class:"file-change-list"},xr=["data-operation","title"],$r={class:"file-change-path-group"},_r=["title","onClick"],Tr={key:0,class:"file-change-arrow"},Ir=["title","onClick"],Sr={key:0,class:"file-change-delta"},Mr=["data-tone"],Lr=["title","aria-label","onClick"],Ar={key:0,class:"file-change-actions"},Fr={key:0,class:"file-change-action-error"},Pr=["disabled","title","aria-label"],Er=ce({__name:"FileChangeSummaryBlock",props:{summary:{},expanded:{type:Boolean},inline:{type:Boolean},cwd:{},actionable:{type:Boolean},actionStatus:{},actionErrorText:{},nextAction:{},actionLabel:{}},emits:["toggle","open-diff","request-action","request-file-action"],setup(e){const n=e,{t:o}=be(),i=_(()=>u=>fn(u,o)),m=_(()=>u=>ri(u,o)),r=_(()=>u=>ct(u,n.cwd)),h=_(()=>u=>`${o("Undo")} ${ct(u.path,n.cwd)}`);return(u,p)=>e.summary?(a(),l("section",{key:0,class:oe(["file-change-summary-block",{"file-change-summary-block-inline":e.inline}])},[f("button",{type:"button",class:oe(["file-change-summary-row",{"file-change-summary-row-expanded":e.expanded}]),onClick:p[0]||(p[0]=v=>u.$emit("toggle"))},[f("span",{class:oe(["file-change-chevron",{"file-change-chevron-open":e.expanded}])},"▶",2),f("span",yr,w(m.value(e.summary)),1),f("span",wr,[(a(!0),l(N,null,z(c(li)(e.summary),v=>(a(),l("span",{key:`summary-status:${e.summary.turnId}:${v.tone}:${v.label}`,class:"file-change-signed-count","data-tone":v.tone},w(v.label),9,kr))),128))])],2),f("div",{class:oe(["file-change-panel",{"file-change-panel-visible":e.expanded}])},[f("div",br,[f("ul",Cr,[(a(!0),l(N,null,z(e.summary.changes,v=>(a(),l("li",{key:`file-change:${e.summary.turnId}:${v.path}:${v.movedToPath||""}`,class:"file-change-item"},[f("span",{class:"file-change-badge","data-operation":c(un)(v),title:i.value(v)},w(c(si)(v)),9,xr),f("span",$r,[f("button",{type:"button",class:"file-change-path-button",title:v.path,onClick:S=>u.$emit("open-diff",v)},w(r.value(v.path)),9,_r),v.movedToPath?(a(),l("span",Tr,"→")):I("",!0),v.movedToPath?(a(),l("button",{key:1,type:"button",class:"file-change-path-button",title:v.movedToPath,onClick:S=>u.$emit("open-diff",v)},w(r.value(v.movedToPath)),9,Ir)):I("",!0)]),v.addedLineCount>0||v.removedLineCount>0?(a(),l("span",Sr,[(a(!0),l(N,null,z(c(ai)(v),S=>(a(),l("span",{key:`change-delta:${e.summary.turnId}:${v.path}:${S.tone}:${S.label}`,class:"file-change-signed-count","data-tone":S.tone},w(S.label),9,Mr))),128))])):I("",!0),e.actionable?(a(),l("button",{key:1,type:"button",class:"file-change-file-undo-button",title:h.value(v),"aria-label":h.value(v),onClick:S=>u.$emit("request-file-action",v)},[te(Io,{class:"icon-svg file-change-action-icon"})],8,Lr)):I("",!0)]))),128))]),e.actionable?(a(),l("div",Ar,[e.actionErrorText?(a(),l("p",Fr,w(e.actionErrorText),1)):I("",!0),f("button",{type:"button",class:"file-change-action-button",disabled:e.actionStatus==="undoing"||e.actionStatus==="redoing",title:e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn","aria-label":e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn",onClick:p[1]||(p[1]=v=>u.$emit("request-action",e.nextAction))},[te(Io,{class:oe(["icon-svg file-change-action-icon",{"file-change-action-icon-redo":e.nextAction==="redo"}])},null,8,["class"]),Re(" "+w(e.actionLabel),1)],8,Pr)])):I("",!0)])],2)],2)):I("",!0)}}),So=se(Er,[["__scopeId","data-v-32872c73"]]),Br=ce({__name:"FileLinkContextMenu",props:{visible:{type:Boolean},x:{},y:{},browseUrl:{},editUrl:{}},emits:["close"],setup(e,{emit:n}){const o=e,i=n,m=q(null),r=_(()=>({left:`${String(o.x)}px`,top:`${String(o.y)}px`}));function h(){i("close")}function u(){const M=o.browseUrl;h(),!(!M||M==="#")&&window.open(M,"_blank","noopener,noreferrer")}function p(){const M=o.editUrl;h(),!(!M||M==="#")&&window.open(M,"_blank","noopener,noreferrer")}async function v(){const M=o.browseUrl;if(h(),!(!M||M==="#"))try{await Rt(M)}catch{}}function S(M){if(!o.visible)return;const H=m.value;if(!H){h();return}const J=M.target;J instanceof Node&&H.contains(J)||h()}function y(){h()}function F(M){M.key==="Escape"&&h()}return we(()=>o.visible,M=>{M?(window.addEventListener("pointerdown",S,!0),window.addEventListener("blur",y),window.addEventListener("keydown",F,!0)):(window.removeEventListener("pointerdown",S,!0),window.removeEventListener("blur",y),window.removeEventListener("keydown",F,!0))}),xt(()=>{window.removeEventListener("pointerdown",S,!0),window.removeEventListener("blur",y),window.removeEventListener("keydown",F,!0)}),(M,H)=>e.visible?(a(),l("div",{key:0,ref_key:"menuRef",ref:m,class:"file-link-context-menu",style:Ie(r.value),onClick:H[0]||(H[0]=et(()=>{},["stop"]))},[f("button",{type:"button",class:"file-link-context-menu-item",onClick:u}," Open link "),f("button",{type:"button",class:"file-link-context-menu-item",onClick:v}," Copy link "),e.editUrl?(a(),l("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:p}," Edit file ")):I("",!0)],4)):I("",!0)}}),Dr=se(Br,[["__scopeId","data-v-fa2f389c"]]),Rr=12e3,Hr=240;function Or(e,{streaming:n,truncateStreaming:o=!0,maxChars:i=Rr,maxLines:m=Hr}){if(!o)return e;let r=e,h=!1;if(i>0&&r.length>i&&(r=r.slice(-i),h=!0),m>0){const u=r.split(/\r?\n/);u.length>m&&(r=u.slice(-m).join(`
|
|
23
|
+
`),h=!0)}return h?`...
|
|
24
|
+
${r}`:r}const Nr={class:"conversation-item conversation-item-overlay"},qr={class:"message-row"},Vr={class:"message-stack"},Wr={class:"live-overlay-inline","aria-live":"polite"},jr={class:"live-overlay-title-row"},Ur={key:0,class:"live-overlay-spinner","aria-hidden":"true"},Kr=["aria-expanded"],Gr={class:"live-overlay-label"},zr={class:"live-overlay-toggle","aria-hidden":"true"},Yr={key:2,class:"live-overlay-label"},Xr={key:0,class:"live-overlay-reasoning"},Jr={key:1,class:"live-overlay-error"},Qr=["href"],Zr=ce({__name:"LiveOverlayItem",props:{overlay:{},feedbackMailto:{}},setup(e){const n=e,{buildFeedbackMailto:o,recordVisibleFailure:i}=No(),{t:m}=be(),r=q(!0);function h(){r.value=!r.value}const u=_(()=>{var v;return Or(((v=n.overlay)==null?void 0:v.reasoningText)??"",{streaming:!0})});function p(v,S){i(S);const y=v.currentTarget;y instanceof HTMLAnchorElement&&(y.href=o())}return(v,S)=>{var y,F,M,H,J,U;return a(),l("li",Nr,[f("div",qr,[f("div",Vr,[f("article",Wr,[f("div",jr,[(y=e.overlay)!=null&&y.errorText?I("",!0):(a(),l("span",Ur)),(F=e.overlay)!=null&&F.reasoningText?(a(),l("button",{key:1,type:"button",class:"live-overlay-heading","aria-expanded":r.value,onClick:h},[f("span",Gr,w((M=e.overlay)==null?void 0:M.activityLabel),1),f("span",zr,w(r.value?"▾":"▸"),1)],8,Kr)):(a(),l("p",Yr,w((H=e.overlay)==null?void 0:H.activityLabel),1))]),(J=e.overlay)!=null&&J.reasoningText&&r.value?(a(),l("p",Xr,w(u.value),1)):I("",!0),(U=e.overlay)!=null&&U.errorText?(a(),l("div",Jr,[f("span",null,w(e.overlay.errorText),1),f("a",{class:"live-overlay-feedback",href:e.feedbackMailto,onClick:S[0]||(S[0]=P=>p(P,e.overlay.errorText))},w(c(m)("Send feedback")),9,Qr)])):I("",!0)])])])])}}}),el=se(Zr,[["__scopeId","data-v-edcf19dd"]]),tl=["title"],nl={class:"model-switch-label"},ol=ce({__name:"ModelSwitchDivider",props:{from:{},to:{}},setup(e){return(n,o)=>(a(),l("div",{class:"model-switch-divider",title:e.to?`切换模型:${e.from??""} → ${e.to}`:void 0},[o[0]||(o[0]=f("span",{class:"model-switch-track","aria-hidden":"true"},null,-1)),f("span",nl,w(e.from?`${e.from} → `:"")+w(e.to),1),o[1]||(o[1]=f("span",{class:"model-switch-track","aria-hidden":"true"},null,-1))],8,tl))}}),Mo=se(ol,[["__scopeId","data-v-1fba0d09"]]),sl={class:"time-divider"},al={class:"time-divider-label"},il=ce({__name:"TimeDivider",props:{label:{}},setup(e){return(n,o)=>(a(),l("div",sl,[f("span",al,w(e.label),1)]))}}),rl=se(il,[["__scopeId","data-v-9f8b7bd2"]]),ll={key:0},cl={key:1,class:"message-bold-text"},ul={key:2,class:"message-italic-text"},dl={key:3,class:"message-strikethrough-text"},fl=["href","title"],ml=["href","title"],hl={key:6,class:"message-inline-code"},gl=ce({__name:"MessageInlineContent",props:{segments:{},toBrowseUrl:{type:Function}},setup(e){return(n,o)=>(a(!0),l(N,null,z(e.segments,(i,m)=>(a(),l(N,{key:m},[i.kind==="text"?(a(),l("span",ll,w(i.value),1)):i.kind==="bold"?(a(),l("strong",cl,w(i.value),1)):i.kind==="italic"?(a(),l("em",ul,w(i.value),1)):i.kind==="strikethrough"?(a(),l("s",dl,w(i.value),1)):i.kind==="file"?(a(),l("a",{key:4,class:"message-file-link",href:e.toBrowseUrl(i.path),target:"_blank",rel:"noopener noreferrer",title:i.path},w(i.displayPath),9,fl)):i.kind==="url"?(a(),l("a",{key:5,class:"message-file-link",href:i.href,target:"_blank",rel:"noopener noreferrer",title:i.href},w(i.value),9,ml)):(a(),l("code",hl,w(i.value),1))],64))),128))}}),rt=se(gl,[["__scopeId","data-v-1cf69093"]]),vl={},pl={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function yl(e,n){return a(),l("svg",pl,[...n[0]||(n[0]=[f("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 wl=se(vl,[["render",yl]]),kl={},bl={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Cl(e,n){return a(),l("svg",bl,[...n[0]||(n[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"},null,-1),f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.5 6.5l4 4"},null,-1)])])}const xl=se(kl,[["render",Cl]]),$l=["data-role"],_l={key:0,class:"message-timestamp"},Tl=["aria-label","title"],Il={key:0,class:"message-rollback-label"},Sl=["aria-label","title"],Ml={class:"message-fork-label"},Ll=["data-copied","aria-label","title"],Al={key:0,class:"message-copy-label"},Fl=ce({__name:"MessageToolbar",props:{role:{},showEdit:{type:Boolean,default:!1},showFork:{type:Boolean,default:!1},showCopy:{type:Boolean,default:!1},copied:{type:Boolean,default:!1},timestamp:{default:""}},emits:["edit","fork","copy"],setup(e){const{t:n}=be();return(o,i)=>e.showEdit||e.showFork||e.showCopy||e.timestamp?(a(),l("div",{key:0,class:"message-toolbar","data-role":e.role},[e.timestamp?(a(),l("span",_l,w(e.timestamp),1)):I("",!0),e.showEdit?(a(),l("button",{key:1,type:"button",class:"message-rollback-button","aria-label":c(n)("Edit this message"),title:c(n)("Edit this message"),onClick:i[0]||(i[0]=m=>o.$emit("edit"))},[te(xl,{class:"icon-svg message-rollback-icon"}),e.role!=="user"?(a(),l("span",Il,w(c(n)("Edit")),1)):I("",!0)],8,Tl)):I("",!0),e.showFork?(a(),l("button",{key:2,type:"button",class:"message-fork-button","aria-label":c(n)("Fork thread from this response"),title:c(n)("Fork thread from this response"),onClick:i[1]||(i[1]=m=>o.$emit("fork"))},[te(xa,{class:"icon-svg message-fork-icon"}),f("span",Ml,w(c(n)("Fork")),1)],8,Sl)):I("",!0),e.showCopy?(a(),l("button",{key:3,type:"button",class:"message-copy-button","data-copied":e.copied,"aria-label":e.copied?c(n)("Response copied"):c(n)("Copy response"),title:e.copied?c(n)("Response copied"):c(n)("Copy response"),onClick:i[2]||(i[2]=m=>o.$emit("copy"))},[te(wl,{class:"icon-svg message-copy-icon"}),e.role!=="user"?(a(),l("span",Al,w(e.copied?"Copied":"Copy"),1)):I("",!0)],8,Ll)):I("",!0)],8,$l)):I("",!0)}}),Pl=se(Fl,[["__scopeId","data-v-1f72b6b0"]]),El="codex-web-local.process-fold.v1",Lo="codex:web-local:process-fold";function rn(){return typeof localStorage>"u"?"auto":localStorage.getItem(El)==="expanded"?"expanded":"auto"}function Bl(e){const n=o=>e(o.detail);return window.addEventListener(Lo,n),()=>window.removeEventListener(Lo,n)}const Dl=["aria-expanded"],Rl={class:"process-fold-label"},Hl={class:"process-fold-toggle","aria-hidden":"true"},Ol={key:0,class:"process-fold-body"},Nl=ce({__name:"ProcessFold",props:{label:{},running:{type:Boolean},hasOutsideContent:{type:Boolean}},setup(e){const n=e,o=q(rn()==="expanded"||!n.hasOutsideContent),i=q(!1);let m=!1;const r=Bl(()=>{i.value=!1,rn()==="expanded"?o.value=!0:!n.running&&n.hasOutsideContent&&(o.value=!1)});we(()=>n.running,u=>{const p=m;m=u,u?(p||(i.value=!1),i.value||(o.value=!0)):p&&!i.value&&n.hasOutsideContent&&rn()!=="expanded"&&(o.value=!1)},{immediate:!0}),xt(()=>r());function h(){i.value=!0,o.value=!o.value}return(u,p)=>(a(),l("div",{class:oe(["process-fold",{"process-fold--open":o.value,"process-fold--running":e.running}])},[f("button",{type:"button",class:"process-fold-header","aria-expanded":o.value,onClick:h},[f("span",Rl,w(e.label),1),f("span",Hl,w(o.value?"▾":"▸"),1)],8,Dl),o.value?(a(),l("div",Ol,[Ge(u.$slots,"default",{},void 0)])):I("",!0)],2))}}),ql=se(Nl,[["__scopeId","data-v-d29a5266"]]),Vl=["aria-label"],Wl=["data-turn","aria-label","onClick"],jl={class:"question-jump-preview-text"},Ul=2,Kl=ce({__name:"QuestionJumpBar",props:{anchors:{},activeTurn:{}},emits:["jump"],setup(e,{emit:n}){const o=()=>getComputedStyle(document.documentElement).getPropertyValue("--live").trim()||"#b26a12",i=e,m=n,{t:r}=be(),h=q(null),u=q(-1),p=q("0px"),v=_(()=>{const U=u.value;return U<0?null:i.anchors[U]??null});function S(U){var E;const P=i.activeTurn===((E=i.anchors[U])==null?void 0:E.turn),C=o(),L={};if(u.value<0)return L.width=P?"18px":"12px",L.background=P?C:void 0,L;const $=Math.abs(U-u.value);return L.width=$===0?"32px":$===1?"20px":$===2?"14px":P?"18px":"12px",L.background=$===0?C:$===1?C+"99":$===2?C+"59":P?C:void 0,L.transitionDelay=`${$*20}ms`,L}function y(U){const P=h.value;if(!P)return-1;const C=Array.from(P.querySelectorAll(".question-jump-item"));let L=-1,$=Number.POSITIVE_INFINITY;for(let E=0;E<C.length;E+=1){const B=C[E].getBoundingClientRect(),b=B.top+B.height/2,Y=Math.abs(U-b);Y<$&&($=Y,L=E)}return L}function F(U){var b;const P=y(U.clientY);if(P<0)return;u.value=P;const C=h.value;if(!C)return;const $=(b=Array.from(C.querySelectorAll(".question-jump-item"))[P])==null?void 0:b.getBoundingClientRect(),E=C.getBoundingClientRect();if(!$)return;const B=$.top+$.height/2;p.value=`${B-E.top}px`}function M(){u.value=-1}function H(U){const P=y(U.clientY),C=P>=0?i.anchors[P]:null;C&&m("jump",C.turn)}function J(U){m("jump",U.turn)}return(U,P)=>e.anchors.length>=Ul?(a(),l("nav",{key:0,class:"question-jump-bar","aria-label":c(r)("Question navigation")},[f("div",{ref_key:"trackRef",ref:h,class:"question-jump-track",onMousemove:F,onMouseleave:M,onMousedown:H},[(a(!0),l(N,null,z(e.anchors,(C,L)=>(a(),l("button",{key:C.turn,type:"button",class:"question-jump-item","data-turn":C.turn,"aria-label":c(r)("Jump to question {n}",{n:C.turn+1}),onMousedown:P[0]||(P[0]=et(()=>{},["prevent"])),onClick:$=>J(C)},[f("span",{class:"question-jump-dot",style:Ie(S(L))},null,4)],40,Wl))),128))],544),v.value?(a(),l("div",{key:0,class:"question-jump-preview",role:"tooltip",style:Ie({top:p.value})},[f("span",jl,w(v.value.text),1)],4)):I("",!0)],8,Vl)):I("",!0)}}),Gl=se(Kl,[["__scopeId","data-v-f2cd9065"]]),zl=["data-state"],Yl=["aria-expanded"],Xl={class:"reasoning-block-title"},Jl={class:"reasoning-block-toggle","aria-hidden":"true"},Ql={key:0,class:"reasoning-block-body"},Zl={key:0,class:"reasoning-block-summary"},ec=["innerHTML"],tc=ce({__name:"ReasoningBlock",props:{message:{},expanded:{type:Boolean},contentHtml:{}},emits:["toggle"],setup(e){const n=e,{t:o}=be(),i=_(()=>{var r;return(((r=n.message.reasoning)==null?void 0:r.summary)??[]).map(h=>h.trim()).filter(Boolean).join(`
|
|
25
|
+
`).trim()});return(m,r)=>(a(),l("div",{class:"reasoning-block","data-state":e.expanded?"expanded":"collapsed"},[f("button",{type:"button",class:"reasoning-block-header","aria-expanded":e.expanded,onClick:r[0]||(r[0]=h=>m.$emit("toggle"))},[f("span",Xl,w(c(o)("Thinking process")),1),f("span",Jl,w(e.expanded?"▾":"▸"),1)],8,Yl),e.expanded?(a(),l("div",Ql,[i.value?(a(),l("p",Zl,w(i.value),1)):I("",!0),f("div",{class:"reasoning-block-content message-card",innerHTML:e.contentHtml},null,8,ec)])):I("",!0)],8,zl))}}),Ao=se(tc,[["__scopeId","data-v-e64f7962"]]),nc=new Set(["read_file","ls","grep","glob","web_fetch","read_skill","code_index","connect_tool_source"]),oc=new Set(["write_file","edit_file","multi_edit","move_file","delete_range","delete_symbol","notebook_edit"]),sc=new Set(["task","run_skill","explore","research","review","security_review"]);function ac(e){var o;const n=((o=e.toolCall)==null?void 0:o.tool)??"";return nc.has(n)?"readonly":oc.has(n)?"modify":sc.has(n)?"delegate":null}const ic=2;function rc(e){var r;const n=[];let o=[],i=null;const m=()=>{if(i!==null&&o.length>=ic)n.push({type:"batch",kind:i,messages:o});else for(const h of o)n.push({type:"tool",message:h});o=[],i=null};for(const h of e){if(h.messageType!=="toolCall"||((r=h.toolCall)==null?void 0:r.status)==="inProgress"){m(),n.push({type:"tool",message:h});continue}const u=ac(h);if(u===null){m(),n.push({type:"tool",message:h});continue}i!==null&&i!==u&&m(),i=u,o.push(h)}return m(),n}function lc(e,n,o){const{t:i}=o;if(e==="readonly"){const m=n.filter(p=>{var v,S;return((v=p.toolCall)==null?void 0:v.tool)==="read_file"||((S=p.toolCall)==null?void 0:S.tool)==="ls"}).length,r=n.filter(p=>{var S;const v=((S=p.toolCall)==null?void 0:S.tool)??"";return v==="grep"||v==="glob"||v==="web_fetch"||v==="code_index"}).length,h=n.length-m-r,u=[];return m>0&&u.push(i("Read {n} files",{n:m})),r>0&&u.push(i("Search {n} files",{n:r})),h>0&&u.push(i("{n} read calls",{n:h})),u.join(" · ")}return e==="modify"?i("Modified {n} files",{n:n.length}):e==="delegate"?i("Delegated {n} tasks",{n:n.length}):i("Explored {n} items",{n:n.length})}const cc={class:"message-row","data-role":"system"},uc={class:"message-stack","data-role":"system"},dc=["title"],fc={class:"tool-call-name"},mc={key:0,class:"tool-call-metric"},hc=ce({__name:"ToolCallRow",props:{message:{}},setup(e){const n=e,{t:o}=be(),i=_(()=>{const y=n.message.toolCall;return y?y.server?`${y.server} · ${y.tool}`:y.tool:n.message.text||"(tool)"}),m=_(()=>{var F;const y=(F=n.message.toolCall)==null?void 0:F.durationMs;return typeof y!="number"||y<0?"":y<1e3?`${y}ms`:`${(y/1e3).toFixed(1)}s`}),r=_(()=>{var y;switch((y=n.message.toolCall)==null?void 0:y.status){case"inProgress":return{text:"RUN",cls:"is-live"};case"failed":return{text:"FAIL",cls:"is-alert"};case"completed":return{text:"OK",cls:"is-ok"};default:return{text:"",cls:""}}}),h=_(()=>r.value.text),u=_(()=>r.value.cls),p=_(()=>{const y=n.message.toolCall;if(!y)return"";switch(y.status){case"inProgress":return o("Running");case"failed":return o("Failed");default:return o("Done")}}),v=_(()=>{var y;switch((y=n.message.toolCall)==null?void 0:y.status){case"inProgress":return"tool-call-running";case"failed":return"tool-call-error";default:return"tool-call-ok"}}),S=_(()=>{const y=n.message.toolCall;if(!y)return"";const F=[i.value,p.value];return y.error&&F.push(y.error),typeof y.durationMs=="number"&&y.durationMs>=0&&F.push(`${y.durationMs}ms`),F.join(" · ")});return(y,F)=>(a(),l("div",cc,[f("div",uc,[f("div",{class:oe(["tool-call-block",v.value]),title:S.value},[f("span",{class:oe(["tool-call-pip",u.value]),"aria-hidden":"true"},null,2),f("code",fc,w(i.value),1),m.value?(a(),l("span",mc,w(m.value),1)):I("",!0),h.value?(a(),l("span",{key:1,class:oe(["tool-call-status",u.value])},w(h.value),3)):I("",!0)],10,dc)])]))}}),dn=se(hc,[["__scopeId","data-v-f0b29923"]]),gc=["aria-expanded","title"],vc={class:"tool-batch-toggle","aria-hidden":"true"},pc={class:"tool-batch-label"},yc={class:"tool-batch-count"},wc={key:0,class:"tool-batch-body"},kc=ce({__name:"ToolBatchBlock",props:{kind:{},messages:{}},setup(e){const n=e,{t:o}=be(),i=q(!1),m=_(()=>lc(n.kind,n.messages,{t:o})),r=_(()=>n.messages.map(h=>{var u;return((u=h.toolCall)==null?void 0:u.tool)??""}).join(" · "));return(h,u)=>(a(),l("div",{class:oe(["tool-batch-block",{"tool-batch-block--open":i.value}])},[f("button",{type:"button",class:"tool-batch-head","aria-expanded":i.value,title:r.value,onClick:u[0]||(u[0]=p=>i.value=!i.value)},[f("span",vc,w(i.value?"▾":"▸"),1),u[1]||(u[1]=f("span",{class:"tool-batch-icon","aria-hidden":"true"},"🛠",-1)),f("span",pc,w(m.value),1),f("span",yc,w(e.messages.length),1)],8,gc),i.value?(a(),l("div",wc,[(a(!0),l(N,null,z(e.messages,p=>(a(),de(dn,{key:p.id,message:p},null,8,["message"]))),128))])):I("",!0)],2))}}),bc=se(kc,[["__scopeId","data-v-7b951bea"]]),Cc=["data-turn-key"],xc={key:0,class:"conversation-turn-request","aria-label":"User request"},$c={class:"conversation-turn-items"},_c={key:1,class:"conversation-turn-process","aria-label":"Turn process"},Tc=["aria-expanded","aria-label"],Ic={key:2,class:"conversation-turn-time"},Sc={class:"conversation-turn-process-count"},Mc={key:1,class:"conversation-turn-process-heading"},Lc={key:0,class:"conversation-turn-time"},Ac={key:2,class:"conversation-turn-items conversation-turn-process-items"},Fc={key:2,class:"conversation-turn-final","aria-label":"Assistant final response"},Pc={class:"conversation-turn-items"},Ec=ce({__name:"ThreadTurn",props:{turnKey:{},request:{},processItems:{default:()=>[]},finalItem:{},fileChangeAnchorIds:{default:()=>[]},durationMs:{},warm:{},warmItems:{default:()=>[]}},setup(e){const n=e,{t:o}=be(),i=q(!0),m=_(()=>n.processItems.length+n.fileChangeAnchorIds.length),r=_(()=>!!n.finalItem);return we(m,(h,u)=>{h>u&&(i.value=!0)}),(h,u)=>e.warm?(a(),l(N,{key:0},[Ge(h.$slots,"warm-card",{warm:e.warm},void 0),(a(!0),l(N,null,z(e.warmItems,p=>Ge(h.$slots,"default",{key:p.message.id,item:p,section:"warm"},void 0)),128))],64)):(a(),l("li",{key:1,class:"conversation-turn","data-turn-key":e.turnKey},[e.request?(a(),l("section",xc,[f("ol",$c,[Ge(h.$slots,"default",{item:e.request,section:"request"},void 0)])])):I("",!0),m.value>0?(a(),l("section",_c,[r.value?(a(),l("button",{key:0,class:"conversation-turn-process-heading conversation-turn-process-toggle",type:"button","aria-expanded":i.value,"aria-label":i.value?c(o)("Collapse turn process"):c(o)("Expand turn process"),onClick:u[0]||(u[0]=p=>i.value=!i.value)},[i.value?(a(),de($a,{key:0,class:"conversation-turn-process-toggle-icon"})):(a(),de(qo,{key:1,class:"conversation-turn-process-toggle-icon"})),f("span",null,w(c(o)("Turn process")),1),e.durationMs!=null&&e.durationMs>0?(a(),l("span",Ic,w(c(ln)(e.durationMs)),1)):I("",!0),f("span",Sc,w(c(o)("{n} process items",{n:m.value})),1)],8,Tc)):(a(),l("div",Mc,[Re(w(c(o)("Turn process"))+" ",1),e.durationMs!=null&&e.durationMs>0?(a(),l("span",Lc,w(c(ln)(e.durationMs)),1)):I("",!0)])),i.value?(a(),l("ol",Ac,[(a(!0),l(N,null,z(e.processItems,p=>Ge(h.$slots,"default",{key:p.message.id,item:p,section:"process"},void 0)),128)),(a(!0),l(N,null,z(e.fileChangeAnchorIds,p=>(a(),l("li",{key:`file-change-${p}`,class:"conversation-turn-row conversation-turn-file-change"},[Ge(h.$slots,"file-change",{anchorMessageId:p},void 0)]))),128))])):I("",!0)])):I("",!0),e.finalItem?(a(),l("section",Fc,[f("ol",Pc,[Ge(h.$slots,"default",{item:e.finalItem,section:"final"},void 0)])])):I("",!0)],8,Cc))}}),Bc=se(Ec,[["__scopeId","data-v-7e124617"]]),Dc=["aria-expanded"],Rc={class:"warm-turn__preview"},Hc={key:0,class:"warm-turn__meta"},Oc={class:"warm-turn__content"},Nc={key:1,class:"warm-turn__assistant"},qc=ce({__name:"WarmTurnCard",props:{userText:{},assistantPreview:{},toolCount:{},expanded:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const o=n,{t:i}=be();function m(){o("toggle")}return(r,h)=>(a(),l("div",{class:oe(["warm-turn",{"warm-turn--expanded":e.expanded}])},[f("button",{type:"button",class:"warm-turn__head","aria-expanded":e.expanded,onClick:m},[te(qo,{class:oe(["warm-turn__chevron",{"warm-turn__chevron--open":e.expanded}])},null,8,["class"]),f("span",Rc,w(e.userText),1),e.toolCount>0?(a(),l("span",Hc,w(c(i)("{n} tools",{n:e.toolCount})),1)):I("",!0)],8,Dc),f("div",Oc,[e.expanded?Ge(r.$slots,"default",{},void 0,!0,0):e.assistantPreview?(a(),l("div",Nc,w(e.assistantPreview),1)):I("",!0)])],2))}}),Vc=se(qc,[["__scopeId","data-v-cda74ec1"]]),Wc=["aria-expanded","aria-label","title"],jc={class:"work-block-command"},Uc={key:0,class:"work-block-metric"},Kc={class:"work-block-output-inner"},Gc=["textContent"],zc=["textContent"],Yc={key:0,class:"work-block-output-spill",role:"note"},Xc=["disabled"],Jc={key:1},Qc={key:0,class:"work-block-permission-hint",role:"note"},Zc=ce({__name:"WorkBlockItem",props:{command:{},stepIndex:{},expanded:{type:Boolean},compact:{type:Boolean},outputCondensed:{type:Boolean}},emits:["toggle"],setup(e){const n=e,{t:o}=be(),i=_(()=>{var b;return(b=n.command.commandExecution)==null?void 0:b.outputSpill}),m=_(()=>{var b;return((b=i.value)==null?void 0:b.ref)??""}),r=q("idle"),h=q(null),u=_(()=>{const b=i.value;return!!(b&&h.value&&h.value.ref===b.ref)}),p=_(()=>{const b=n.command.commandExecution,Y=b==null?void 0:b.outputSpill,V=h.value;return Y&&V&&V.ref===Y.ref?V.text:(b==null?void 0:b.aggregatedOutput)||"(no output)"});function v(b){return b<1024?`${b} B`:b<1024*1024?`${(b/1024).toFixed(1)} KB`:`${(b/(1024*1024)).toFixed(1)} MB`}const S=_(()=>{const b=i.value;return!b||b.omittedBytes<=0?"":o("Output trimmed: {omitted} omitted of {total}.",{omitted:v(b.omittedBytes),total:v(b.totalBytes)})});async function y(){const b=i.value;if(!(!(b!=null&&b.ref)||r.value==="loading")){r.value="loading";try{h.value={ref:b.ref,text:await _a(b.ref)},r.value="idle"}catch{r.value="error"}}}const F=_(()=>{var Y,V;const b=(Y=n.command.commandExecution)==null?void 0:Y.status;return b==="inProgress"?"cmd-status-running":b==="completed"&&((V=n.command.commandExecution)==null?void 0:V.exitCode)===0?"cmd-status-ok":"cmd-status-error"}),M=_(()=>{const b=n.command.commandExecution;if(!b)return"";switch(b.status){case"inProgress":return o("Running");case"completed":return b.exitCode===0?o("Done"):`${o("Exit")} ${b.exitCode??"?"}`;case"failed":return o("Failed");case"declined":return o("Declined");case"interrupted":return o("Stopped");default:return""}}),H=_(()=>{var b;return((b=n.command.commandExecution)==null?void 0:b.command)||"(command)"}),J=_(()=>{const b=n.command.commandExecution;return b?b.outputSpill&&b.outputSpill.totalBytes>0?b.outputSpill.totalBytes:b.aggregatedOutput?new TextEncoder().encode(b.aggregatedOutput).length:0:0}),U=_(()=>J.value>0?v(J.value):""),P=_(()=>{const b=n.command.commandExecution;if(!b)return{text:"",cls:""};switch(b.status){case"inProgress":return{text:"RUN",cls:"is-live"};case"completed":return b.exitCode===0?{text:"OK",cls:"is-ok"}:{text:`EXIT ${b.exitCode??"?"}`,cls:"is-alert"};case"failed":return{text:"FAIL",cls:"is-alert"};case"declined":return{text:"SKIP",cls:"is-alert"};case"interrupted":return{text:"STOP",cls:"is-alert"};default:return{text:"",cls:""}}}),C=_(()=>P.value.text),L=_(()=>P.value.cls),$=_(()=>[H.value,M.value,U.value].filter(Boolean).join(" · ")),E=[/access to the path .* is denied/iu,/access is denied/iu,/permission denied/iu,/not permitted/iu,/EACCES|EPERM/iu,/denied access|deny access/iu,/拒绝访问/iu,/没有权限/iu,/权限不足/iu,/要求提权|需要提权|require_escalated/iu],B=_(()=>{const b=n.command.commandExecution;if(!b||!(b.status==="failed"||b.status==="declined"||typeof b.exitCode=="number"&&b.exitCode!==0))return"";const V=b.aggregatedOutput??"";return!V||!E.some(ve=>ve.test(V))?"":o("Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.")});return(b,Y)=>{var V;return a(),l("div",{class:oe(["work-block",[F.value,{"work-block-expanded":e.expanded,"work-block-compact":e.compact}]])},[f("button",{type:"button",class:"work-block-header","aria-expanded":e.expanded,"aria-label":$.value,title:$.value,onClick:Y[0]||(Y[0]=ve=>b.$emit("toggle"))},[f("span",{class:oe(["work-block-pip",L.value]),"aria-hidden":"true"},null,2),f("code",jc,w(H.value),1),U.value?(a(),l("span",Uc,w(U.value),1)):I("",!0),C.value?(a(),l("span",{key:1,class:oe(["work-block-status",L.value])},w(C.value),3)):I("",!0)],8,Wc),f("div",{class:oe(["work-block-output-wrap",{"work-block-output-visible":e.expanded}])},[f("div",Kc,[f("pre",{class:"work-block-output-command",textContent:w(((V=e.command.commandExecution)==null?void 0:V.command)||"(command)")},null,8,Gc),f("pre",{class:oe(["work-block-output",{"cmd-output-condensed":e.outputCondensed}]),textContent:w(p.value)},null,10,zc),S.value?(a(),l("p",Yc,[f("span",null,w(S.value),1),m.value&&!u.value?(a(),l("button",{key:0,type:"button",class:"work-block-output-spill-action",disabled:r.value==="loading",onClick:y},w(r.value==="loading"?c(o)("Loading full output…"):c(o)("Show full output")),9,Xc)):r.value==="error"?(a(),l("span",Jc,w(c(o)("Could not load the full output.")),1)):I("",!0)])):I("",!0)])],2),B.value?(a(),l("p",Qc,w(B.value),1)):I("",!0)],2)}}}),Fo=se(Zc,[["__scopeId","data-v-daded7af"]]),eu=2;function Po(e){const n=e.messageType;return n==="commandExecution"||n==="toolCall"}function tu(e){var o,i;return(((o=e.commandExecution)==null?void 0:o.status)??"")==="inProgress"||(((i=e.toolCall)==null?void 0:i.status)??"")==="inProgress"?!0:(e.messageType??"").endsWith(".live")}function nu(e,n){return e.messages.every(o=>n(o))}function ou(e){const n=[];let o=[],i="";const m=()=>{o.length>0&&(n.push(o),o=[])};for(const u of e){const p=u.turnId??"",v=Po(u)&&p!=="";(!v||p!==i)&&(o.length>0&&m(),i=v?p:""),v&&o.push(u)}m();const r=new Map;for(const u of e)u.messageType==="worked"&&u.turnId&&typeof u.durationMs=="number"&&r.set(u.turnId,u.durationMs);const h=[];for(const u of n){if(u.length<eu)continue;const p=u[0].turnId??"";let v=0,S=0,y=0,F=!1;for(const H of u)H.messageType==="toolCall"?v+=1:H.messageType==="reasoning"?S+=1:H.messageType==="commandExecution"&&(y+=1),tu(H)&&(F=!0);const M=e.some(H=>H.turnId===p&&!Po(H));h.push({turnId:p,messages:u,running:F,toolCount:v,thoughtCount:S,commandCount:y,durationMs:r.get(p)??0,hasOutsideContent:M})}return h}function su(e,n){const{t:o,formatDuration:i}=n,m=[];return e.running?m.push(o("Working…")):e.durationMs>0?m.push(i(e.durationMs)):m.push(o("Processed")),e.toolCount>0&&m.push(o("{n} tools",{n:e.toolCount})),e.thoughtCount>0&&m.push(o("{n} thoughts",{n:e.thoughtCount})),e.commandCount>0&&m.push(o("{n} commands",{n:e.commandCount})),m.join(" · ")}function au(e){return e.text.length>0||Array.isArray(e.images)&&e.images.length>0||Array.isArray(e.fileAttachments)&&e.fileAttachments.length>0||Array.isArray(e.skills)&&e.skills.length>0||Array.isArray(e.imageAttachmentIds)&&e.imageAttachmentIds.length>0||Array.isArray(e.audioSources)&&e.audioSources.length>0||Array.isArray(e.mentions)&&e.mentions.length>0}function iu(e){return!au(e)}const ru=68.5,lu=42,cu=34,Eo=30,uu=280;function du(e,n){if(!e.collapsed)return uu;let o=e.hasAssistantPreview?ru:lu;return e.hasTimeDivider&&(o+=cu+n),o+=e.leadingModelSwitchCount*(Eo+n),o+=e.trailingModelSwitchCount*(Eo+n),o}function mn(e,n){const o=e.map(r=>du(r,n)),i=new Array(e.length);let m=0;for(let r=e.length-1;r>=0;r-=1)i[r]=m+o[r],m+=o[r]+n;return{heightsPx:o,topDistancesFromBottomPx:i,bottomDistancesFromBottomPx:i.map((r,h)=>r-o[h]),totalHeightPx:e.length===0?0:m-n}}function fu({gapPx:e,overscanPx:n,specs:o,viewportBottomDistancePx:i,viewportHeightPx:m}){var F;const r=o.length;if(r===0)return{first:0,last:-1};const h=mn(o,e),u=i+m,p=i-n,v=u+n;let S=-1,y=-1;for(let M=0;M<r;M+=1){const H=h.bottomDistancesFromBottomPx[M],J=h.topDistancesFromBottomPx[M];H<=v&&J>=p&&(S<0&&(S=M),y=M)}S<0&&(p>h.totalHeightPx?(S=0,y=0):(S=r-1,y=r-1));for(let M=0;M<r;M+=1)((F=o[M])==null?void 0:F.collapsed)===!1&&(M<S&&(S=M),M>y&&(y=M));return{first:S,last:y}}function mu({gapPx:e,specs:n,window:o}){const i=mn(n,e),m=n.length,{first:r,last:h}=o,u=Math.max(0,r),p=Math.max(0,m-1-h);let v=0;if(u>0){let y=0;for(let F=0;F<u;F+=1)y+=i.heightsPx[F];v=y+u*e}let S=0;if(p>0){let y=0;for(let F=h+1;F<m;F+=1)y+=i.heightsPx[F];S=Math.max(0,y+(p-1)*e)}return{topMarginPx:v,bottomSpacerPx:S,skippedAbove:u,skippedBelow:p}}function hu({gapPx:e,overscanPx:n,specs:o,viewportBottomDistancePx:i,viewportHeightPx:m}){const r=mn(o,e),h=fu({gapPx:e,overscanPx:n,specs:o,viewportBottomDistancePx:i,viewportHeightPx:m}),u=mu({gapPx:e,specs:o,window:h});return{window:h,spacers:u,layout:r}}const gu=280;function hn(e,n){const o=e.map(r=>r.measuredHeightPx??gu),i=new Array(e.length);let m=0;for(let r=e.length-1;r>=0;r-=1)i[r]=m+o[r],m+=o[r]+n;return{heightsPx:o,topDistancesFromBottomPx:i,bottomDistancesFromBottomPx:i.map((r,h)=>r-o[h]),totalHeightPx:e.length===0?0:m-n}}function vu({forcedKeys:e,gapPx:n,overscanPx:o,specs:i,viewportBottomDistancePx:m,viewportHeightPx:r}){const h=i.length;if(h===0)return{first:0,last:-1};const u=hn(i,n),p=m+r,v=m-o,S=p+o;let y=-1,F=-1;for(let M=0;M<h;M+=1){const H=u.bottomDistancesFromBottomPx[M],J=u.topDistancesFromBottomPx[M];H<=S&&J>=v&&(y<0&&(y=M),F=M)}y<0&&(v>u.totalHeightPx?(y=0,F=0):(y=h-1,F=h-1));for(let M=0;M<h;M+=1){const H=i[M];(H.measuredHeightPx===void 0||e!=null&&e.has(H.key))&&(M<y&&(y=M),M>F&&(F=M))}return{first:y,last:F}}function pu({gapPx:e,specs:n,window:o}){const i=hn(n,e),m=n.length,{first:r,last:h}=o,u=Math.max(0,r),p=Math.max(0,m-1-h);let v=0;if(u>0){let y=0;for(let F=0;F<u;F+=1)y+=i.heightsPx[F];v=Math.max(0,y+(u-1)*e)}let S=0;if(p>0){let y=0;for(let F=h+1;F<m;F+=1)y+=i.heightsPx[F];S=Math.max(0,y+(p-1)*e)}return{topSpacerPx:v,bottomSpacerPx:S,skippedAbove:u,skippedBelow:p}}function yu({forcedKeys:e,gapPx:n,overscanPx:o,specs:i,viewportBottomDistancePx:m,viewportHeightPx:r}){const h=hn(i,n),u=vu({forcedKeys:e,gapPx:n,overscanPx:o,specs:i,viewportBottomDistancePx:m,viewportHeightPx:r}),p=pu({gapPx:n,specs:i,window:u});return{window:u,spacers:p,layout:h}}function wu(e){const n={};for(const o of e)o.messageType==="worked"&&o.turnId&&typeof o.durationMs=="number"&&(n[o.turnId]=(n[o.turnId]??0)+o.durationMs);return n}const ku=300,bu=1200,Cu=300,xu=250;function $u(e){const{getCwd:n,isVideoMediaUrl:o}=e,i=q(null),m=q(0);let r=null;const h=new Map,u=new Map,p=new Map,v=new Map;function S(T,A,O,Q){for(T.has(A)&&T.delete(A),T.set(A,O);T.size>Q;){const fe=T.keys().next().value;if(fe===void 0)break;T.delete(fe)}return O}function y(){return i.value?Promise.resolve():(r||(r=Sa(()=>import("./common-DEPjExR-.js"),[]).then(T=>{i.value=T.default,v.clear(),p.clear(),m.value+=1}).finally(()=>{r=null})),r)}function F(){return!!i.value}function M(T){const A=u.get(T);return A?(u.delete(T),u.set(T,A),A):S(u,T,Ia(T),bu)}function H(T){const A=T.trim();if(!A)return"#";const O=G=>G.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(G),Q=Ta(A),fe=(Q==null?void 0:Q.path)??A,D=Ro(fe,n());if(O(D)){const G=D.startsWith("/")?D:`/${D}`;return`/codex-local-browse${encodeURI(G)}`}return"#"}function J(T){const A=T.trim();if(!A)return"";try{const O=new URL(A,window.location.href);return O.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${O.pathname.slice(19)}`}${O.search}${O.hash}`:""}catch{return""}}function U(T){const A=h.get(T.id);if(A&&A.text===T.text&&A.cwd===n())return h.delete(T.id),h.set(T.id,A),A.blocks;const O=wo(T.text);return S(h,T.id,{text:T.text,cwd:n(),blocks:O},ku).blocks}function P(T){return T.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}function C(T){var O;const A=((O=T.trim().split(/\s+/u)[0])==null?void 0:O.toLowerCase())??"";return A?Ko[A]??A:""}function L(T,A){const O=C(T);if(!O)return P(A);const Q=i.value;if(!Q)return P(A);try{if(Q.getLanguage(O))return Q.highlight(A,{language:O,ignoreIllegals:!0}).value}catch{}return P(A)}function $(T,A){return sn(E(T,A))}function E(T,A){const O=`${m.value}\0${C(T)}\0${T}\0${A}`,Q=v.get(O);return Q!==void 0?(v.delete(O),v.set(O,Q),Q):S(v,O,L(T,A),xu)}function B(T){return M(T).map(A=>A.kind==="text"?P(A.value):A.kind==="bold"?`<strong class="message-bold-text">${P(A.value)}</strong>`:A.kind==="italic"?`<em class="message-italic-text">${P(A.value)}</em>`:A.kind==="strikethrough"?`<s class="message-strikethrough-text">${P(A.value)}</s>`:A.kind==="file"?`<a class="message-file-link" href="${P(H(A.path))}" target="_blank" rel="noopener noreferrer" title="${P(A.path)}">${P(A.displayPath)}</a>`:A.kind==="url"?`<a class="message-file-link" href="${P(A.href)}" target="_blank" rel="noopener noreferrer" title="${P(A.href)}">${P(A.value)}</a>`:`<code class="message-inline-code">${P(A.value)}</code>`).join("")}function b(T){return T.paragraphs.map(A=>`<div class="message-list-item-text message-list-item-paragraph">${B(A)}</div>`).join("")}function Y(T){var Q;const A=b(T),O=((Q=T.children)==null?void 0:Q.map(fe=>ve(fe)).join(""))??"";return sn(A+O)}function V(T){return T?` style="text-align:${T}"`:""}function ve(T){if(T.kind==="paragraph")return`<p class="message-text">${B(T.value)}</p>`;if(T.kind==="heading"){const A=Math.min(6,Math.max(1,Math.trunc(T.level))),O=Vo(A),Q=`message-heading ${Wo(A)}`;return`<${O} class="${Q}">${B(T.value)}</${O}>`}if(T.kind==="blockquote")return`<blockquote class="message-blockquote">${B(T.value)}</blockquote>`;if(T.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${T.items.map(O=>`<li class="message-list-item"><div class="message-list-item-content">${Y(O)}</div></li>`).join("")}</ul>`;if(T.kind==="taskList")return`<ul class="message-list message-task-list">${T.items.map(O=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${O.checked?"true":"false"}">${O.checked?"☑":"☐"}</span><div class="message-list-item-text">${B(O.text)}</div></li>`).join("")}</ul>`;if(T.kind==="orderedList"){const A=T.items.map(O=>`<li class="message-list-item"><div class="message-list-item-content">${Y(O)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${T.start}">${A}</ol>`}if(T.kind==="table"){const A=T.headers.map((fe,D)=>`<th class="message-table-head-cell"${V(T.alignments[D]??null)}>${B(fe)}</th>`).join(""),O=T.rows.map(fe=>'<tr class="message-table-body-row">'+fe.map((D,G)=>`<td class="message-table-cell"${V(T.alignments[G]??null)}>${B(D)}</td>`).join("")+"</tr>").join(""),Q=O?`<tbody>${O}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${A}</tr></thead>${Q}</table></div>`}return T.kind==="codeBlock"?`<div class="message-code-block"><div class="message-code-bar">${T.language?`<span class="message-code-language">${P(T.language)}</span>`:""}<span class="message-code-copy" role="button" tabindex="0" data-code-copy>Copy</span></div><pre class="message-code-pre"><code class="hljs">${$(T.language,T.value)}</code></pre></div>`:T.kind==="thematicBreak"?'<hr class="message-divider">':o(T.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${P(T.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${P(T.url)}" alt="${P(T.alt||"Embedded message image")}" loading="lazy">`}function tt(T){const A=`${n()}\0${m.value}\0${T}`,O=p.get(A);if(O&&O.text===T&&O.cwd===n()&&O.highlightVersion===m.value)return p.delete(A),p.set(A,O),O.html;const Q=wo(T).map(D=>ve(D)).join(""),fe=sn(Q);return S(p,A,{text:T,cwd:n(),highlightVersion:m.value,html:fe},Cu).html}function ut(){h.clear(),u.clear(),p.clear(),v.clear()}return{highlightCacheVersion:m,hasHighlightLoaded:F,ensureHighlightJsLoaded:y,getInlineSegments:M,toBrowseUrl:H,toEditUrlFromBrowseHref:J,getMessageBlocks:U,renderListItemContentAsHtml:Y,renderCachedHighlightedCodeAsHtml:$,renderMarkdownBlocksAsHtml:tt,clearRenderCaches:ut}}const _u=["data-thread-id"],Tu={key:0,class:"conversation-switching-bar",role:"status"},Iu={key:1,class:"conversation-loading"},Su={key:2,class:"conversation-loading conversation-loading-slow",role:"status"},Mu={key:3,class:"conversation-empty"},Lu={key:0,class:"conversation-load-more"},Au=["disabled"],Fu={key:1,class:"conversation-load-more conversation-warm-collapse"},Pu=["disabled"],Eu={key:0,"aria-hidden":"true",class:"conversation-hot-anchor"},Bu=["data-hot-block"],Du=["data-hot-block"],Ru=["id"],Hu={class:"message-row","data-role":"system"},Ou={class:"message-stack","data-role":"system"},Nu={class:"message-row","data-role":"system","data-message-type":"fileChange"},qu={class:"message-stack","data-role":"system"},Vu={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},Wu={class:"message-row","data-role":"system"},ju={class:"message-stack","data-role":"system"},Uu={key:0,class:"work-block-list"},Ku=["id","data-role","data-message-type"],Gu={key:0,class:"message-row thread-compaction-row","data-role":"system"},zu={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},Yu={key:1,class:"message-row thread-compaction-row","data-role":"system"},Xu={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},Ju={key:2,class:"message-row","data-role":"system"},Qu={class:"message-stack","data-role":"system"},Zu={class:"work-block-list"},ed=["data-role","data-message-type"],td=["data-role"],nd=["data-role"],od={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},sd={class:"message-stack","data-role":"system"},ad={class:"thread-plan-record"},id={class:"thread-plan-record-header"},rd={key:0,class:"thread-plan-record-explanation"},ld={key:1,class:"thread-plan-record-steps"},cd=["data-status"],ud={class:"thread-plan-record-marker","aria-hidden":"true"},dd={key:6,class:"message-row thread-agent-note-row","data-role":"system","data-message-type":"agentNote"},fd={class:"message-stack","data-role":"system"},md={class:"thread-agent-note"},hd={class:"thread-agent-note-header"},gd=["innerHTML"],vd=["data-role","data-message-type"],pd=["data-role"],yd=["data-role"],wd=["data-role"],kd=["onClick"],bd=["src"],Cd=["src","alt"],xd={key:1,class:"message-file-attachments"},$d=["href","title"],_d={key:2,class:"message-file-attachments"},Td=["title"],Id={class:"message-file-chip-name"},Sd={key:3,class:"message-skill-attachments"},Md=["href","title"],Ld={class:"message-skill-chip-prefix"},Ad={class:"message-skill-chip-name"},Fd={key:4,class:"message-audio-attachments"},Pd=["src"],Ed={key:5,class:"message-file-attachments"},Bd=["title"],Dd={class:"message-file-chip-name"},Rd=["data-role"],Hd={key:0,class:"automation-message-label"},Od={key:0},Nd={key:1,class:"work-summary-wrap","aria-live":"polite"},qd={class:"work-summary-text"},Vd={key:0,class:"message-text"},Wd={key:2,class:"message-blockquote"},jd={key:3,class:"message-list message-list-unordered"},Ud=["innerHTML"],Kd={key:4,class:"message-list message-task-list"},Gd=["data-checked"],zd={class:"message-list-item-text"},Yd=["start"],Xd=["innerHTML"],Jd={key:6,class:"message-table-wrap"},Qd={class:"message-table"},Zd={key:0},ef={key:7,class:"message-code-block"},tf={class:"message-code-bar"},nf={key:0,class:"message-code-language"},of={class:"message-code-copy",role:"button",tabindex:"0","data-code-copy":""},sf={class:"message-code-pre"},af=["innerHTML"],rf={key:8,class:"message-divider"},lf={key:9,class:"message-text"},cf=["onClick"],uf=["src"],df=["src","alt","onError"],ff=["href","onClick"],mf={key:8,class:"message-inline-editor","data-message-inline-editor":""},hf=["onKeydown"],gf={class:"message-inline-editor-actions"},vf={class:"message-inline-editor-note"},pf=["data-hot-block"],yf=["title","aria-label"],wf=["aria-label"],kf=["src"],bf=["src","alt"],Cf=["tabindex"],Bo=30,Do=20,xf=200,$f=2e3,_f=4,Tf=800,If=800,Sf=ce({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},liveTurnId:{},isLoading:{type:Boolean},isSlowOpen:{type:Boolean},activeThreadId:{},cwd:{},hasMorePersistedAbove:{type:Boolean},isLoadingPersistedAbove:{type:Boolean},loadEarlierMessages:{type:Function}},emits:["forkThread","rollback","editMessage","respondServerRequest","fileChangesChanged"],setup(e,{expose:n,emit:o}){function i(t){return ci(t,r.cwd,K)}function m(t){return ct(t,r.cwd)}const r=e,h=$u({getCwd:()=>r.cwd,isVideoMediaUrl:Et}),{highlightCacheVersion:u,hasHighlightLoaded:p,ensureHighlightJsLoaded:v,getInlineSegments:S,toBrowseUrl:y,toEditUrlFromBrowseHref:F,getMessageBlocks:M,renderListItemContentAsHtml:H,renderCachedHighlightedCodeAsHtml:J,renderMarkdownBlocksAsHtml:U,clearRenderCaches:P}=h,C=ki({getMessages:()=>r.messages,getLiveOverlay:()=>r.liveOverlay,isCommandMessage:dt}),{hiddenGroupedCommandIds:L,isCommandExpanded:$,isCommandCompact:E,isCommandOutputCondensed:B,toggleCommandExpand:b,getWorkBlockCommands:Y,pruneCommandIdSets:V}=C,ve=Ci({toEditUrlFromBrowseHref:F}),{isFileLinkContextMenuVisible:tt,fileLinkContextMenuX:ut,fileLinkContextMenuY:T,fileLinkContextBrowseUrl:A,fileLinkContextEditUrl:O,handleConversationContextMenu:Q,closeFileLinkContextMenu:fe}=ve,{isMobile:D}=Ma(),G=yi({getMessages:()=>r.messages,getLiveTurnId:()=>r.liveTurnId??"",isFileChangeMessage:Wt,isCopyableAssistantMessage:xn,isReasoningMessage:Nt,isPlanMessage:Ot,isFoldMember:On,getHiddenGroupedCommandIds:()=>L.value,isMobile:()=>D.value}),{anchoredFileChangeSummaryByAnchorId:ye,hiddenFileChangeMessageIds:Ce,isDiffViewerFileListOpen:me,diffViewerChanges:he,activeDiffViewerChange:xe,activeDiffViewerLines:j,toggleFileChangeSummary:$e,isFileChangeSummaryExpanded:He,openDiffViewer:$t,closeDiffViewer:Oe,toggleDiffViewerFileList:Yo,closeDiffViewerFileList:Xo,selectDiffViewerChange:Jo,readAnchoredFileChangeSummaryById:_e,isFileChangeSummaryExpandedById:Qo,toggleFileChangeSummaryById:Zo,readStandaloneFileChangeSummary:Se,isFileChangeSummaryVisible:gn,pruneFileChangeSummaryIds:es}=G,ts=wi({getMessages:()=>r.messages,isCopyableAssistantMessage:xn,isPlanMessage:Ot,planStepCopyMarker:Kn,buildFileChangeCopyText:i,getAnchoredFileChangeSummaries:()=>ye.value}),{copiedResponseAnchorId:ns,forkableTurnIndexByAnchorId:os,showCopyResponseButton:ss,isCopyableUserMessage:as,copyUserMessage:is,showForkResponseButton:rs,copyResponse:ls}=ts,{buildFeedbackMailto:cs,feedbackMailtoBase:us,recordVisibleFailure:ds}=No(),{t:K}=be(),vn=us();function fs(t){if(!t)return"";const s=new Date(t);if(Number.isNaN(s.getTime()))return"";const d=new Date,k=s.getFullYear()===d.getFullYear()&&s.getMonth()===d.getMonth()&&s.getDate()===d.getDate(),R=s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});return k?R:`${s.toLocaleDateString([],{month:"2-digit",day:"2-digit"})} ${R}`}const Ht=new WeakMap;async function pn(t){var g;const s=t.target,d=s==null?void 0:s.closest("[data-code-copy]");if(!d)return;const k=(g=d.closest(".message-code-block"))==null?void 0:g.querySelector("code");if(!k)return;try{await Rt(k.textContent??"")}catch{return}d.textContent=K("Copied"),d.dataset.copied="true";const R=Ht.get(d);R!==void 0&&window.clearTimeout(R),Ht.set(d,window.setTimeout(()=>{d.textContent=K("Copy"),delete d.dataset.copied,Ht.delete(d)},1600))}function ms(t,s){ds(s);const d=t.currentTarget;d instanceof HTMLAnchorElement&&(d.href=cs())}function dt(t){return t.messageType==="commandExecution"&&!!t.commandExecution}function yn(t){return t.messageType==="compaction.pending"}function wn(t){return t.messageType==="compaction.done"}function Ot(t){return t.messageType==="plan"||t.messageType==="plan.live"}function kn(t){return t.messageType==="modelSwitch"}function Nt(t){return t.messageType==="reasoning"&&!!t.reasoning}const qt=q(new Set);function bn(t){return qt.value.has(t.id)}function Cn(t){const s=new Set(qt.value);s.has(t.id)?s.delete(t.id):s.add(t.id),qt.value=s}function Vt(t){return t.messageType==="toolCall"&&!!t.toolCall}function hs(t){return t.messageType==="turnError"}function Wt(t){return t.messageType==="fileChange"&&t.fileChangeStatus==="completed"&&Array.isArray(t.fileChanges)&&t.fileChanges.length>0}function gs(t){return dt(t)||Vt(t)||Wt(t)||yn(t)||wn(t)||t.messageType==="plan"?!1:iu(t)}function xn(t){return t.role==="assistant"&&!dt(t)&&t.messageType!=="worked"&&!(t.messageType??"").endsWith(".live")}const jt=o,ae=q(null),Ut=q(null),$n=q(null),Kt=q(-1),vs=xi({isVideo:Et}),{modalImageUrl:_t,modalIsVideo:ps,markdownImageFailureVersion:ys,isMarkdownImageFailed:ws,onMarkdownImageError:ks,openImageModal:_n,closeImageModal:Tt}=vs,bs=bi({getActiveThreadId:()=>r.activeThreadId,getCwd:()=>r.cwd,onFileChangesChanged:()=>jt("fileChangesChanged",r.activeThreadId),updateThreadFileChanges:Ka,t:K}),{fileChangeActionKey:Tn,isFileChangeActionable:In,fileChangeActionStatus:Sn,fileChangeActionErrorText:Mn,fileChangeNextAction:Ln,fileChangeActionLabel:An,runFileChangeAction:Cs,resetFileChangeActions:xs}=bs,Ne=q(null),$s=_(()=>{const t=Ne.value;return t?t.action==="undo"?K("Undo file changes?"):K("Redo file changes?"):""}),_s=_(()=>{const t=Ne.value;return t?t.filePathLabel?t.action==="undo"?K("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:t.filePathLabel}):K("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:t.filePathLabel}):t.action==="undo"?K("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):K("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),Fe=q(!0);let ze=0,Me=0,It=0,ft=null;const Fn=new WeakSet,qe=q(ko(r.activeThreadId)),St=_(()=>Ua(qe.value,r.activeThreadId)),Ve=q(!1);let Pn=0,Pe=0,ke=null,Le=0,mt=0;const nt=q(null);function Ts(t){const s=ae.value;if(!s||r.isLoading||r.activeThreadId!==t||St.value.sessionKey!==t||nt.value!=null)return null;const d=St.value,k={};for(const[R,g]of Ee.value)!R||!Number.isFinite(g)||g<=0||(k[R]=Math.round(g*100)/100);return{coldPage:d.coldPage,expandedWarmTurns:[...d.expandedWarmTurns],distanceFromBottomPx:Uo(Dt(s)),hotHeights:k}}function Mt(t=r.activeThreadId){const s=Ts(t);if(!s)return;const d=xo();d[t]={v:1,coldPage:s.coldPage,expandedWarmTurns:s.expandedWarmTurns,distanceFromBottomPx:s.distanceFromBottomPx,hotHeights:s.hotHeights,savedAt:Date.now()},Ba(d),Pn=Date.now()}function En(){if(Pe)return;const t=$f-(Date.now()-Pn);if(t<=0){ke&&(clearTimeout(ke),ke=null),Pe=requestAnimationFrame(()=>{Pe=0,Mt()});return}ke||(ke=setTimeout(()=>{ke=null,En()},t+10))}function Bn(){const t=ae.value,s=nt.value;if(Le=0,!t||s==null){mt=0;return}const d=Dt(t);d.scrollHeightPx>d.clientHeightPx&&(t.scrollTop=To(d,s)),mt-=1,mt>0?Le=requestAnimationFrame(Bn):nt.value=null}function Gt(){nt.value==null||Le||(mt=_f,Le=requestAnimationFrame(Bn))}function Lt(t){(t==null?void 0:t.type)==="visibilitychange"&&document.visibilityState!=="hidden"||(Pe&&(cancelAnimationFrame(Pe),Pe=0),ke&&(clearTimeout(ke),ke=null),Mt())}const zt=_(()=>r.messages.filter(t=>!Ot(t)&&!kn(t))),Ye=_(()=>Va(zt.value)),Yt=_(()=>Wa({turnCount:Ye.value.length,hotTurns:Bo,pageSize:Do,coldPage:St.value.coldPage})),Xt=_(()=>Yt.value.warmStartTurn),ot=_(()=>Yt.value.warmEndTurn),Dn=_(()=>Yt.value.coldTurnCount),Jt=_(()=>Dn.value>0),Qt=_(()=>St.value.expandedWarmTurns),Zt=_(()=>{const t=zt.value,s=Ye.value,d=[],k=Qt.value;function R(W){const ne=ie=>{var le,mo,ho,go;const Ae=((le=ie.request)==null?void 0:le.message.turnStartedAtIso)??((mo=ie.finalItem)==null?void 0:mo.message.turnStartedAtIso)??(typeof((ho=ie.warm)==null?void 0:ho.turn)=="number"?(go=s[ie.warm.turn])==null?void 0:go.userItem.turnStartedAtIso:void 0);if(!Ae)return null;const De=Date.parse(Ae);return Number.isFinite(De)?De:null},ue=Xa(W.map(ie=>({key:ie.key,timestampMs:ne(ie)})));if(ue.size===0)return W;for(const ie of W){if(!ue.has(ie.key))continue;const Ae=ne(ie);Ae!==null&&(ie.timeDividerLabel=Qa(Ae,{translate:K}))}return W}const g=new Map,Z=[];for(const W of r.messages){if(!kn(W))continue;const ne={from:W.modelSwitchFrom,to:W.modelSwitchTo};if(W.modelSwitchInsertAfterId){const ue=g.get(W.modelSwitchInsertAfterId)??[];ue.push(ne),g.set(W.modelSwitchInsertAfterId,ue)}else Z.push(ne)}function re(W){const ne=[];for(const ue of W){const ie=g.get(ue.message.id);ie&&ie.length>0&&(ne.push(...ie),g.delete(ue.message.id))}return ne}for(let W=Xt.value;W<ot.value;W+=1){const ne=s[W];if(!ne)continue;const ue={turn:W,userText:Da(ne.userItem.text),assistantPreview:ne.assistantPreview,toolCount:ne.toolCount,expanded:k.has(W)},ie=k.has(W)?t.slice(ne.startIdx,ne.endIdx).map(De=>({message:De})):[],Ae=re(t.slice(ne.startIdx,Math.min(ne.endIdx,t.length)).map(De=>({message:De})));d.push({key:`warm-${W}`,warm:ue,warmItems:ie,processItems:[],fileChangeAnchorIds:[],...Ae.length>0?{dividers:Ae}:{}})}const ge=$o(t,s,ot.value),Qe=ge[0];if(!Qe)return R(d);const x=t.findIndex(W=>W.id===Qe.id),X=x>=0?t.slice(x):ge;for(const W of Ra(X,{liveOverlayActive:r.liveOverlay!==null,liveTurnId:r.liveTurnId})){const ne=W.items.find(le=>le.kind==="user"),ue=W.items.find(le=>le.kind==="final-assistant"),ie=W.items.filter(le=>le!==ne&&le!==ue&&le.message.messageType!=="worked").map(le=>({message:le.message,presentation:le.kind==="plan"?"plan":le.kind==="agent-note"?"agent-note":"process"})),Ae=W.items.map(le=>le.message.id).filter(le=>!!_e(le)),De=re(W.items);d.push({key:W.key,warmItems:[],request:ne?{message:ne.message}:void 0,processItems:ie,fileChangeAnchorIds:Ae,finalItem:ue?{message:ue.message,presentation:"final-assistant"}:void 0,...De.length>0?{dividers:De}:{}})}const ee=[...Z,...g.values()].flat();return ee.length>0&&(d.length>0?d[0]={...d[0],leadingDividers:[...d[0].leadingDividers??[],...ee]}:d.push({key:"leading-divider",warmItems:[],processItems:[],fileChangeAnchorIds:[],leadingDividers:ee})),R(d)}),Is=_(()=>wu(r.messages));function Ss(t){var d,k;const s=((d=t.request)==null?void 0:d.message.turnId)??((k=t.finalItem)==null?void 0:k.message.turnId);return s?Is.value[s]:void 0}function Rn(){const t=ae.value,s=r.activeThreadId;t&&ao(t),qe.value=Ha(qe.value,r.activeThreadId),t&&ro(s)}function Ms(t){qe.value=_o(qe.value,r.activeThreadId,t,!Qt.value.has(t))}const Hn=_(()=>Ye.value.map((t,s)=>({turn:s,text:Oa(t.userItem.text)}))),Ls=_(()=>Math.max(0,Hn.value.length-1)),As=_(()=>{const t=new Map;return Ye.value.forEach((s,d)=>{t.set(s.userItem.id,d)}),t});function en(t){return`question-anchor-${t}`}function Fs(t){const s=As.value.get(t.id);if(s!==void 0&&!(s<ot.value))return en(s)}function Ps(t){if(t<ot.value){let s=qe.value;if(t<Xt.value){const d=Na({turn:t,turnCount:Ye.value.length,hotTurns:Bo,pageSize:Do});s=qa(s,r.activeThreadId,d)}s=_o(s,r.activeThreadId,t,!0),qe.value=s}else{const s=Ye.value[t];if(s){const d=new Set(pt.value);d.add(`turn-${s.userItem.id}`),pt.value=d}}Fe.value=!1,nn(),jn(),Te().then(()=>{const s=ae.value,d=document.getElementById(en(t));if(!s||!d)return;const k=d.getBoundingClientRect(),R=s.getBoundingClientRect(),g=s.scrollTop+k.top-R.top-12;s.scrollTo({top:Math.max(0,g),behavior:"smooth"})})}const Es=_(()=>{const t=zt.value,s=Ye.value,d=[];for(let Z=Xt.value;Z<ot.value;Z+=1){if(!Qt.value.has(Z))continue;const re=s[Z];re&&d.push(...t.slice(re.startIdx,re.endIdx))}const k=$o(t,s,ot.value),R=k[0];if(!R)return d;const g=t.findIndex(Z=>Z.id===R.id);return d.push(...g>=0?t.slice(g):k),d}),At=_(()=>ou(Es.value)),ht=_(()=>{var s;const t=new Map;for(const d of At.value){const k=((s=d.messages[0])==null?void 0:s.id)??"";k&&t.set(k,d)}return t}),Bs=_(()=>{const t=new Set;for(const s of At.value)for(const d of s.messages)t.add(d.id);return t}),Ds=_(()=>{var d;const t=new Set,s=k=>L.value.has(k.id)||Ce.value.has(k.id);for(const k of At.value)nu(k,s)&&t.add(((d=k.messages[0])==null?void 0:d.id)??"");return t}),Rs=_(()=>{const t=new Set;for(const s of At.value)t.add(s.turnId);return t});function Hs(t){return ht.value.has(t.id)}function On(t){return Bs.value.has(t.id)}function Os(t){var s;return((s=ht.value.get(t.id))==null?void 0:s.messages)??[]}function Ns(t){return rc(Os(t))}function qs(t){var s;return t.type==="batch"?`tool-batch-${t.kind}-${((s=t.messages[0])==null?void 0:s.id)??""}`:t.message.id}function Vs(t){const s=ht.value.get(t.id);return s?su(s,{t:K,formatDuration:ln}):""}function Ws(t){var s;return((s=ht.value.get(t.id))==null?void 0:s.running)??!1}function js(t){var s;return((s=ht.value.get(t.id))==null?void 0:s.hasOutsideContent)??!0}function Us(t){return t.messageType==="worked"}const Nn=_(()=>r.hasMorePersistedAbove===!0),We=q(null),gt=_(()=>Zt.value.filter(t=>t.warm!==void 0).map(t=>{var s,d,k;return{turn:t.warm!==void 0?t.warm.turn:-1,collapsed:t.warm!==void 0?!t.warm.expanded:!0,hasTimeDivider:t.timeDividerLabel!==void 0,leadingModelSwitchCount:((s=t.leadingDividers)==null?void 0:s.length)??0,trailingModelSwitchCount:((d=t.dividers)==null?void 0:d.length)??0,hasAssistantPreview:(((k=t.warm)==null?void 0:k.assistantPreview)??"").length>0}})),Ks=_(()=>{const t=We.value;if(!t)return null;const s=gt.value[t.window.first];return s?`warm-${s.turn}`:null}),Gs=_(()=>{const t=We.value;if(!t)return null;const s=gt.value[t.window.last];return s?`warm-${s.turn}`:null}),zs=_(()=>{var t;return((t=We.value)==null?void 0:t.spacers.topMarginPx)??0}),qn=_(()=>{var t;return((t=We.value)==null?void 0:t.spacers.bottomSpacerPx)??0}),Ys=_(()=>{const t=We.value;if(!t)return null;const s=gt.value,d=new Set;for(let k=t.window.first;k<=t.window.last;k+=1){const R=s[k];R&&d.add(R.turn)}return d});function Xs(t){const s=Ys.value;return s===null||s.has(t)}function tn(t,s){if(!s||t.key!==Ks.value)return;const d=zs.value;if(!(d<=0))return{marginTop:`${d}px`}}let st=0;function vt(){st||(st=requestAnimationFrame(()=>{st=0,nn(),jn()}))}function nn(){const t=ae.value,s=gt.value;if(!t||s.length===0){We.value=null;return}const d=t.querySelector(".conversation-hot-anchor")??t.querySelector("li.conversation-turn");if(!d){We.value=null;return}const k=t.getBoundingClientRect(),g=d.getBoundingClientRect().top-k.top+t.scrollTop-(t.scrollTop+t.clientHeight),Z=Number.parseFloat(window.getComputedStyle(t).rowGap),re=Number.isFinite(Z)&&Z>0?Z:12;We.value=hu({specs:s,gapPx:re,viewportBottomDistancePx:g,viewportHeightPx:t.clientHeight,overscanPx:Tf})}we([gt,Jt,Nn],()=>{Te(vt)});const je=q(null),Ee=q(new Map),pt=q(new Set),Xe=_(()=>Zt.value.filter(t=>t.warm===void 0).map(t=>({key:t.key,measuredHeightPx:Ee.value.get(t.key)}))),Js=_(()=>{var t;return((t=Xe.value[0])==null?void 0:t.key)??null}),Qs=_(()=>{const t=je.value;if(!t)return null;const s=Xe.value[t.window.first];return s?s.key:null}),Zs=_(()=>{const t=je.value;if(!t)return null;const s=Xe.value[t.window.last];return s?s.key:null}),Vn=_(()=>{var t;return((t=je.value)==null?void 0:t.spacers.topSpacerPx)??0}),Wn=_(()=>{var t;return((t=je.value)==null?void 0:t.spacers.bottomSpacerPx)??0}),ea=_(()=>{const t=je.value;if(!t)return null;const s=new Set(pt.value);for(let d=t.window.first;d<=t.window.last;d+=1){const k=Xe.value[d];k&&s.add(k.key)}return s});function ta(t){const s=ea.value;return s===null||s.has(t)}function jn(){const t=ae.value,s=Ut.value,d=Xe.value;if(!t||!s||d.length===0){je.value=null;return}const k=t.getBoundingClientRect(),R=s.getBoundingClientRect(),g=Number.parseFloat(window.getComputedStyle(t).rowGap),Z=Number.isFinite(g)&&g>0?g:12,re=R.top-k.top+t.scrollTop-Z;je.value=yu({specs:d,gapPx:Z,viewportBottomDistancePx:re-(t.scrollTop+t.clientHeight),viewportHeightPx:t.clientHeight,overscanPx:If,forcedKeys:pt.value})}function na(t){const s=ae.value;if(!s)return null;const d=CSS.escape(t),k=Array.from(s.querySelectorAll(`[data-hot-block="${d}"], [data-turn-key="${d}"]`));if(k.length===0)return null;for(const re of k){const ge=re.querySelectorAll("img");for(const Qe of ge)if(!Qe.complete)return null}let R=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;for(const re of k){const ge=re.getBoundingClientRect();ge.top<R&&(R=ge.top),ge.bottom>g&&(g=ge.bottom)}const Z=g-R;return Number.isFinite(Z)&&Z>0?Z:null}let at=0,it=null;function Un(t){it||(it=new Set);for(const s of t)it.add(s);at||(at=requestAnimationFrame(()=>{at=0;const s=it;if(it=null,!s||s.size===0)return;const d=ae.value;if(!d)return;const k=new Map(Ee.value);let R=!1;for(const g of s){const Z=CSS.escape(g);if(!d.querySelector(`[data-hot-block="${Z}"], [data-turn-key="${Z}"]`))continue;const ge=na(g);if(ge===null){k.delete(g)&&(R=!0);continue}k.get(g)!==ge&&(k.set(g,ge),R=!0)}R&&(Ee.value=k,Te(vt))}))}we(Xe,()=>{Te(vt)}),we(()=>r.activeThreadId,()=>{Ee.value=new Map,pt.value=new Set,je.value=null,Te(vt)});const oa=_(()=>!Fe.value&&(r.messages.length>0||r.pendingRequests.length>0||!!r.liveOverlay));function Kn(t){switch(t){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function sa(t){const s=os.value[t];typeof s=="number"&&r.activeThreadId&&jt("forkThread",{threadId:r.activeThreadId,turnIndex:s})}const Gn=_(()=>{const t={};for(const s of r.messages){if(!ja(s)||typeof s.turnIndex!="number")continue;const d=typeof s.turnId=="string"&&s.turnId.length>0?s.turnId:"";!d||s.text.trim().length===0||(t[s.id]=d)}return t});function aa(t){return typeof Gn.value[t.id]=="string"}const Ue=q(null),zn=q(null);function ia(t){zn.value=t instanceof HTMLTextAreaElement?t:null}function ra(t){var s;return((s=Ue.value)==null?void 0:s.messageId)===t}we(Ue,async t=>{if(!t)return;await Te();const s=zn.value;s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))});function la(t){const s=Gn.value[t];if(!s)return;const d=r.messages.find(k=>k.id===t);!d||d.text.trim().length===0||(Ue.value={messageId:t,turnId:s,text:d.text})}function Yn(){Ue.value=null}function ca(){var d;const t=Ue.value;if(Ue.value=null,!t)return;const s=t.text.trim();!s||s===((d=r.messages.find(k=>k.id===t.messageId))==null?void 0:d.text.trim())||jt("editMessage",{turnId:t.turnId,text:s})}function Xn(t,s){Tn(t)&&(Ne.value={kind:"file-change",summary:t,action:s})}function Jn(t,s){!t||!Tn(t)||!s.path||(Ne.value={kind:"file-change",summary:t,action:"undo",filePaths:[s.path],filePathLabel:m(s.path)})}function ua(){const t=Ne.value;Ne.value=null,t&&Cs(t.summary,t.action,t.filePaths)}function da(t){if(!t)return null;const s=t.querySelectorAll(".conversation-item-final");if(s.length>0)return s[s.length-1];const d=t.querySelectorAll(".conversation-turn-final");if(d.length>0)return d[d.length-1];const k=t.querySelectorAll("li.conversation-turn");return k.length>0?k[k.length-1]:null}function fa(){const t=da(ae.value);if(!t)return;const s=t.getAttribute("tabindex");t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}),t.addEventListener("focusout",()=>{s===null?t.removeAttribute("tabindex"):t.setAttribute("tabindex",s)},{once:!0})}function Qn(t){t.key==="Tab"&&!t.shiftKey&&!t.defaultPrevented&&(Kt.value=-1)}function Zn(){const t=$n.value,s=typeof document<"u"?document.activeElement:null;!t||!s||s===t||t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING&&(Kt.value=0)}function ma(t,s){t.scrollTop=To(Dt(t),s)}function ha(){const t=ae.value,s=Ut.value;!t||!s||eo(t)||ma(t,0)}function eo(t){return Za(Dt(t))}function ga(){if(ae.value&&Fe.value){Ft();return}}function Ft(){ae.value&&ha()}function Pt(){return Fe.value}function to(){if(!Pt()){It=0,Me=0;return}if(Ft(),It-=1,It<=0){Me=0;return}Me=requestAnimationFrame(to)}function yt(t=6){Pt()&&(Me&&(cancelAnimationFrame(Me),Me=0),It=Math.max(t,1),Me=requestAnimationFrame(to))}function no(){yt(3)}function oo(){Fe.value=!0,Ft(),yt(4)}let Ke=null;function so(t){return t.querySelector(".conversation-hot-anchor")??t.querySelector("li.conversation-item")}function ao(t){if(Ke)return;const s=so(t);s&&(Ke={anchor:s,lastTop:s.getBoundingClientRect().top})}function io(){const t=Ke,s=ae.value;if(!t||!s){Ke=null;return}if(!t.anchor.isConnected){const R=so(s);if(!R){Ke=null;return}Ke={anchor:R,lastTop:R.getBoundingClientRect().top};return}const d=t.anchor.getBoundingClientRect().top,k=d-t.lastTop;k!==0&&(s.scrollTop+=k,t.lastTop=d-k)}function wt(){Ke=null}function ro(t){const s=()=>r.activeThreadId!==t||!Ke;Te().then(()=>{if(s()){wt();return}io()}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Te().then(()=>{if(s()){wt();return}io(),wt()})})})}async function lo(){var d;const t=ae.value;if(!t||!r.hasMorePersistedAbove||Ve.value||r.isLoadingPersistedAbove===!0)return;Ve.value=!0;const s=r.activeThreadId;ao(t);try{await((d=r.loadEarlierMessages)==null?void 0:d.call(r,s)),r.activeThreadId===s?(await Te(),ro(s)):wt()}finally{Ve.value=!1}}n({jumpToLatest:oo});function va(){if(!Pt())return;const t=ae.value;if(!t)return;const s=t.querySelectorAll("img.message-image-preview");for(const d of s)d.complete||Fn.has(d)||(Fn.add(d),d.addEventListener("load",no,{once:!0}),d.addEventListener("error",no,{once:!0}))}let Be=null,Je=null;function co(){const t=ae.value;if(!(!t||!Be))for(const s of Array.from(t.children))Be.observe(s)}function uo(){Pt()&&yt(2)}function pa(t){const s=[];for(const d of t){const k=d.target;if(!k.isConnected)continue;if(k===ae.value){Ee.value.size>0&&(Ee.value=new Map,Un(Xe.value.map(g=>g.key)));continue}const R=k.dataset.hotBlock??k.dataset.turnKey;R&&s.push(R)}s.length>0&&Un(s),uo()}function ya(){if(Be||Je||typeof ResizeObserver>"u"||typeof MutationObserver>"u")return;const t=ae.value;t&&(Be=new ResizeObserver(pa),Be.observe(t),co(),Je=new MutationObserver(()=>{co(),uo()}),Je.observe(t,{childList:!0}))}function wa(){Be==null||Be.disconnect(),Be=null,Je==null||Je.disconnect(),Je=null}async function kt(){return ft||(ft=Te().then(()=>new Promise(t=>{ze&&cancelAnimationFrame(ze),ze=requestAnimationFrame(()=>{ze=0,ft=null,ga(),nn(),va(),yt(),t()})})),ft)}we(()=>r.messages,async t=>{if(r.isLoading)return;const s=new Set(t.filter(d=>d.messageType==="commandExecution"&&d.commandExecution).map(d=>d.id));V(s),es(),await kt(),Gt()}),we(()=>r.messages.some(t=>t.text.includes("```")),t=>{!t||p()||v()},{immediate:!0}),we(()=>r.pendingRequests,async()=>{r.isLoading||await kt()},{deep:!0}),we(()=>r.liveOverlay,async t=>{t&&Fe.value&&(await Te(),Ft(),yt(8))},{deep:!0}),we(()=>r.isLoading,async()=>{await kt()}),we(()=>r.activeThreadId,(t,s)=>{s&&s!==r.activeThreadId&&Mt(s)},{flush:"sync"});function fo(){Fe.value=!0,Le&&(cancelAnimationFrame(Le),Le=0),mt=0,nt.value=null;let t=null;const s=xo()[r.activeThreadId];s&&(t={sessionKey:r.activeThreadId,expandedWarmTurns:new Set(s.expandedWarmTurns),coldPage:s.coldPage},Ee.value.size===0&&Object.keys(s.hotHeights).length>0&&(Ee.value=new Map(Object.entries(s.hotHeights))),s.distanceFromBottomPx>cn&&(nt.value=s.distanceFromBottomPx,Fe.value=!1)),qe.value=t??ko(r.activeThreadId)}we(()=>r.activeThreadId,async()=>{_t.value="",Ve.value=!1,xs(),fo(),await kt(),Gt()},{flush:"post"}),bo(()=>{ya(),fo(),kt(),Gt(),window.addEventListener("pagehide",Lt),window.addEventListener("visibilitychange",Lt)}),bo(()=>{document.addEventListener("keydown",Qn),document.addEventListener("focusin",Zn)}),xt(()=>{document.removeEventListener("keydown",Qn),document.removeEventListener("focusin",Zn)});function ka(){const t=ae.value;!t||r.isLoading||(Fe.value=eo(t),vt(),En(),t.scrollTop<xf&&!Ve.value&&(Jt.value?Rn():r.hasMorePersistedAbove===!0&&lo()))}const on=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Et(t){const s=t.trim();if(!s)return!1;if(s.startsWith("data:video/"))return!0;try{const d=new URL(s,window.location.href);return on.test(d.pathname)?!0:d.pathname==="/codex-local-image"?on.test(d.searchParams.get("path")??""):!1}catch{return on.test(s)}}return xt(()=>{P(),at&&(cancelAnimationFrame(at),at=0),it=null,ze&&(cancelAnimationFrame(ze),ze=0),st&&(cancelAnimationFrame(st),st=0),Me&&(cancelAnimationFrame(Me),Me=0),wt(),wa(),window.removeEventListener("pagehide",Lt),window.removeEventListener("visibilitychange",Lt),Pe&&(cancelAnimationFrame(Pe),Pe=0),ke&&(clearTimeout(ke),ke=null),Le&&(cancelAnimationFrame(Le),Le=0),Mt()}),(t,s)=>(a(),l(N,null,[f("section",{class:"conversation-root","data-thread-id":r.activeThreadId,onContextmenuCapture:s[5]||(s[5]=(...d)=>c(Q)&&c(Q)(...d)),onClick:pn,onKeydown:Co(pn,["enter"])},[e.isLoading&&e.messages.length>0?(a(),l("div",Tu,w(c(K)("Loading messages...")),1)):I("",!0),e.isLoading&&e.messages.length===0?(a(),l("p",Iu,w(c(K)("Loading messages...")),1)):I("",!0),e.isSlowOpen?(a(),l("p",Su,w(c(K)("Still loading — the first open of a large history can take a while.")),1)):I("",!0),e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay&&!e.isSlowOpen?(a(),l("p",Mu,w(c(K)("No messages in this thread yet. Type a message below to get started.")),1)):I("",!0),f("ul",{ref_key:"conversationListRef",ref:ae,class:"conversation-list",onScroll:ka},[Nn.value?(a(),l("li",Lu,[f("button",{type:"button",class:"load-more-button",disabled:Ve.value||e.isLoadingPersistedAbove,onClick:lo},w(Ve.value||e.isLoadingPersistedAbove?c(K)("Loading…"):c(K)("Load earlier messages")),9,Au)])):I("",!0),Jt.value?(a(),l("li",Fu,[f("button",{type:"button",class:"load-more-button",disabled:Ve.value,onClick:Rn},w(c(K)("Load earlier ({n} turns)",{n:Dn.value})),9,Pu)])):I("",!0),(a(!0),l(N,null,z(Zt.value,d=>(a(),l(N,{key:d.key},[d.warm===void 0&&d.key===Js.value?(a(),l("li",Eu)):I("",!0),d.warm===void 0&&d.key===Qs.value&&Vn.value>0?(a(),l("li",{key:1,"aria-hidden":"true",class:"conversation-hot-spacer-top",style:Ie({height:`${Vn.value}px`})},null,4)):I("",!0),(d.warm?Xs(d.warm.turn):ta(d.key))?(a(),l(N,{key:2},[d.timeDividerLabel?(a(),l("li",{key:0,class:"conversation-item conversation-item-time-divider","data-role":"system","data-message-type":"timeDivider","data-hot-block":d.key,style:Ie(tn(d,!0))},[te(rl,{label:d.timeDividerLabel},null,8,["label"])],12,Bu)):I("",!0),(a(!0),l(N,null,z(d.leadingDividers??[],(k,R)=>(a(),l("li",{key:`${d.key}-leading-${k.to??""}-${k.from??""}`,class:"conversation-item conversation-item-model-switch","data-role":"system","data-message-type":"modelSwitch","data-hot-block":d.key,style:Ie(tn(d,!d.timeDividerLabel&&R===0))},[te(Mo,{from:k.from,to:k.to},null,8,["from","to"])],12,Du))),128)),te(Bc,{"turn-key":d.key,warm:d.warm,"warm-items":d.warmItems,request:d.request,"process-items":d.processItems,"final-item":d.finalItem,"file-change-anchor-ids":d.fileChangeAnchorIds,"duration-ms":Ss(d)},{"warm-card":lt(({warm:k})=>{var R;return[f("li",{id:en(k.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn",style:Ie(tn(d,!d.timeDividerLabel&&!((R=d.leadingDividers)!=null&&R.length)))},[f("div",Hu,[f("div",Ou,[te(Vc,{"user-text":k.userText,"assistant-preview":k.assistantPreview,"tool-count":k.toolCount,expanded:k.expanded,onToggle:g=>Ms(k.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],12,Ru)]}),"file-change":lt(({anchorMessageId:k})=>[f("div",Nu,[f("div",qu,[c(gn)(c(_e)(k))?(a(),de(So,{key:0,summary:c(_e)(k),expanded:c(Qo)(k),cwd:r.cwd,actionable:c(In)(c(_e)(k)),"action-status":c(Sn)(c(_e)(k)),"action-error-text":c(Mn)(c(_e)(k)),"next-action":c(Ln)(c(_e)(k)),"action-label":c(An)(c(_e)(k)),onToggle:R=>c(Zo)(k),onOpenDiff:R=>c($t)(c(_e)(k),R),onRequestAction:R=>Xn(c(_e)(k),R),onRequestFileAction:R=>Jn(c(_e)(k),R)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):I("",!0)])])]),default:lt(({item:k,section:R})=>[(a(!0),l(N,null,z([k.message],g=>{var Z,re,ge,Qe;return a(),l(N,{key:g.id},[Hs(g)&&!Ds.value.has(g.id)?(a(),l("li",Vu,[f("div",Wu,[f("div",ju,[te(ql,{label:Vs(g),running:Ws(g),"has-outside-content":js(g)},{default:lt(()=>[(a(!0),l(N,null,z(Ns(g),x=>(a(),l(N,{key:qs(x)},[x.type==="batch"?(a(),de(bc,{key:0,kind:x.kind,messages:x.messages},null,8,["kind","messages"])):(a(!0),l(N,{key:1},z([x.message],X=>(a(),l(N,{key:X.id},[!c(L).has(X.id)&&!c(Ce).has(X.id)?(a(),l(N,{key:0},[dt(X)?(a(),l("div",Uu,[(a(!0),l(N,null,z(c(Y)(X),(ee,W)=>(a(),de(Fo,{key:`work-cmd-${ee.id}`,command:ee,"step-index":W,expanded:c($)(ee),compact:c(E)(ee),"output-condensed":c(B)(ee),onToggle:ne=>c(b)(ee)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):Vt(X)?(a(),de(dn,{key:1,message:X},null,8,["message"])):Nt(X)?(a(),de(Ao,{key:2,message:X,expanded:bn(X),"content-html":c(U)(X.text),onToggle:ee=>Cn(X)},null,8,["message","expanded","content-html","onToggle"])):I("",!0)],64)):I("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!On(g)&&!c(L).has(g.id)&&!c(Ce).has(g.id)&&!(Us(g)&&Rs.value.has(g.turnId??""))&&!gs(g)?(a(),l("li",{key:1,id:Fs(g),class:oe(["conversation-item",{"conversation-item-request":R==="request","conversation-item-process":R==="process"||k.presentation==="process","conversation-item-final":R==="final"||k.presentation==="final-assistant","conversation-item-plan":k.presentation==="plan"}]),"data-role":g.role,"data-message-type":g.messageType||""},[yn(g)?(a(),l("div",Gu,[f("div",zu,[s[7]||(s[7]=f("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),f("span",null,w(c(K)("Compacting thread context…")),1)])])):wn(g)?(a(),l("div",Yu,[f("div",Xu,w(c(K)("Context compacted")),1)])):dt(g)?(a(),l("div",Ju,[f("div",Qu,[f("div",Zu,[(a(!0),l(N,null,z(c(Y)(g),(x,X)=>(a(),de(Fo,{key:`work-cmd-${x.id}`,command:x,"step-index":X,expanded:c($)(x),compact:c(E)(x),"output-condensed":c(B)(x),onToggle:ee=>c(b)(x)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):Vt(g)?(a(),de(dn,{key:3,message:g},null,8,["message"])):Wt(g)?(a(),l("div",{key:4,class:"message-row","data-role":g.role,"data-message-type":g.messageType||""},[f("div",{class:"message-stack","data-role":g.role},[f("article",{class:"message-body","data-role":g.role},[c(gn)(c(Se)(g))?(a(),de(So,{key:0,summary:c(Se)(g),expanded:c(He)(g),cwd:r.cwd,actionable:c(In)(c(Se)(g)),"action-status":c(Sn)(c(Se)(g)),"action-error-text":c(Mn)(c(Se)(g)),"next-action":c(Ln)(c(Se)(g)),"action-label":c(An)(c(Se)(g)),onToggle:x=>c($e)(g),onOpenDiff:x=>c($t)(c(Se)(g),x),onRequestAction:x=>Xn(c(Se)(g),x),onRequestFileAction:x=>Jn(c(Se)(g),x)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):I("",!0)],8,nd)],8,td)],8,ed)):k.presentation==="plan"?(a(),l("div",od,[f("div",sd,[f("article",ad,[f("div",id,w(c(K)("Plan")),1),(Z=c(bt)(g))!=null&&Z.explanation?(a(),l("p",rd,w((re=c(bt)(g))==null?void 0:re.explanation),1)):I("",!0),(ge=c(bt)(g))!=null&&ge.steps.length?(a(),l("ol",ld,[(a(!0),l(N,null,z((Qe=c(bt)(g))==null?void 0:Qe.steps,(x,X)=>(a(),l("li",{key:`${g.id}-plan-${X}`,"data-status":x.status},[f("span",ud,w(Kn(x.status)),1),f("span",null,w(x.step),1)],8,cd))),128))])):I("",!0)])])])):k.presentation==="agent-note"?(a(),l("div",dd,[f("div",fd,[f("article",md,[f("div",hd,w(c(K)("Agent note")),1),f("div",{class:"thread-agent-note-body",innerHTML:c(U)(g.text)},null,8,gd)])])])):(a(),l("div",{key:7,class:oe(["message-row",{"message-row-final":k.presentation==="final-assistant"}]),"data-role":g.role,"data-message-type":g.messageType||""},[f("div",{class:"message-stack","data-role":g.role},[f("article",{class:"message-body","data-role":g.role},[g.images&&g.images.length>0?(a(),l("ul",{key:0,class:oe(["message-image-list",{"message-generated-image-list":g.messageType==="imageView"}]),"data-role":g.role},[(a(!0),l(N,null,z(g.images,x=>(a(),l("li",{key:x,class:"message-image-item"},[f("button",{class:"message-image-button",type:"button",onClick:X=>c(_n)(x)},[Et(x)?(a(),l("video",{key:0,class:oe(["message-image-preview message-video-preview",{"message-generated-image-preview":g.messageType==="imageView"}]),src:x,controls:"",preload:"metadata"},null,10,bd)):(a(),l("img",{key:1,class:oe(["message-image-preview",{"message-generated-image-preview":g.messageType==="imageView"}]),src:x,alt:g.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,Cd))],8,kd)]))),128))],10,wd)):I("",!0),g.fileAttachments&&g.fileAttachments.length>0?(a(),l("div",xd,[(a(!0),l(N,null,z(g.fileAttachments,x=>(a(),l("span",{key:`${g.id}:${x.path}`,class:"message-file-chip"},[s[8]||(s[8]=f("span",{class:"message-file-chip-icon"},"📄",-1)),f("a",{class:"message-file-link message-file-chip-name",href:c(y)(x.path),target:"_blank",rel:"noopener noreferrer",title:x.path},w(x.label),9,$d)]))),128))])):I("",!0),g.imageAttachmentIds&&g.imageAttachmentIds.length>0?(a(),l("div",_d,[(a(!0),l(N,null,z(g.imageAttachmentIds,x=>(a(),l("span",{key:`${g.id}:${x}`,class:"message-file-chip message-image-attachment-chip",title:x},[s[9]||(s[9]=f("span",{class:"message-file-chip-icon"},"🖼",-1)),f("span",Id,w(c(K)("Image attachment (preview unavailable)")),1)],8,Td))),128))])):I("",!0),g.skills&&g.skills.length>0?(a(),l("div",Sd,[(a(!0),l(N,null,z(g.skills,x=>(a(),l("a",{key:`${g.id}:${x.path}`,class:"message-skill-chip",href:c(y)(x.path),title:x.path},[f("span",Ld,w(c(K)("Skill")),1),f("span",Ad,w(x.name),1)],8,Md))),128))])):I("",!0),g.audioSources&&g.audioSources.length>0?(a(),l("div",Fd,[(a(!0),l(N,null,z(g.audioSources,(x,X)=>(a(),l("audio",{key:`${g.id}:audio:${X}`,class:"message-audio-player",controls:"",preload:"metadata",src:x},null,8,Pd))),128))])):I("",!0),g.mentions&&g.mentions.length>0?(a(),l("div",Ed,[(a(!0),l(N,null,z(g.mentions,x=>(a(),l("span",{key:`${g.id}:mention:${x.name}:${x.path}`,class:"message-file-chip message-mention-chip",title:x.path||x.name},[s[10]||(s[10]=f("span",{class:"message-file-chip-icon"},"@",-1)),f("span",Dd,w(x.name),1)],8,Bd))),128))])):I("",!0),g.text.length>0?(a(),l("article",{key:6,class:"message-card","data-role":g.role},[g.isAutomationRun?(a(),l("div",Hd,[s[11]||(s[11]=f("span",null,"Sent via automation",-1)),g.automationDisplayName?(a(),l("code",Od,w(g.automationDisplayName),1)):I("",!0)])):I("",!0),g.messageType==="worked"?(a(),l("div",Nd,[f("p",qd,w(g.text),1)])):Nt(g)?(a(),de(Ao,{key:2,message:g,expanded:bn(g),"content-html":c(U)(g.text),onToggle:x=>Cn(g)},null,8,["message","expanded","content-html","onToggle"])):La([g.id,g.text,r.cwd,c(u),c(ys)],()=>(a(),l("div",{key:3,class:"message-text-flow"},[(a(!0),l(N,null,z(c(M)(g),(x,X)=>(a(),l(N,{key:`block-${X}`},[x.kind==="paragraph"?(a(),l("p",Vd,[te(rt,{segments:c(S)(x.value),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])])):x.kind==="heading"?(a(),de(Aa(c(Vo)(x.level)),{key:1,class:oe(["message-heading",c(Wo)(x.level)])},{default:lt(()=>[te(rt,{segments:c(S)(x.value),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])]),_:2},1032,["class"])):x.kind==="blockquote"?(a(),l("blockquote",Wd,[te(rt,{segments:c(S)(x.value),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])])):x.kind==="unorderedList"?(a(),l("ul",jd,[(a(!0),l(N,null,z(x.items,(ee,W)=>(a(),l("li",{key:`ul-${X}-${W}`,class:"message-list-item"},[f("div",{class:"message-list-item-content",innerHTML:c(H)(ee)},null,8,Ud)]))),128))])):x.kind==="taskList"?(a(),l("ul",Kd,[(a(!0),l(N,null,z(x.items,(ee,W)=>(a(),l("li",{key:`task-${X}-${W}`,class:"message-task-item"},[f("span",{class:"message-task-checkbox","data-checked":ee.checked},w(ee.checked?"☑":"☐"),9,Gd),f("div",zd,[te(rt,{segments:c(S)(ee.text),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])])]))),128))])):x.kind==="orderedList"?(a(),l("ol",{key:5,class:"message-list message-list-ordered",start:x.start},[(a(!0),l(N,null,z(x.items,(ee,W)=>(a(),l("li",{key:`ol-${X}-${W}`,class:"message-list-item"},[f("div",{class:"message-list-item-content",innerHTML:c(H)(ee)},null,8,Xd)]))),128))],8,Yd)):x.kind==="table"?(a(),l("div",Jd,[f("table",Qd,[f("thead",null,[f("tr",null,[(a(!0),l(N,null,z(x.headers,(ee,W)=>(a(),l("th",{key:`th-${X}-${W}`,class:"message-table-head-cell",style:Ie({textAlign:x.alignments[W]??"left"})},[te(rt,{segments:c(S)(ee),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])],4))),128))])]),x.rows.length>0?(a(),l("tbody",Zd,[(a(!0),l(N,null,z(x.rows,(ee,W)=>(a(),l("tr",{key:`tr-${X}-${W}`,class:"message-table-body-row"},[(a(!0),l(N,null,z(ee,(ne,ue)=>(a(),l("td",{key:`td-${X}-${W}-${ue}`,class:"message-table-cell",style:Ie({textAlign:x.alignments[ue]??"left"})},[te(rt,{segments:c(S)(ne),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])],4))),128))]))),128))])):I("",!0)])])):x.kind==="codeBlock"?(a(),l("div",ef,[f("div",tf,[x.language?(a(),l("span",nf,w(x.language),1)):I("",!0),f("span",of,w(c(K)("Copy")),1)]),f("pre",sf,[f("code",{class:"hljs",innerHTML:c(J)(x.language,x.value)},null,8,af)])])):x.kind==="thematicBreak"?(a(),l("hr",rf)):c(ws)(g.id,X)?(a(),l("p",lf,w(x.markdown),1)):(a(),l("button",{key:10,class:"message-image-button",type:"button",onClick:ee=>c(_n)(x.url)},[Et(x.url)?(a(),l("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:x.url,controls:"",preload:"metadata"},null,8,uf)):(a(),l("img",{key:1,class:"message-image-preview message-markdown-image",src:x.url,alt:x.alt||"Embedded message image",loading:"lazy",onError:ee=>c(ks)(g.id,X)},null,40,df))],8,cf))],64))),128))])),s,0),hs(g)?(a(),l("a",{key:4,class:"turn-error-feedback",href:c(vn),onClick:x=>ms(x,g.text)},w(c(K)("Send feedback")),9,ff)):I("",!0)],8,Rd)):I("",!0),R!=="process"?(a(),de(Pl,{key:7,role:g.role,"show-edit":aa(g),"show-fork":c(rs)(g),"show-copy":c(ss)(g)||c(as)(g),copied:c(ns)===g.id,timestamp:fs(g.turnStartedAtIso),onEdit:x=>la(g.id),onFork:x=>sa(g.id),onCopy:x=>g.role==="user"?c(is)(g.id):c(ls)(g.id)},null,8,["role","show-edit","show-fork","show-copy","copied","timestamp","onEdit","onFork","onCopy"])):I("",!0),ra(g.id)?(a(),l("div",mf,[Fa(f("textarea",{ref_for:!0,ref:ia,"onUpdate:modelValue":s[1]||(s[1]=x=>Ue.value.text=x),class:"message-inline-editor-textarea",rows:"3",onKeydown:Co(et(Yn,["prevent"]),["esc"])},null,40,hf),[[Pa,Ue.value.text]]),f("div",gf,[f("button",{type:"button",class:"message-inline-editor-button message-inline-editor-primary",onClick:ca},w(c(K)("Save")),1),f("button",{type:"button",class:"message-inline-editor-button",onClick:Yn},w(c(K)("Cancel")),1)]),f("p",vf,w(c(K)("Saving rolls this turn back and resends it with your changes. Later replies will be removed.")),1)])):I("",!0)],8,yd)],8,pd)],10,vd))],10,Ku)):I("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids","duration-ms"]),(a(!0),l(N,null,z(d.dividers??[],k=>(a(),l("li",{key:`${d.key}-divider-${k.to??""}-${k.from??""}`,class:"conversation-item conversation-item-model-switch","data-role":"system","data-message-type":"modelSwitch","data-hot-block":d.key},[te(Mo,{from:k.from,to:k.to},null,8,["from","to"])],8,pf))),128)),d.key===Gs.value&&qn.value>0?(a(),l("li",{key:1,class:"conversation-warm-spacer-bottom",style:Ie({height:`${qn.value}px`}),"aria-hidden":"true"},null,4)):I("",!0),d.warm===void 0&&d.key===Zs.value&&Wn.value>0?(a(),l("li",{key:2,"aria-hidden":"true",class:"conversation-hot-spacer-bottom",style:Ie({height:`${Wn.value}px`})},null,4)):I("",!0)],64)):I("",!0)],64))),128)),e.liveOverlay?(a(),de(el,{key:2,overlay:e.liveOverlay,"feedback-mailto":c(vn)},null,8,["overlay","feedback-mailto"])):I("",!0),f("li",{ref_key:"bottomAnchorRef",ref:Ut,class:"conversation-bottom-anchor"},null,512)],544),te(Gl,{anchors:Hn.value,"active-turn":Ls.value,onJump:Ps},null,8,["anchors","active-turn"]),oa.value?(a(),l("button",{key:4,type:"button",class:"jump-to-latest-button",title:c(K)("Jump to latest"),"aria-label":c(K)("Jump to latest output"),onClick:oo},[te(Ea,{class:"icon-svg jump-to-latest-icon"})],8,yf)):I("",!0),c(_t).length>0?(a(),l("div",{key:5,class:"image-modal-backdrop",onClick:s[4]||(s[4]=(...d)=>c(Tt)&&c(Tt)(...d))},[f("div",{class:"image-modal-content",onClick:s[3]||(s[3]=et(()=>{},["stop"]))},[f("button",{class:"image-modal-close",type:"button","aria-label":c(K)("Close image preview"),onClick:s[2]||(s[2]=(...d)=>c(Tt)&&c(Tt)(...d))},[te(Oo,{class:"icon-svg"})],8,wf),c(ps)?(a(),l("video",{key:0,class:"image-modal-image",src:c(_t),controls:"",autoplay:""},null,8,kf)):(a(),l("img",{key:1,class:"image-modal-image",src:c(_t),alt:c(K)("Expanded message image")},null,8,bf))])])):I("",!0),te(Dr,{visible:c(tt),x:c(ut),y:c(T),"browse-url":c(A),"edit-url":c(O),onClose:c(fe)},null,8,["visible","x","y","browse-url","edit-url","onClose"]),te(hr,{change:c(xe),changes:c(he),lines:c(j),"is-mobile":c(D),"is-file-list-open":c(me),cwd:r.cwd,onClose:c(Oe),onSelectChange:c(Jo),onToggleFileList:c(Yo),onCloseFileList:c(Xo)},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd","onClose","onSelectChange","onToggleFileList","onCloseFileList"]),f("h4",{ref_key:"latestResponseHeadingRef",ref:$n,class:"sr-only m-0 select-none",tabindex:Kt.value,onFocus:fa},w(c(K)("Latest response")),41,Cf)],40,_u),te(Mi,{visible:Ne.value!==null,title:$s.value,message:_s.value,"confirm-label":"Confirm",danger:"",onConfirm:ua,onCancel:s[6]||(s[6]=d=>Ne.value=null)},null,8,["visible","title","message"])],64))}}),Af=se(Sf,[["__scopeId","data-v-b7334c5c"]]);export{Af as default};
|