codex-mobile-re 0.1.113 → 0.1.115
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-DlBkLmKR.js → AutomationsPanel-BmeZ3J9i.js} +1 -1
- package/dist/assets/{DirectoryHub-sS2h3U_D.js → DirectoryHub-Ciz8rVK4.js} +1 -1
- package/dist/assets/{QueuedMessages-D_o6pC9F.js → QueuedMessages-p3CX5QzM.js} +1 -1
- package/dist/assets/{ReviewPane-qS7hOyaM.js → ReviewPane-DcvdhrcS.js} +1 -1
- package/dist/assets/{RightFilePreview-D1LmPrpY.js → RightFilePreview-BjmHDwE1.js} +1 -1
- package/dist/assets/{RightFilesPanel-B5AIrAU3.js → RightFilesPanel-CFsAu6As.js} +1 -1
- package/dist/assets/{RightGitPanel-K_jp1qHA.js → RightGitPanel-NcqihWb7.js} +1 -1
- package/dist/assets/{SettingsDialog-C4aE-PFC.js → SettingsDialog-C-PIbb7v.js} +1 -1
- package/dist/assets/{ThreadConversation-Ccm62p-Y.css → ThreadConversation-BOs1zeme.css} +1 -1
- package/dist/assets/ThreadConversation-CcsAV6iU.js +39 -0
- package/dist/assets/{ThreadPendingRequestPanel-DNTrk7uR.js → ThreadPendingRequestPanel-C7aX0YrN.js} +1 -1
- package/dist/assets/{ThreadTerminalPanel-BLHMQWJI.js → ThreadTerminalPanel-2PMt2IWn.js} +1 -1
- package/dist/assets/{index-Cu_hRJGY.js → index-BJ-YiA9y.js} +17 -17
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ThreadConversation-B4NZvuHw.js +0 -39
package/dist/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<link rel="icon" type="image/png" sizes="192x192" href="/icons/pwa-192x192.png" />
|
|
13
13
|
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
|
|
14
14
|
<title>Codex Web</title>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-BJ-YiA9y.js"></script>
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-pBusEabS.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body class="bg-slate-950">
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import{c as P,r as U,g as po,o as pt,a as Rt,b as _n,d as Ze,e as le,f as c,h as se,i as f,w as Ue,j as m,t as w,n as te,k as S,T as Un,_ as oe,u,F as W,l as K,m as ke,p as Q,I as Nn,q as vo,s as We,v as me,x as $e,y as Je,z as Vn,A as ko,B as Pe,C as yo,D as zn,E as Ot,G as wo,H as bo,J as ct,K as Co,L as $o,M as xo,N as To}from"./index-Cu_hRJGY.js";import{s as St}from"./sanitizeHtml-Bd3No2dT.js";function _o(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const t=e.startsWith("/"),n=/^[A-Za-z]:[\\/]/u.test(e),o=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return t||n||o||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function ft(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function Ne(e){return e.replace(/\\/gu,"/")}function Kn(e){if(!e.startsWith("file://"))return e;let t=e.replace(/^file:\/\//u,"");try{t=decodeURIComponent(t)}catch{}return/^\/[A-Za-z]:\//u.test(t)&&(t=t.slice(1)),t}function Io(e){const t=Ne(e),n=t.match(/^\/Users\/([^/]+)/u);if(n)return`/Users/${n[1]}`;const o=t.match(/^\/home\/([^/]+)/u);return o?`/home/${o[1]}`:""}function je(e){const t=Ne(e);if(!t)return t;let n="",o=t;const s=o.match(/^([A-Za-z]:)(\/.*)?$/u);s?(n=`${s[1]}/`,o=(s[2]??"").replace(/^\/+/u,"")):o.startsWith("/")&&(n="/",o=o.slice(1));const a=o.split("/").filter(Boolean),i=[];for(const l of a)if(l!=="."){if(l===".."){i.length>0&&i.pop();continue}i.push(l)}const r=i.join("/");return n?`${n}${r}`.replace(/\/+$/u,"")||n:r||t}function Gn(e,t){const n=Ne(Kn(e.trim()));if(!n)return"";if(n.startsWith("/")||/^[A-Za-z]:\//u.test(n))return je(n);if(n.startsWith("~/")){const a=Io(t);if(a)return je(`${a}/${n.slice(2)}`)}const s=Ne(t.trim());return je(s?`${s.replace(/\/+$/u,"")}/${n}`:n)}function ht(e){let t=e,n="",o="";const s={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;t.length>0;){const a=t[0],i=Object.prototype.hasOwnProperty.call(s,a)?s[a]:"";if(!i||!t.endsWith(i))break;n+=a,o+=i,t=t.slice(1,-1)}return{core:t,leading:n,trailing:o}}function Xe(e){if(!e)return null;let t=e.trim();t=ht(t).core.trim();let o=null;const s=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(s)t=s[1],o=Number(s[2]);else{const a=t.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(t=a[1],o=Number(a[2]))}return t=Kn(t),_o(t)?{path:t,line:o}:null}function In(e,t,n){let o=0,s=t-1;for(;s>=n&&e[s]==="*";)o+=1,s-=1;return o}function Lo(e,t){let n=0,o=t;for(;o<e.length&&e[o]==="*";)n+=1,o+=1;return n}function Zn(e,t,n,o,s){const a=In(e,t,o);return a<2?null:Lo(e,n)>=a?{segmentStart:t-a,segmentEnd:n+a,tokenEndTrim:0}:In(s,s.length,0)>=a?{segmentStart:t-a,segmentEnd:n,tokenEndTrim:a}:null}function Dt(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith(")"))return null;const n=t.indexOf("]");if(n<=1||t[n+1]!=="(")return null;const o=t.slice(1,n).trim(),s=t.slice(n+2,-1).trim();if(o.includes(`
|
|
2
|
-
`)||s.includes(`
|
|
3
|
-
`))return null;const a=ht(o).core.trim()||o,i=ht(s).core.trim();return i?{label:a,target:i}:null}function mt(e){const t=e.trim().match(/^codex:\/\/threads\/([A-Za-z0-9-]+)$/u);if(!t)return null;if(typeof window>"u")return`/#/thread/${t[1]}`;const n=window.location.pathname.replace(/\/?$/u,"/");return`${window.location.origin}${n}#/thread/${t[1]}`}function Jn(e){const t=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(t)}`}function Xn(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}const Yn={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 ce(e){return`${e.path}\0${e.movedToPath??""}`}function Mo(e,t){return e?!t||e===t?e:`${e}
|
|
4
|
-
${t}`.trim():t}function Ao(e,t){const n=e.operation==="add"||t.operation==="add"?"add":e.operation==="delete"||t.operation==="delete"?"delete":"update";return{path:t.path||e.path,operation:n,movedToPath:t.movedToPath??e.movedToPath??null,diff:Mo(e.diff,t.diff),addedLineCount:e.addedLineCount+t.addedLineCount,removedLineCount:e.removedLineCount+t.removedLineCount}}function So(e,t){const n=e.operation==="add"?0:e.operation==="update"?1:2,o=t.operation==="add"?0:t.operation==="update"?1:2;if(n!==o)return n-o;const s=`${e.path}\0${e.movedToPath??""}`,a=`${t.path}\0${t.movedToPath??""}`;return s.localeCompare(a)}function Ft(e){const t=new Map;for(const n of e){const o=`${n.path}\0${n.movedToPath??""}`,s=t.get(o);t.set(o,s?Ao(s,n):{...n})}return Array.from(t.values()).sort(So)}function Kt(e,t){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?t("Moved + edited"):t("Moved"):e.operation==="add"?t("Added"):e.operation==="delete"?t("Deleted"):t("Edited")}function Fo(e){return e.operation==="update"&&e.movedToPath?"→":e.operation==="add"?"+":e.operation==="delete"?"−":"M"}function Ht(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function Be(e){const t=[];return e.addedLineCount>0&&t.push(`+${e.addedLineCount}`),e.removedLineCount>0&&t.push(`-${e.removedLineCount}`),t.join(" ")}function Qn(e,t,n=""){const o=[];return e>0&&o.push({tone:"add",label:`+${e}`}),t>0&&o.push({tone:"remove",label:`-${t}`}),o.length>0?o:n?[{tone:"neutral",label:n}]:[]}function Po(e){return Qn(e.addedLineCount,e.removedLineCount)}function es(e,t){return e===1?`1 ${t("file changed")}`:`${e} ${t("files changed")}`}function Eo(e,t){if(!e||e.changes.length===0)return"";let n=0,o=0,s=0,a=0;for(const r of e.changes){if(r.operation==="add"){n+=1;continue}if(r.operation==="delete"){o+=1;continue}if(r.movedToPath){a+=1;continue}s+=1}const i=[];return s>0&&i.push(`${s} ${t("edited")}`),n>0&&i.push(`${n} ${t("added")}`),o>0&&i.push(`${o} ${t("deleted")}`),a>0&&i.push(`${a} ${t("moved")}`),i.join(", ")}function Bo(e,t){if(!e||e.changes.length===0)return t("Modified files");const n=es(e.changes.length,t),o=Eo(e,t);return o?`${n} · ${o}`:n}function Ro(e){if(!e||e.changes.length===0)return[];const t=e.changes.reduce((s,a)=>s+a.addedLineCount,0),n=e.changes.reduce((s,a)=>s+a.removedLineCount,0),o=e.changes.some(s=>s.movedToPath)?"Moved":"Ready";return Qn(t,n,o)}function Ve(e,t){const n=Gn(e,t),o=je(Ne(t.trim())),s=je(Ne(n));return o&&s.startsWith(`${o}/`)?s.slice(o.length+1):e}function Oo(e,t,n){if(!e||e.changes.length===0)return"";const o=e.changes.map(s=>{const a=Ve(s.path,t),i=s.movedToPath?` -> ${Ve(s.movedToPath,t)}`:"",r=Be(s);return`- ${Kt(s,n)}: ${a}${i}${r?` (${r})`:""}`});return`${n("Modified files")}:
|
|
5
|
-
${o.join(`
|
|
6
|
-
`)}`.trim()}function Do(e){var o;const n=((o=(e.movedToPath||e.path).split(".").pop())==null?void 0:o.toLowerCase())??"";return Yn[n]??n??""}function Ho(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function Wo(e){const t=e.diff.replace(/\r\n/g,`
|
|
7
|
-
`),n=t.length>0?t.split(`
|
|
8
|
-
`):[];return n.length>0&&n[n.length-1]===""&&n.pop(),n.map((o,s)=>({key:`${ce(e)}:synthetic:${s}`,kind:e.operation==="delete"?"remove":"add",oldLine:e.operation==="delete"?s+1:null,newLine:e.operation==="delete"?null:s+1,text:o}))}function jo(e){const t=e.diff.replace(/\r\n/g,`
|
|
9
|
-
`),n=t.length>0?t.split(`
|
|
10
|
-
`):[];n.length>0&&n[n.length-1]===""&&n.pop();const o=[];let s=0,a=0;for(const[i,r]of n.entries()){const l=r.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(l){s=Number(l[1]),a=Number(l[2]),o.push({key:`${ce(e)}:hunk:${i}`,kind:"hunk",oldLine:null,newLine:null,text:r});continue}if(r.startsWith("+")&&!r.startsWith("+++")){o.push({key:`${ce(e)}:add:${i}`,kind:"add",oldLine:null,newLine:a,text:r.slice(1)}),a+=1;continue}if(r.startsWith("-")&&!r.startsWith("---")){o.push({key:`${ce(e)}:remove:${i}`,kind:"remove",oldLine:s,newLine:null,text:r.slice(1)}),s+=1;continue}if(r.startsWith(" ")){o.push({key:`${ce(e)}:context:${i}`,kind:"context",oldLine:s,newLine:a,text:r.slice(1)}),s+=1,a+=1;continue}o.push({key:`${ce(e)}:meta:${i}`,kind:"meta",oldLine:null,newLine:null,text:r})}return o}function qo(e){return!e||!e.diff.trim()?[]:Ho(e)?jo(e):Wo(e)}function Uo(e){return!!(e!=null&&e.diff.trim())}function No(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}function Vo(e,t){if(e.size===0)return e;const n=new Set;for(const o of e)t.has(o)&&n.add(o);return n.size===e.size?e:n}function zo(e){const{getMessages:t,getLiveTurnId:n,isFileChangeMessage:o,isCopyableAssistantMessage:s,isReasoningMessage:a,isPlanMessage:i,isFoldMember:r,getHiddenGroupedCommandIds:l,isMobile:h}=e,g=U(new Set),b=U(null),L=U(""),y=U(!1),I=P(()=>{var re,ge;const B=new Map,N=new Map,ue=new Map,ye=j=>!o(j)&&!a(j)&&!i(j)&&!l().has(j.id)&&!r(j);for(const j of t()){const pe=typeof j.turnIndex=="number"?`turn:${j.turnIndex}`:`message:${j.id}`;if(ye(j)&&B.set(pe,j.id),s(j)&&typeof j.turnIndex=="number"&&Array.isArray(j.fileChanges)&&j.fileChanges.length>0&&N.set(j.id,{changes:Ft(j.fileChanges),sourceMessageIds:[],source:"assistant",turnId:j.turnId??""}),!o(j))continue;const _e=ue.get(pe);_e?_e.push(j):ue.set(pe,[j])}const ie={};for(const[j,pe]of ue.entries()){const _e=B.get(j);if(!_e)continue;const et=((re=N.get(_e))==null?void 0:re.turnId)??"";ie[_e]={changes:Ft(pe.flatMap(Ie=>Ie.fileChanges??[])),sourceMessageIds:pe.map(Ie=>Ie.id),source:"metadata",turnId:((ge=pe.find(Ie=>typeof Ie.turnId=="string"&&Ie.turnId.length>0))==null?void 0:ge.turnId)??et}}for(const[j,pe]of N.entries())ie[j]||(ie[j]=pe);return ie}),k=P(()=>{var ye;const B=new Map,N=new Set;for(const ie of Object.values(I.value))for(const re of ie.sourceMessageIds)N.add(re);for(const ie of t()){if(!o(ie))continue;const re=typeof ie.turnIndex=="number"?`turn:${ie.turnIndex}`:`message:${ie.id}`,ge=B.get(re);ge?ge.push(ie):B.set(re,[ie])}const ue={};for(const[ie,re]of B.entries()){if(re.some(j=>N.has(j.id)))continue;const ge=re[re.length-1];ge&&(ue[ge.id]={changes:Ft(re.flatMap(j=>j.fileChanges??[])),sourceMessageIds:re.map(j=>j.id),source:"metadata",turnId:ge.turnId??((ye=re.find(j=>typeof j.turnId=="string"&&j.turnId.length>0))==null?void 0:ye.turnId)??""})}return ue}),E=P(()=>{const B=new Set;for(const N of Object.values(I.value))for(const ue of N.sourceMessageIds)B.add(ue);for(const[N,ue]of Object.entries(k.value))for(const ye of ue.sourceMessageIds)ye!==N&&B.add(ye);return B}),x=P(()=>{var B;return((B=b.value)==null?void 0:B.changes)??[]}),C=P(()=>{const B=x.value;return B.length===0?null:B.find(N=>ce(N)===L.value)??B[0]}),A=P(()=>qo(C.value));function _(B){const N=new Set(g.value);N.has(B.id)?N.delete(B.id):N.add(B.id),g.value=N}function R(B){return g.value.has(B.id)}function O(B,N){B&&(b.value=B,L.value=ce(N),y.value=!1)}function q(){b.value=null,L.value="",y.value=!1}function ee(){y.value=!y.value}function V(){y.value=!1}function fe(B){L.value=ce(B),h()&&(y.value=!1)}function Re(B){return I.value[B]??null}function ze(B){return g.value.has(B)}function $(B){const N=t().find(ue=>ue.id===B);N&&_(N)}function M(B){return Re(B.id)}function D(B){return k.value[B.id]??null}function G(B){if(!B)return!1;const N=n();return N?(B.turnId??"")!==N:!0}function ae(){const B=new Set([...Object.keys(I.value),...Object.keys(k.value)]);g.value=Vo(g.value,B)}return{anchoredFileChangeSummaryByAnchorId:I,standaloneFileChangeSummaryByMessageId:k,hiddenFileChangeMessageIds:E,isDiffViewerFileListOpen:y,diffViewerChanges:x,activeDiffViewerChange:C,activeDiffViewerLines:A,toggleFileChangeSummary:_,isFileChangeSummaryExpanded:R,openDiffViewer:O,closeDiffViewer:q,toggleDiffViewerFileList:ee,closeDiffViewerFileList:V,selectDiffViewerChange:fe,readAnchoredFileChangeSummaryById:Re,isFileChangeSummaryExpandedById:ze,toggleFileChangeSummaryById:$,readAnchoredFileChangeSummary:M,readStandaloneFileChangeSummary:D,isFileChangeSummaryVisible:G,pruneFileChangeSummaryIds:ae}}function Ko(e){const{getMessages:t,isCopyableAssistantMessage:n,isPlanMessage:o,planStepCopyMarker:s,buildFileChangeCopyText:a,getAnchoredFileChangeSummaries:i}=e,r=U("");let l=null;function h(A){var O;const _=Ze(A);if(!_)return"";const R=[];return(O=_.explanation)!=null&&O.trim()&&R.push(_.explanation.trim()),_.steps.length>0&&R.push(_.steps.map(q=>`- ${s(q.status)} ${q.step}`.trim()).join(`
|
|
11
|
-
`)),R.join(`
|
|
12
|
-
|
|
13
|
-
`).trim()}function g(A){const _=[],R=A.text.trim()||h(A),O=o(A)&&R?`Plan
|
|
14
|
-
${R}`:R;O&&_.push(O);const q=(A.fileAttachments??[]).map(V=>V.path.trim()).filter(V=>V.length>0);q.length>0&&_.push(`Files:
|
|
15
|
-
${q.join(`
|
|
16
|
-
`)}`);const ee=(A.images??[]).map(V=>V.trim()).filter(V=>V.length>0);return ee.length>0&&_.push(`Images:
|
|
17
|
-
${ee.join(`
|
|
18
|
-
`)}`),_.join(`
|
|
19
|
-
|
|
20
|
-
`).trim()}const b=P(()=>{var R;const A=new Map;for(const O of t()){if(!n(O))continue;const q=g(O);if(!q)continue;const ee=typeof O.turnIndex=="number"?`turn:${O.turnIndex}`:`message:${O.id}`,V=A.get(ee);if(V){V.anchorMessageId=O.id,V.parts.push(q);continue}A.set(ee,{anchorMessageId:O.id,parts:[q]})}const _={};for(const O of A.values()){const q=O.parts.join(`
|
|
21
|
-
|
|
22
|
-
`).trim();q&&(_[O.anchorMessageId]=q)}for(const[O,q]of Object.entries(i())){if(q.source!=="metadata")continue;const ee=a(q);if(!ee)continue;const V=(R=_[O])==null?void 0:R.trim();_[O]=V?`${V}
|
|
23
|
-
|
|
24
|
-
${ee}`:ee}return _}),L=P(()=>{const A=new Map;for(const R of t()){if(!n(R)||typeof R.turnIndex!="number")continue;const O=`turn:${R.turnIndex}`,q=A.get(O);if(q){q.anchorMessageId=R.id,q.turnIndex=R.turnIndex;continue}A.set(O,{anchorMessageId:R.id,turnIndex:R.turnIndex})}const _={};for(const R of A.values())_[R.anchorMessageId]=R.turnIndex;return _});function y(A){return typeof b.value[A.id]=="string"}function I(A){return A.role==="user"&&g(A).length>0}function k(A){r.value=A,l&&clearTimeout(l),l=setTimeout(()=>{r.value===A&&(r.value=""),l=null},1800)}po()&&pt(()=>{l&&(clearTimeout(l),l=null)});async function E(A){const _=t().find(q=>q.id===A);if(!_)return;const R=g(_);if(!R)return;let O=!1;try{await Rt(R),O=!0}catch{O=!1}O||(O=_n(R)),O&&k(A)}function x(A){return typeof L.value[A.id]=="number"}async function C(A){const _=b.value[A]??"";if(!_)return;let R=!1;try{await Rt(_),R=!0}catch{R=!1}R||(R=_n(_)),R&&k(A)}return{copiedResponseAnchorId:r,copyableResponseContentByAnchorId:b,forkableTurnIndexByAnchorId:L,showCopyResponseButton:y,isCopyableUserMessage:I,copyUserMessage:E,showForkResponseButton:x,copyResponse:C}}function Go(e){const{getMessages:t,getLiveOverlay:n,isCommandMessage:o}=e,s=U(new Set),a=P(()=>{var A;const C=t();for(let _=C.length-1;_>=0;_-=1){const R=C[_];if(R.messageType==="commandExecution"&&((A=R.commandExecution)==null?void 0:A.status)==="inProgress")return R.id}return""}),i=P(()=>t().some(C=>C.role==="assistant"&&C.messageType==="agentMessage.live"&&C.text.trim().length>0)),r=P(()=>!!n()||a.value.length>0||i.value),l=P(()=>{const C=t(),A={};for(let _=0;_<C.length;){const R=C[_];if(!o(R)){_+=1;continue}const O=[];for(;_<C.length&&o(C[_]);)O.push(C[_]),_+=1;if(O.length<=1)continue;const q=O[O.length-1];A[q.id]=O.slice(0,-1)}return A}),h=P(()=>{const C=new Set;for(const A of Object.values(l.value))for(const _ of A)C.add(_.id);return C});function g(C){return o(C)&&s.value.has(C.id)}function b(C){return o(C)&&r.value}function L(C){var A;return o(C)&&(r.value||((A=C.commandExecution)==null?void 0:A.status)==="inProgress")}function y(C){if(!o(C))return;const A=new Set(s.value);A.has(C.id)?A.delete(C.id):A.add(C.id),s.value=A}function I(C){return l.value[C.id]??[]}function k(C){return o(C)?[...I(C),C]:[]}function E(C,A){if(C.size===0)return C;const _=new Set;for(const R of C)A.has(R)&&_.add(R);return _.size===C.size?C:_}function x(C){s.value=E(s.value,C)}return{expandedCommandIds:s,activeCommandMessageId:a,hasLiveAssistantText:i,isLiveTurnRuntime:r,groupedCommandsByLatestId:l,hiddenGroupedCommandIds:h,isCommandExpanded:g,isCommandCompact:b,isCommandOutputCondensed:L,toggleCommandExpand:y,getGroupedCommandsForLatest:I,getWorkBlockCommands:k,pruneCommandIdSets:x}}function Zo(e){const{getActiveThreadId:t,getCwd:n,onFileChangesChanged:o,updateThreadFileChanges:s,t:a}=e,i=U({}),r=U({}),l=U({});function h(x){const C=t();return x!=null&&x.turnId&&C?`thread:${C}:turn:${x.turnId}`:""}function g(x){return h(x).length>0}function b(x){const C=h(x);return C?i.value[C]??"idle":"idle"}function L(x){const C=h(x);return C?r.value[C]??"":""}function y(x){const C=b(x);return C==="undone"||C==="redoing"?"redo":"undo"}function I(x){const C=b(x);return C==="undoing"?a("Undoing"):C==="redoing"?a("Redoing"):y(x)==="redo"?a("Redo"):a("Undo")}async function k(x,C,A){const _=h(x),R=t(),O=n();if(!x||!_||!R||!O)return;const q=b(x),ee=C==="undo"?"undoing":"redoing";i.value={...i.value,[_]:ee},r.value={...r.value,[_]:""};let V;try{const fe=l.value[_]??[];V=await s(R,x.turnId,O,C,fe.length>0?fe:void 0,"single_turn",A)}catch(fe){i.value={...i.value,[_]:q},r.value={...r.value,[_]:fe instanceof Error?fe.message:a("Failed to update file changes.")};return}if(V.errors.length>0){C==="undo"?(l.value={...l.value,[_]:V.revertedPatchIds??[]},i.value={...i.value,[_]:"undone"}):((V.appliedPatchIds??[]).length>0&&(l.value={...l.value,[_]:V.appliedPatchIds??[]}),i.value={...i.value,[_]:"undone"}),r.value={...r.value,[_]:V.errors.join("; ")};return}if((V.changed??0)<=0){i.value={...i.value,[_]:q},r.value={...r.value,[_]:V.message||a(C==="undo"?"No file changes to undo.":"No file changes to redo.")};return}C==="undo"?(l.value={...l.value,[_]:V.revertedPatchIds??[]},i.value={...i.value,[_]:"undone"}):(l.value={...l.value,[_]:V.appliedPatchIds??[]},i.value={...i.value,[_]:"redone"}),o()}function E(){i.value={},r.value={},l.value={}}return{fileChangeActionState:i,fileChangeActionError:r,fileChangeRedoPatchIds:l,fileChangeActionKey:h,isFileChangeActionable:g,fileChangeActionStatus:b,fileChangeActionErrorText:L,fileChangeNextAction:y,fileChangeActionLabel:I,runFileChangeAction:k,resetFileChangeActions:E}}function Jo(e){const{toEditUrlFromBrowseHref:t}=e,n=U(!1),o=U(0),s=U(0),a=U(""),i=U("");function r(h){var y,I;const g=h.target,b=(y=g==null?void 0:g.closest)==null?void 0:y.call(g,"a.message-file-link");if(!b)return;const L=(((I=b.getAttribute)==null?void 0:I.call(b,"href"))??"").trim();!L||L==="#"||(h.preventDefault(),h.stopPropagation(),a.value=L,i.value=t(L),o.value=h.clientX,s.value=h.clientY,n.value=!0)}function l(){n.value&&(n.value=!1)}return{isFileLinkContextMenuVisible:n,fileLinkContextMenuX:o,fileLinkContextMenuY:s,fileLinkContextBrowseUrl:a,fileLinkContextEditUrl:i,handleConversationContextMenu:r,closeFileLinkContextMenu:l}}function Xo(e){const{isVideo:t}=e,n=U(""),o=U(!1),s=U(0),a=U(new Set);function i(b,L){return`${b}:${L}`}function r(b,L){return a.value.has(i(b,L))}function l(b,L){const y=new Set(a.value);y.add(i(b,L)),a.value=y,s.value+=1}function h(b){n.value=b,o.value=t(b)}function g(){n.value="",o.value=!1}return{modalImageUrl:n,modalIsVideo:o,markdownImageFailureVersion:s,isMarkdownImageFailed:r,onMarkdownImageError:l,openImageModal:h,closeImageModal:g}}const Yo=["aria-label"],Qo={class:"confirm-dialog-title"},ea={class:"confirm-dialog-message"},ta={class:"confirm-dialog-actions"},na=le({__name:"ConfirmDialog",props:{visible:{type:Boolean},title:{},message:{},confirmLabel:{default:""},cancelLabel:{default:""},danger:{type:Boolean,default:!1}},emits:["confirm","cancel"],setup(e){return(t,n)=>(c(),se(Un,{to:"body"},[e.visible?(c(),f("div",{key:0,class:"confirm-dialog-overlay",onClick:n[2]||(n[2]=Ue(o=>t.$emit("cancel"),["self"]))},[m("div",{class:"confirm-dialog-panel",role:"alertdialog","aria-modal":"true","aria-label":e.title},[m("h3",Qo,w(e.title),1),m("p",ea,w(e.message),1),m("div",ta,[m("button",{class:"confirm-dialog-btn confirm-dialog-btn-cancel",type:"button",onClick:n[0]||(n[0]=o=>t.$emit("cancel"))},w(e.cancelLabel||"Cancel"),1),m("button",{class:te(["confirm-dialog-btn confirm-dialog-btn-confirm",{"is-danger":e.danger}]),type:"button",onClick:n[1]||(n[1]=o=>t.$emit("confirm"))},w(e.confirmLabel||"Confirm"),3)])],8,Yo)])):S("",!0)]))}}),sa=oe(na,[["__scopeId","data-v-de94025d"]]),oa={key:0,class:"diff-viewer-sidebar"},aa={class:"diff-viewer-sidebar-header"},ia={class:"diff-viewer-sidebar-title"},ra={class:"diff-viewer-sidebar-count"},la={class:"diff-viewer-sidebar-list"},ca=["data-active","onClick"],ua=["data-operation"],da={class:"diff-viewer-file-label"},fa={key:0,class:"diff-viewer-file-delta"},ha={class:"diff-viewer-main"},ma={class:"diff-viewer-toolbar"},ga={class:"diff-viewer-title-wrap"},pa={class:"diff-viewer-title"},va={class:"diff-viewer-subtitle"},ka={key:0},ya={class:"diff-viewer-toolbar-actions"},wa=["aria-label"],ba={key:0,class:"diff-viewer-empty"},Ca={class:"diff-viewer-empty-title"},$a={class:"diff-viewer-empty-text"},xa={key:1,class:"diff-viewer-panel"},Ta={class:"diff-viewer-meta"},_a={class:"diff-viewer-language"},Ia={class:"diff-viewer-lines"},La=["data-kind"],Ma={class:"diff-viewer-line-number"},Aa={class:"diff-viewer-line-number"},Sa={class:"diff-viewer-line-marker"},Fa=["innerHTML"],Pa={class:"diff-viewer-mobile-sheet-header"},Ea={class:"diff-viewer-sidebar-title"},Ba={class:"diff-viewer-sidebar-count"},Ra={class:"diff-viewer-mobile-sheet-list"},Oa=["data-active","onClick"],Da=["data-operation"],Ha={class:"diff-viewer-file-label"},Wa={key:0,class:"diff-viewer-file-delta"},ja=le({__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 t=e,{t:n}=me();function o(r){return r.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}const s=P(()=>r=>Kt(r,n)),a=P(()=>r=>es(r,n)),i=P(()=>r=>Ve(r,t.cwd));return(r,l)=>(c(),se(Un,{to:"body"},[e.change?(c(),f("div",{key:0,class:"diff-viewer-backdrop",onClick:l[5]||(l[5]=h=>r.$emit("close"))},[m("div",{class:"diff-viewer-shell",onClick:l[4]||(l[4]=Ue(()=>{},["stop"]))},[e.isMobile?S("",!0):(c(),f("aside",oa,[m("div",aa,[m("p",ia,w(u(n)("Changed files")),1),m("p",ra,w(a.value(e.changes.length)),1)]),m("div",la,[(c(!0),f(W,null,K(e.changes,h=>(c(),f("button",{key:`diff-viewer:${u(ce)(h)}`,type:"button",class:"diff-viewer-file-button","data-active":u(ce)(h)===u(ce)(e.change),onClick:g=>r.$emit("select-change",h)},[m("span",{class:"file-change-badge","data-operation":u(Ht)(h)},w(s.value(h)),9,ua),m("span",da,[ke(w(i.value(h.path))+" ",1),h.movedToPath?(c(),f(W,{key:0},[ke(" → "+w(i.value(h.movedToPath)),1)],64)):S("",!0)]),u(Be)(h)?(c(),f("span",fa,w(u(Be)(h)),1)):S("",!0)],8,ca))),128))])])),m("section",ha,[m("div",ma,[m("div",ga,[m("p",pa,[ke(w(i.value(e.change.path))+" ",1),e.change.movedToPath?(c(),f(W,{key:0},[ke(" → "+w(i.value(e.change.movedToPath)),1)],64)):S("",!0)]),m("p",va,[ke(w(s.value(e.change))+" ",1),u(Be)(e.change)?(c(),f("span",ka," · "+w(u(Be)(e.change)),1)):S("",!0)])]),m("div",ya,[e.isMobile?(c(),f("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:l[0]||(l[0]=h=>r.$emit("toggle-file-list"))},w(a.value(e.changes.length)),1)):S("",!0),m("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":u(n)("Close diff viewer"),onClick:l[1]||(l[1]=h=>r.$emit("close"))},[Q(Nn,{class:"icon-svg"})],8,wa)])]),u(Uo)(e.change)?(c(),f("div",xa,[m("div",Ta,[m("span",_a,w(u(Do)(e.change)||"diff"),1)]),m("div",Ia,[(c(!0),f(W,null,K(e.lines,h=>(c(),f("div",{key:h.key,class:"diff-viewer-line","data-kind":h.kind},[m("span",Ma,w(h.oldLine??""),1),m("span",Aa,w(h.newLine??""),1),m("span",Sa,w(u(No)(h)),1),m("code",{class:"diff-viewer-line-code",innerHTML:o(h.text)||" "},null,8,Fa)],8,La))),128))])])):(c(),f("div",ba,[m("p",Ca,w(u(n)("No diff available")),1),m("p",$a,w(u(n)("This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.")),1)]))]),Q(vo,{name:"diff-viewer-sheet"},{default:We(()=>[e.isMobile&&e.isFileListOpen?(c(),f("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:l[3]||(l[3]=h=>r.$emit("close-file-list"))},[m("div",{class:"diff-viewer-mobile-sheet",onClick:l[2]||(l[2]=Ue(()=>{},["stop"]))},[l[6]||(l[6]=m("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),m("div",Pa,[m("p",Ea,w(u(n)("Changed files")),1),m("p",Ba,w(a.value(e.changes.length)),1)]),m("div",Ra,[(c(!0),f(W,null,K(e.changes,h=>(c(),f("button",{key:`diff-viewer-sheet:${u(ce)(h)}`,type:"button",class:"diff-viewer-file-button","data-active":u(ce)(h)===u(ce)(e.change),onClick:g=>r.$emit("select-change",h)},[m("span",{class:"file-change-badge","data-operation":u(Ht)(h)},w(s.value(h)),9,Da),m("span",Ha,[ke(w(i.value(h.path))+" ",1),h.movedToPath?(c(),f(W,{key:0},[ke(" → "+w(i.value(h.movedToPath)),1)],64)):S("",!0)]),u(Be)(h)?(c(),f("span",Wa,w(u(Be)(h)),1)):S("",!0)],8,Oa))),128))])])])):S("",!0)]),_:1})])])):S("",!0)]))}}),qa=oe(ja,[["__scopeId","data-v-7ec6502b"]]),Ua={},Na={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Va(e,t){return c(),f("svg",Na,[...t[0]||(t[0]=[m("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 Wt=oe(Ua,[["render",Va]]),za={class:"file-change-summary-label"},Ka={class:"file-change-summary-status"},Ga=["data-tone"],Za={class:"file-change-panel-inner"},Ja={class:"file-change-list"},Xa=["data-operation","title"],Ya={class:"file-change-path-group"},Qa=["title","onClick"],ei={key:0,class:"file-change-arrow"},ti=["title","onClick"],ni={key:0,class:"file-change-delta"},si=["data-tone"],oi=["title","aria-label","onClick"],ai={key:0,class:"file-change-actions"},ii={key:0,class:"file-change-action-error"},ri=["disabled","title","aria-label"],li=le({__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 t=e,{t:n}=me(),o=P(()=>r=>Kt(r,n)),s=P(()=>r=>Bo(r,n)),a=P(()=>r=>Ve(r,t.cwd)),i=P(()=>r=>`${n("Undo")} ${Ve(r.path,t.cwd)}`);return(r,l)=>e.summary?(c(),f("section",{key:0,class:te(["file-change-summary-block",{"file-change-summary-block-inline":e.inline}])},[m("button",{type:"button",class:te(["file-change-summary-row",{"file-change-summary-row-expanded":e.expanded}]),onClick:l[0]||(l[0]=h=>r.$emit("toggle"))},[m("span",{class:te(["file-change-chevron",{"file-change-chevron-open":e.expanded}])},"▶",2),m("span",za,w(s.value(e.summary)),1),m("span",Ka,[(c(!0),f(W,null,K(u(Ro)(e.summary),h=>(c(),f("span",{key:`summary-status:${e.summary.turnId}:${h.tone}:${h.label}`,class:"file-change-signed-count","data-tone":h.tone},w(h.label),9,Ga))),128))])],2),m("div",{class:te(["file-change-panel",{"file-change-panel-visible":e.expanded}])},[m("div",Za,[m("ul",Ja,[(c(!0),f(W,null,K(e.summary.changes,h=>(c(),f("li",{key:`file-change:${e.summary.turnId}:${h.path}:${h.movedToPath||""}`,class:"file-change-item"},[m("span",{class:"file-change-badge","data-operation":u(Ht)(h),title:o.value(h)},w(u(Fo)(h)),9,Xa),m("span",Ya,[m("button",{type:"button",class:"file-change-path-button",title:h.path,onClick:g=>r.$emit("open-diff",h)},w(a.value(h.path)),9,Qa),h.movedToPath?(c(),f("span",ei,"→")):S("",!0),h.movedToPath?(c(),f("button",{key:1,type:"button",class:"file-change-path-button",title:h.movedToPath,onClick:g=>r.$emit("open-diff",h)},w(a.value(h.movedToPath)),9,ti)):S("",!0)]),h.addedLineCount>0||h.removedLineCount>0?(c(),f("span",ni,[(c(!0),f(W,null,K(u(Po)(h),g=>(c(),f("span",{key:`change-delta:${e.summary.turnId}:${h.path}:${g.tone}:${g.label}`,class:"file-change-signed-count","data-tone":g.tone},w(g.label),9,si))),128))])):S("",!0),e.actionable?(c(),f("button",{key:1,type:"button",class:"file-change-file-undo-button",title:i.value(h),"aria-label":i.value(h),onClick:g=>r.$emit("request-file-action",h)},[Q(Wt,{class:"icon-svg file-change-action-icon"})],8,oi)):S("",!0)]))),128))]),e.actionable?(c(),f("div",ai,[e.actionErrorText?(c(),f("p",ii,w(e.actionErrorText),1)):S("",!0),m("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:l[1]||(l[1]=h=>r.$emit("request-action",e.nextAction))},[Q(Wt,{class:te(["icon-svg file-change-action-icon",{"file-change-action-icon-redo":e.nextAction==="redo"}])},null,8,["class"]),ke(" "+w(e.actionLabel),1)],8,ri)])):S("",!0)])],2)],2)):S("",!0)}}),Ln=oe(li,[["__scopeId","data-v-851281a0"]]),ci=le({__name:"FileLinkContextMenu",props:{visible:{type:Boolean},x:{},y:{},browseUrl:{},editUrl:{}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,s=U(null),a=P(()=>({left:`${String(n.x)}px`,top:`${String(n.y)}px`}));function i(){o("close")}function r(){const y=n.browseUrl;i(),!(!y||y==="#")&&window.open(y,"_blank","noopener,noreferrer")}function l(){const y=n.editUrl;i(),!(!y||y==="#")&&window.open(y,"_blank","noopener,noreferrer")}async function h(){const y=n.browseUrl;if(i(),!(!y||y==="#"))try{await Rt(y)}catch{}}function g(y){if(!n.visible)return;const I=s.value;if(!I){i();return}const k=y.target;k instanceof Node&&I.contains(k)||i()}function b(){i()}function L(y){y.key==="Escape"&&i()}return $e(()=>n.visible,y=>{y?(window.addEventListener("pointerdown",g,!0),window.addEventListener("blur",b),window.addEventListener("keydown",L,!0)):(window.removeEventListener("pointerdown",g,!0),window.removeEventListener("blur",b),window.removeEventListener("keydown",L,!0))}),pt(()=>{window.removeEventListener("pointerdown",g,!0),window.removeEventListener("blur",b),window.removeEventListener("keydown",L,!0)}),(y,I)=>e.visible?(c(),f("div",{key:0,ref_key:"menuRef",ref:s,class:"file-link-context-menu",style:Je(a.value),onClick:I[0]||(I[0]=Ue(()=>{},["stop"]))},[m("button",{type:"button",class:"file-link-context-menu-item",onClick:r}," Open link "),m("button",{type:"button",class:"file-link-context-menu-item",onClick:h}," Copy link "),e.editUrl?(c(),f("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:l}," Edit file ")):S("",!0)],4)):S("",!0)}}),ui=oe(ci,[["__scopeId","data-v-9cda1d9d"]]),di=12e3,fi=240;function hi(e,{streaming:t,truncateStreaming:n=!0,maxChars:o=di,maxLines:s=fi}){if(!n)return e;let a=e,i=!1;if(o>0&&a.length>o&&(a=a.slice(-o),i=!0),s>0){const r=a.split(/\r?\n/);r.length>s&&(a=r.slice(-s).join(`
|
|
25
|
-
`),i=!0)}return i?`...
|
|
26
|
-
${a}`:a}const mi={class:"conversation-item conversation-item-overlay"},gi={class:"message-row"},pi={class:"message-stack"},vi={class:"live-overlay-inline","aria-live":"polite"},ki={class:"live-overlay-title-row"},yi={key:0,class:"live-overlay-spinner","aria-hidden":"true"},wi=["aria-expanded"],bi={class:"live-overlay-label"},Ci={class:"live-overlay-toggle","aria-hidden":"true"},$i={key:2,class:"live-overlay-label"},xi={key:0,class:"live-overlay-reasoning"},Ti={key:1,class:"live-overlay-error"},_i=["href"],Ii=le({__name:"LiveOverlayItem",props:{overlay:{},feedbackMailto:{}},setup(e){const t=e,{buildFeedbackMailto:n,recordVisibleFailure:o}=Vn(),{t:s}=me(),a=U(!0);function i(){a.value=!a.value}const r=P(()=>{var h;return hi(((h=t.overlay)==null?void 0:h.reasoningText)??"",{streaming:!0})});function l(h,g){o(g);const b=h.currentTarget;b instanceof HTMLAnchorElement&&(b.href=n())}return(h,g)=>{var b,L,y,I,k,E;return c(),f("li",mi,[m("div",gi,[m("div",pi,[m("article",vi,[m("div",ki,[(b=e.overlay)!=null&&b.errorText?S("",!0):(c(),f("span",yi)),(L=e.overlay)!=null&&L.reasoningText?(c(),f("button",{key:1,type:"button",class:"live-overlay-heading","aria-expanded":a.value,onClick:i},[m("span",bi,w((y=e.overlay)==null?void 0:y.activityLabel),1),m("span",Ci,w(a.value?"▾":"▸"),1)],8,wi)):(c(),f("p",$i,w((I=e.overlay)==null?void 0:I.activityLabel),1))]),(k=e.overlay)!=null&&k.reasoningText&&a.value?(c(),f("p",xi,w(r.value),1)):S("",!0),(E=e.overlay)!=null&&E.errorText?(c(),f("div",Ti,[m("span",null,w(e.overlay.errorText),1),m("a",{class:"live-overlay-feedback",href:e.feedbackMailto,onClick:g[0]||(g[0]=x=>l(x,e.overlay.errorText))},w(u(s)("Send feedback")),9,_i)])):S("",!0)])])])])}}}),Li=oe(Ii,[["__scopeId","data-v-b69a0020"]]),Mi={key:0},Ai={key:1,class:"message-bold-text"},Si={key:2,class:"message-italic-text"},Fi={key:3,class:"message-strikethrough-text"},Pi=["href","title"],Ei=["href","title"],Bi={key:6,class:"message-inline-code"},Ri=le({__name:"MessageInlineContent",props:{segments:{},toBrowseUrl:{type:Function}},setup(e){return(t,n)=>(c(!0),f(W,null,K(e.segments,(o,s)=>(c(),f(W,{key:s},[o.kind==="text"?(c(),f("span",Mi,w(o.value),1)):o.kind==="bold"?(c(),f("strong",Ai,w(o.value),1)):o.kind==="italic"?(c(),f("em",Si,w(o.value),1)):o.kind==="strikethrough"?(c(),f("s",Fi,w(o.value),1)):o.kind==="file"?(c(),f("a",{key:4,class:"message-file-link",href:e.toBrowseUrl(o.path),target:"_blank",rel:"noopener noreferrer",title:o.path},w(o.displayPath),9,Pi)):o.kind==="url"?(c(),f("a",{key:5,class:"message-file-link",href:o.href,target:"_blank",rel:"noopener noreferrer",title:o.href},w(o.value),9,Ei)):(c(),f("code",Bi,w(o.value),1))],64))),128))}}),He=oe(Ri,[["__scopeId","data-v-e81c51c6"]]),Oi={},Di={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Hi(e,t){return c(),f("svg",Di,[...t[0]||(t[0]=[m("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 Wi=oe(Oi,[["render",Hi]]),ji=["data-role"],qi=["aria-label","title"],Ui={key:0,class:"message-rollback-label"},Ni=["aria-label","title"],Vi={class:"message-fork-label"},zi=["data-copied","aria-label","title"],Ki={key:0,class:"message-copy-label"},Gi=le({__name:"MessageToolbar",props:{role:{},showEdit:{type:Boolean,default:!1},showFork:{type:Boolean,default:!1},showCopy:{type:Boolean,default:!1},copied:{type:Boolean,default:!1}},emits:["edit","fork","copy"],setup(e){const{t}=me();return(n,o)=>e.showEdit||e.showFork||e.showCopy?(c(),f("div",{key:0,class:"message-toolbar","data-role":e.role},[e.showEdit?(c(),f("button",{key:0,type:"button",class:"message-rollback-button","aria-label":u(t)("Rollback this message"),title:u(t)("Rollback this message"),onClick:o[0]||(o[0]=s=>n.$emit("edit"))},[Q(Wt,{class:"icon-svg message-rollback-icon"}),e.role!=="user"?(c(),f("span",Ui,w(u(t)("Rollback")),1)):S("",!0)],8,qi)):S("",!0),e.showFork?(c(),f("button",{key:1,type:"button",class:"message-fork-button","aria-label":u(t)("Fork thread from this response"),title:u(t)("Fork thread from this response"),onClick:o[1]||(o[1]=s=>n.$emit("fork"))},[Q(ko,{class:"icon-svg message-fork-icon"}),m("span",Vi,w(u(t)("Fork")),1)],8,Ni)):S("",!0),e.showCopy?(c(),f("button",{key:2,type:"button",class:"message-copy-button","data-copied":e.copied,"aria-label":e.copied?u(t)("Response copied"):u(t)("Copy response"),title:e.copied?u(t)("Response copied"):u(t)("Copy response"),onClick:o[2]||(o[2]=s=>n.$emit("copy"))},[Q(Wi,{class:"icon-svg message-copy-icon"}),e.role!=="user"?(c(),f("span",Ki,w(e.copied?"Copied":"Copy"),1)):S("",!0)],8,zi)):S("",!0)],8,ji)):S("",!0)}}),Zi=oe(Gi,[["__scopeId","data-v-59a7a725"]]),Ji="codex-web-local.process-fold.v1",Mn="codex:web-local:process-fold";function Pt(){return typeof localStorage>"u"?"auto":localStorage.getItem(Ji)==="expanded"?"expanded":"auto"}function Xi(e){const t=n=>e(n.detail);return window.addEventListener(Mn,t),()=>window.removeEventListener(Mn,t)}const Yi=["aria-expanded"],Qi={class:"process-fold-label"},er={class:"process-fold-toggle","aria-hidden":"true"},tr={key:0,class:"process-fold-body"},nr=le({__name:"ProcessFold",props:{label:{},running:{type:Boolean},hasOutsideContent:{type:Boolean}},setup(e){const t=e,n=U(Pt()==="expanded"||!t.hasOutsideContent),o=U(!1);let s=!1;const a=Xi(()=>{o.value=!1,Pt()==="expanded"?n.value=!0:!t.running&&t.hasOutsideContent&&(n.value=!1)});$e(()=>t.running,r=>{const l=s;s=r,r?(l||(o.value=!1),o.value||(n.value=!0)):l&&!o.value&&t.hasOutsideContent&&Pt()!=="expanded"&&(n.value=!1)},{immediate:!0}),pt(()=>a());function i(){o.value=!0,n.value=!n.value}return(r,l)=>(c(),f("div",{class:te(["process-fold",{"process-fold--open":n.value,"process-fold--running":e.running}])},[m("button",{type:"button",class:"process-fold-header","aria-expanded":n.value,onClick:i},[m("span",Qi,w(e.label),1),m("span",er,w(n.value?"▾":"▸"),1)],8,Yi),n.value?(c(),f("div",tr,[Pe(r.$slots,"default",{},void 0)])):S("",!0)],2))}}),sr=oe(nr,[["__scopeId","data-v-de9b3329"]]),or=["aria-label"],ar=["data-turn","aria-label","onClick"],ir={class:"question-jump-preview-text"},rr=2,Et="#3b82f6",lr=le({__name:"QuestionJumpBar",props:{anchors:{},activeTurn:{}},emits:["jump"],setup(e,{emit:t}){const n=e,o=t,{t:s}=me(),a=U(null),i=U(-1),r=U("0px"),l=P(()=>{const k=i.value;return k<0?null:n.anchors[k]??null});function h(k){var A;const E=n.activeTurn===((A=n.anchors[k])==null?void 0:A.turn),x={};if(i.value<0)return x.width=E?"18px":"12px",x.background=E?Et:void 0,x;const C=Math.abs(k-i.value);return x.width=C===0?"32px":C===1?"20px":C===2?"14px":E?"18px":"12px",x.background=C===0?Et:C===1?"rgba(59,130,246,0.6)":C===2?"rgba(59,130,246,0.35)":E?Et:void 0,x.transitionDelay=`${C*20}ms`,x}function g(k){const E=a.value;if(!E)return-1;const x=Array.from(E.querySelectorAll(".question-jump-item"));let C=-1,A=Number.POSITIVE_INFINITY;for(let _=0;_<x.length;_+=1){const R=x[_].getBoundingClientRect(),O=R.top+R.height/2,q=Math.abs(k-O);q<A&&(A=q,C=_)}return C}function b(k){var O;const E=g(k.clientY);if(E<0)return;i.value=E;const x=a.value;if(!x)return;const A=(O=Array.from(x.querySelectorAll(".question-jump-item"))[E])==null?void 0:O.getBoundingClientRect(),_=x.getBoundingClientRect();if(!A)return;const R=A.top+A.height/2;r.value=`${R-_.top}px`}function L(){i.value=-1}function y(k){const E=g(k.clientY),x=E>=0?n.anchors[E]:null;x&&o("jump",x.turn)}function I(k){o("jump",k.turn)}return(k,E)=>e.anchors.length>=rr?(c(),f("nav",{key:0,class:"question-jump-bar","aria-label":u(s)("Question navigation")},[m("div",{ref_key:"trackRef",ref:a,class:"question-jump-track",onMousemove:b,onMouseleave:L,onMousedown:y},[(c(!0),f(W,null,K(e.anchors,(x,C)=>(c(),f("button",{key:x.turn,type:"button",class:"question-jump-item","data-turn":x.turn,"aria-label":u(s)("Jump to question {n}",{n:x.turn+1}),onMousedown:E[0]||(E[0]=Ue(()=>{},["prevent"])),onClick:A=>I(x)},[m("span",{class:"question-jump-dot",style:Je(h(C))},null,4)],40,ar))),128))],544),l.value?(c(),f("div",{key:0,class:"question-jump-preview",role:"tooltip",style:Je({top:r.value})},[m("span",ir,w(l.value.text),1)],4)):S("",!0)],8,or)):S("",!0)}}),cr=oe(lr,[["__scopeId","data-v-96d087d4"]]),ur=["data-state"],dr=["aria-expanded"],fr={class:"reasoning-block-title"},hr={class:"reasoning-block-toggle","aria-hidden":"true"},mr={key:0,class:"reasoning-block-body"},gr={key:0,class:"reasoning-block-summary"},pr=["innerHTML"],vr=le({__name:"ReasoningBlock",props:{message:{},expanded:{type:Boolean},contentHtml:{}},emits:["toggle"],setup(e){const t=e,{t:n}=me(),o=P(()=>{var a;return(((a=t.message.reasoning)==null?void 0:a.summary)??[]).map(i=>i.trim()).filter(Boolean).join(`
|
|
27
|
-
`).trim()});return(s,a)=>(c(),f("div",{class:"reasoning-block","data-state":e.expanded?"expanded":"collapsed"},[m("button",{type:"button",class:"reasoning-block-header","aria-expanded":e.expanded,onClick:a[0]||(a[0]=i=>s.$emit("toggle"))},[m("span",fr,w(u(n)("Thinking process")),1),m("span",hr,w(e.expanded?"▾":"▸"),1)],8,dr),e.expanded?(c(),f("div",mr,[o.value?(c(),f("p",gr,w(o.value),1)):S("",!0),m("div",{class:"reasoning-block-content message-card",innerHTML:e.contentHtml},null,8,pr)])):S("",!0)],8,ur))}}),An=oe(vr,[["__scopeId","data-v-5fa90230"]]),kr=new Set(["read_file","ls","grep","glob","web_fetch","read_skill","code_index","connect_tool_source"]),yr=new Set(["write_file","edit_file","multi_edit","move_file","delete_range","delete_symbol","notebook_edit"]),wr=new Set(["task","run_skill","explore","research","review","security_review"]);function br(e){var n;const t=((n=e.toolCall)==null?void 0:n.tool)??"";return kr.has(t)?"readonly":yr.has(t)?"modify":wr.has(t)?"delegate":null}const Cr=2;function $r(e){var a;const t=[];let n=[],o=null;const s=()=>{if(o!==null&&n.length>=Cr)t.push({type:"batch",kind:o,messages:n});else for(const i of n)t.push({type:"tool",message:i});n=[],o=null};for(const i of e){if(i.messageType!=="toolCall"||((a=i.toolCall)==null?void 0:a.status)==="inProgress"){s(),t.push({type:"tool",message:i});continue}const r=br(i);if(r===null){s(),t.push({type:"tool",message:i});continue}o!==null&&o!==r&&s(),o=r,n.push(i)}return s(),t}function xr(e,t,n){const{t:o}=n;if(e==="readonly"){const s=t.filter(l=>{var h,g;return((h=l.toolCall)==null?void 0:h.tool)==="read_file"||((g=l.toolCall)==null?void 0:g.tool)==="ls"}).length,a=t.filter(l=>{var g;const h=((g=l.toolCall)==null?void 0:g.tool)??"";return h==="grep"||h==="glob"||h==="web_fetch"||h==="code_index"}).length,i=t.length-s-a,r=[];return s>0&&r.push(o("Read {n} files",{n:s})),a>0&&r.push(o("Search {n} files",{n:a})),i>0&&r.push(o("{n} read calls",{n:i})),r.join(" · ")}return e==="modify"?o("Modified {n} files",{n:t.length}):e==="delegate"?o("Delegated {n} tasks",{n:t.length}):o("Explored {n} items",{n:t.length})}const Tr={class:"message-row","data-role":"system"},_r={class:"message-stack","data-role":"system"},Ir=["title"],Lr={key:0,class:"tool-call-server"},Mr={class:"tool-call-name"},Ar={class:"tool-call-status"},Sr={key:0,class:"work-block-spinner","aria-hidden":"true"},Fr={key:1,class:"tool-call-status-icon","aria-hidden":"true"},Pr={key:2,class:"tool-call-status-icon","aria-hidden":"true"},Er=le({__name:"ToolCallRow",props:{message:{}},setup(e){const t=e,{t:n}=me(),o=P(()=>{const i=t.message.toolCall;if(!i)return"";switch(i.status){case"inProgress":return n("Running");case"failed":return n("Failed");default:return n("Done")}}),s=P(()=>{var i;switch((i=t.message.toolCall)==null?void 0:i.status){case"inProgress":return"tool-call-running";case"failed":return"tool-call-error";default:return"tool-call-ok"}}),a=P(()=>{const i=t.message.toolCall;if(!i)return"";const r=[];return i.server&&r.push(i.server),r.push(i.tool),i.error&&r.push(i.error),typeof i.durationMs=="number"&&i.durationMs>=0&&r.push(`${i.durationMs}ms`),r.join(" · ")});return(i,r)=>{var l,h,g,b;return c(),f("div",Tr,[m("div",_r,[m("div",{class:te(["tool-call-block",s.value]),title:a.value},[r[0]||(r[0]=m("span",{class:"tool-call-icon","aria-hidden":"true"},"🛠",-1)),(l=e.message.toolCall)!=null&&l.server?(c(),f("span",Lr,w(e.message.toolCall.server),1)):S("",!0),m("code",Mr,w(((h=e.message.toolCall)==null?void 0:h.tool)||e.message.text||"(tool)"),1),m("span",Ar,[((g=e.message.toolCall)==null?void 0:g.status)==="inProgress"?(c(),f("span",Sr)):((b=e.message.toolCall)==null?void 0:b.status)==="completed"?(c(),f("span",Fr,"✓")):(c(),f("span",Pr,"✗")),ke(" "+w(o.value),1)])],10,Ir)])])}}}),jt=oe(Er,[["__scopeId","data-v-e25278a7"]]),Br=["aria-expanded","title"],Rr={class:"tool-batch-toggle","aria-hidden":"true"},Or={class:"tool-batch-label"},Dr={class:"tool-batch-count"},Hr={key:0,class:"tool-batch-body"},Wr=le({__name:"ToolBatchBlock",props:{kind:{},messages:{}},setup(e){const t=e,{t:n}=me(),o=U(!1),s=P(()=>xr(t.kind,t.messages,{t:n})),a=P(()=>t.messages.map(i=>{var r;return((r=i.toolCall)==null?void 0:r.tool)??""}).join(" · "));return(i,r)=>(c(),f("div",{class:te(["tool-batch-block",{"tool-batch-block--open":o.value}])},[m("button",{type:"button",class:"tool-batch-head","aria-expanded":o.value,title:a.value,onClick:r[0]||(r[0]=l=>o.value=!o.value)},[m("span",Rr,w(o.value?"▾":"▸"),1),r[1]||(r[1]=m("span",{class:"tool-batch-icon","aria-hidden":"true"},"🛠",-1)),m("span",Or,w(s.value),1),m("span",Dr,w(e.messages.length),1)],8,Br),o.value?(c(),f("div",Hr,[(c(!0),f(W,null,K(e.messages,l=>(c(),se(jt,{key:l.id,message:l},null,8,["message"]))),128))])):S("",!0)],2))}}),jr=oe(Wr,[["__scopeId","data-v-908995a9"]]),qr=["data-turn-key"],Ur={key:0,class:"conversation-turn-request","aria-label":"User request"},Nr={class:"conversation-turn-items"},Vr={key:1,class:"conversation-turn-process","aria-label":"Turn process"},zr=["aria-expanded","aria-label"],Kr={key:2,class:"conversation-turn-time"},Gr={class:"conversation-turn-process-count"},Zr={key:1,class:"conversation-turn-process-heading"},Jr={key:0,class:"conversation-turn-time"},Xr={key:2,class:"conversation-turn-items conversation-turn-process-items"},Yr={key:2,class:"conversation-turn-final","aria-label":"Assistant final response"},Qr={class:"conversation-turn-items"},el=le({__name:"ThreadTurn",props:{turnKey:{},request:{},processItems:{default:()=>[]},finalItem:{},fileChangeAnchorIds:{default:()=>[]},durationMs:{},warm:{},warmItems:{default:()=>[]}},setup(e){const t=e,{t:n}=me(),o=U(!0),s=P(()=>t.processItems.length+t.fileChangeAnchorIds.length),a=P(()=>!!t.finalItem);return $e(s,(i,r)=>{i>r&&(o.value=!0)}),(i,r)=>e.warm?(c(),f(W,{key:0},[Pe(i.$slots,"warm-card",{warm:e.warm},void 0),(c(!0),f(W,null,K(e.warmItems,l=>Pe(i.$slots,"default",{key:l.message.id,item:l,section:"warm"},void 0)),128))],64)):(c(),f("li",{key:1,class:"conversation-turn","data-turn-key":e.turnKey},[e.request?(c(),f("section",Ur,[m("ol",Nr,[Pe(i.$slots,"default",{item:e.request,section:"request"},void 0)])])):S("",!0),s.value>0?(c(),f("section",Vr,[a.value?(c(),f("button",{key:0,class:"conversation-turn-process-heading conversation-turn-process-toggle",type:"button","aria-expanded":o.value,"aria-label":o.value?u(n)("Collapse turn process"):u(n)("Expand turn process"),onClick:r[0]||(r[0]=l=>o.value=!o.value)},[o.value?(c(),se(yo,{key:0,class:"conversation-turn-process-toggle-icon"})):(c(),se(zn,{key:1,class:"conversation-turn-process-toggle-icon"})),m("span",null,w(u(n)("Turn process")),1),e.durationMs!=null&&e.durationMs>0?(c(),f("span",Kr,w(u(Ot)(e.durationMs)),1)):S("",!0),m("span",Gr,w(u(n)("{n} process items",{n:s.value})),1)],8,zr)):(c(),f("div",Zr,[ke(w(u(n)("Turn process"))+" ",1),e.durationMs!=null&&e.durationMs>0?(c(),f("span",Jr,w(u(Ot)(e.durationMs)),1)):S("",!0)])),o.value?(c(),f("ol",Xr,[(c(!0),f(W,null,K(e.processItems,l=>Pe(i.$slots,"default",{key:l.message.id,item:l,section:"process"},void 0)),128)),(c(!0),f(W,null,K(e.fileChangeAnchorIds,l=>(c(),f("li",{key:`file-change-${l}`,class:"conversation-turn-row conversation-turn-file-change"},[Pe(i.$slots,"file-change",{anchorMessageId:l},void 0)]))),128))])):S("",!0)])):S("",!0),e.finalItem?(c(),f("section",Yr,[m("ol",Qr,[Pe(i.$slots,"default",{item:e.finalItem,section:"final"},void 0)])])):S("",!0)],8,qr))}}),tl=oe(el,[["__scopeId","data-v-03c06fab"]]),nl=["aria-expanded"],sl={class:"warm-turn__preview"},ol={key:0,class:"warm-turn__meta"},al={class:"warm-turn__content"},il={key:1,class:"warm-turn__assistant"},rl=le({__name:"WarmTurnCard",props:{userText:{},assistantPreview:{},toolCount:{},expanded:{type:Boolean}},emits:["toggle"],setup(e,{emit:t}){const n=t,{t:o}=me();function s(){n("toggle")}return(a,i)=>(c(),f("div",{class:te(["warm-turn",{"warm-turn--expanded":e.expanded}])},[m("button",{type:"button",class:"warm-turn__head","aria-expanded":e.expanded,onClick:s},[Q(zn,{class:te(["warm-turn__chevron",{"warm-turn__chevron--open":e.expanded}])},null,8,["class"]),m("span",sl,w(e.userText),1),e.toolCount>0?(c(),f("span",ol,w(u(o)("{n} tools",{n:e.toolCount})),1)):S("",!0)],8,nl),m("div",al,[e.expanded?Pe(a.$slots,"default",{},void 0,!0,0):e.assistantPreview?(c(),f("div",il,w(e.assistantPreview),1)):S("",!0)])],2))}}),ll=oe(rl,[["__scopeId","data-v-7e3ebbc7"]]),cl=["aria-expanded"],ul=["title"],dl={class:"work-block-command"},fl={class:"work-block-status"},hl={key:0,class:"work-block-spinner","aria-hidden":"true"},ml={key:1,class:"work-block-status-icon","aria-hidden":"true"},gl={key:2,class:"work-block-status-icon","aria-hidden":"true"},pl={class:"work-block-output-inner"},vl=["textContent"],kl=["textContent"],yl={key:0,class:"work-block-permission-hint",role:"note"},wl=le({__name:"WorkBlockItem",props:{command:{},stepIndex:{},expanded:{type:Boolean},compact:{type:Boolean},outputCondensed:{type:Boolean}},emits:["toggle"],setup(e){const t=e,{t:n}=me(),o=P(()=>{var l,h;const r=(l=t.command.commandExecution)==null?void 0:l.status;return r==="inProgress"?"cmd-status-running":r==="completed"&&((h=t.command.commandExecution)==null?void 0:h.exitCode)===0?"cmd-status-ok":"cmd-status-error"}),s=P(()=>{const r=t.command.commandExecution;if(!r)return"";switch(r.status){case"inProgress":return n("Running");case"completed":return r.exitCode===0?n("Done"):`${n("Exit")} ${r.exitCode??"?"}`;case"failed":return n("Failed");case"declined":return n("Declined");case"interrupted":return n("Stopped");default:return""}}),a=[/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],i=P(()=>{const r=t.command.commandExecution;if(!r||!(r.status==="failed"||r.status==="declined"||typeof r.exitCode=="number"&&r.exitCode!==0))return"";const h=r.aggregatedOutput??"";return!h||!a.some(g=>g.test(h))?"":n("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(r,l)=>{var h,g,b,L,y,I;return c(),f("div",{class:te(["work-block",[o.value,{"work-block-expanded":e.expanded,"work-block-compact":e.compact}]])},[m("button",{type:"button",class:"work-block-header","aria-expanded":e.expanded,onClick:l[0]||(l[0]=k=>r.$emit("toggle"))},[m("span",{class:"work-step-dot",title:`${u(n)("Step")} ${String(e.stepIndex+1)}`},w(e.stepIndex+1),9,ul),m("code",dl,w(u(n)("Command")),1),m("span",fl,[((h=e.command.commandExecution)==null?void 0:h.status)==="inProgress"?(c(),f("span",hl)):((g=e.command.commandExecution)==null?void 0:g.status)==="completed"&&((b=e.command.commandExecution)==null?void 0:b.exitCode)===0?(c(),f("span",ml,"✓")):((L=e.command.commandExecution)==null?void 0:L.status)==="failed"?(c(),f("span",gl,"✗")):S("",!0),ke(" "+w(s.value),1)])],8,cl),m("div",{class:te(["work-block-output-wrap",{"work-block-output-visible":e.expanded}])},[m("div",pl,[m("pre",{class:"work-block-output-command",textContent:w(((y=e.command.commandExecution)==null?void 0:y.command)||"(command)")},null,8,vl),m("pre",{class:te(["work-block-output",{"cmd-output-condensed":e.outputCondensed}]),textContent:w(((I=e.command.commandExecution)==null?void 0:I.aggregatedOutput)||"(no output)")},null,10,kl)])],2),i.value?(c(),f("p",yl,w(i.value),1)):S("",!0)],2)}}}),Sn=oe(wl,[["__scopeId","data-v-e9fdf684"]]),bl=2;function Fn(e){const t=e.messageType;return t==="commandExecution"||t==="toolCall"}function Cl(e){var n,o;return(((n=e.commandExecution)==null?void 0:n.status)??"")==="inProgress"||(((o=e.toolCall)==null?void 0:o.status)??"")==="inProgress"?!0:(e.messageType??"").endsWith(".live")}function $l(e){const t=[];let n=[],o="";const s=()=>{n.length>0&&(t.push(n),n=[])};for(const r of e){const l=r.turnId??"",h=Fn(r)&&l!=="";(!h||l!==o)&&(n.length>0&&s(),o=h?l:""),h&&n.push(r)}s();const a=new Map;for(const r of e)r.messageType==="worked"&&r.turnId&&typeof r.durationMs=="number"&&a.set(r.turnId,r.durationMs);const i=[];for(const r of t){if(r.length<bl)continue;const l=r[0].turnId??"";let h=0,g=0,b=0,L=!1;for(const I of r)I.messageType==="toolCall"?h+=1:I.messageType==="reasoning"?g+=1:I.messageType==="commandExecution"&&(b+=1),Cl(I)&&(L=!0);const y=e.some(I=>I.turnId===l&&!Fn(I));i.push({turnId:l,messages:r,running:L,toolCount:h,thoughtCount:g,commandCount:b,durationMs:a.get(l)??0,hasOutsideContent:y})}return i}function xl(e,t){const{t:n,formatDuration:o}=t,s=[];return e.running?s.push(n("Working…")):e.durationMs>0?s.push(o(e.durationMs)):s.push(n("Processed")),e.toolCount>0&&s.push(n("{n} tools",{n:e.toolCount})),e.thoughtCount>0&&s.push(n("{n} thoughts",{n:e.thoughtCount})),e.commandCount>0&&s.push(n("{n} commands",{n:e.commandCount})),s.join(" · ")}function Tl(e){return e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function _l(e,t=!1){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&(t||!((n=e.messageType)!=null&&n.endsWith(".live")))&&e.text.trim().length>0}function Il(e,t){var a,i;const n=[];let o=null;for(const r of e)(r.role==="user"||!o)&&(o={key:`turn-${r.id}`,items:[]},n.push(o)),o.items.push({message:r,kind:Tl(r)});const s=n.length-1;for(let r=0;r<n.length;r+=1){const l=n[r],h=(i=(a=l.items.find(y=>{var I;return(I=y.message.turnId)==null?void 0:I.trim()}))==null?void 0:a.message.turnId)==null?void 0:i.trim(),g=t!==void 0&&"liveTurnId"in t;if((t==null?void 0:t.liveOverlayActive)===!0&&(g?h===(t==null?void 0:t.liveTurnId):r===s))continue;const L=[...l.items].reverse().find(y=>_l(y.message,(t==null?void 0:t.liveOverlayActive)===!1));L&&((t==null?void 0:t.liveOverlayActive)!==!1&&l.items.some(I=>typeof I.message.messageType=="string"&&I.message.messageType.endsWith(".live"))||(L.kind="final-assistant"))}return n}function ts(e){return e.replace(/\s+/g," ").trim()}function Ll(e){const t=ts(e);return t.length<=80?t:t.slice(0,80)}function ns(e){const t=ts(e);return t.length<=80?t:t.slice(0,77)+"..."}function qt(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function vt(e,t){return e.sessionKey===t?e:qt(t)}function Ml(e,t){const n=vt(e,t);return{...n,coldPage:n.coldPage+1}}function Al(e,t,n){const o=vt(e,t),s=Math.max(0,Math.floor(n));return o.coldPage>=s?o:{...o,coldPage:s}}function Pn(e,t,n,o){const s=vt(e,t),a=new Set(s.expandedWarmTurns);return o?a.add(n):a.delete(n),{...s,expandedWarmTurns:a}}function Sl(e){return e.role==="user"}function Fl(e){var t;return((t=e.messageType)==null?void 0:t.endsWith(".live"))===!0}function Pl(e){var a;const t=[];let n=-1,o=0;const s=(i,r)=>{t.push({userItem:i,assistantPreview:"",toolCount:0,startIdx:r,endIdx:e.length})};for(let i=0;i<e.length;i+=1){const r=e[i];if(Sl(r)){if(n>=0)t[t.length-1].endIdx=i;else{t.push({userItem:r,assistantPreview:"",toolCount:0,startIdx:o,endIdx:e.length}),n=i,o=i;continue}n=i,s(r,i)}else if(n>=0&&t.length>0){const l=t[t.length-1],h=((a=r.text)==null?void 0:a.trim())||"";r.role==="assistant"&&!Fl(r)&&h&&(l.assistantPreview=ns(h)),r.messageType==="toolCall"&&(l.toolCount+=1)}}return t}function El({turnCount:e,hotTurns:t,pageSize:n,coldPage:o}){const s=Math.max(0,e),a=Math.max(0,t),i=Math.max(0,s-Math.min(s,a));if(i===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const r=Math.max(0,n),l=Math.max(0,Math.floor(o)),h=Math.min(i,r*(l+1));return{warmStartTurn:i-h,warmEndTurn:i,coldTurnCount:i-h}}function Bl({turn:e,turnCount:t,hotTurns:n,pageSize:o}){const s=Math.max(0,t),a=Math.max(0,n),i=Math.max(0,s-Math.min(s,a));if(i===0||e>=i)return 0;const r=Math.max(1,o),l=Math.max(0,Math.floor(e)),h=i-l;return Math.max(0,Math.ceil(h/r)-1)}function En(e,t,n){if(t.length===0)return e.slice(0);if(n>=t.length)return[];const o=t[n].startIdx;return e.slice(o)}function Rl(e){const t={};for(const n of e)n.messageType==="worked"&&n.turnId&&typeof n.durationMs=="number"&&(t[n.turnId]=(t[n.turnId]??0)+n.durationMs);return t}function Ol(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;if(t.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(t)}`;const n=t.startsWith("/"),o=/^[A-Za-z]:[\\/]/u.test(t);return n||o?`/codex-local-image?path=${encodeURIComponent(t)}`:t}function qe(e,t={}){const n=[],o=/codex:\/\/threads\/[A-Za-z0-9-]+|https?:\/\/[^\s<>"'`,。;:!?、()[\]{}「」『』《》]+|file:\/\/[^\n<>"'`,。;:!?、[\]{}「」『』《》]+|["'](?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^\n"']+["']|`(?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^`\n]+`/gu;let s=0;for(const a of e.matchAll(o)){if(typeof a.index!="number")continue;const i=a.index,r=i+a[0].length;let l=a[0],h="";for(;/[.,;:!?,。;:!?、]$/u.test(l);)h=l.slice(-1)+h,l=l.slice(0,-1);const g=Zn(e,i,r,s,l),b=(g==null?void 0:g.segmentStart)??i,L=(g==null?void 0:g.segmentEnd)??r;b>s&&n.push({kind:"text",value:e.slice(s,b)}),g!=null&&g.tokenEndTrim&&(l=l.slice(0,-g.tokenEndTrim));const y=ht(l);l=y.core;const I=y.leading,k=y.trailing+h;I&&n.push({kind:"text",value:I});const E=mt(l);if(E)n.push({kind:"url",value:E,href:E}),k&&n.push({kind:"text",value:k});else if(l.startsWith("**")&&l.endsWith("**")&&l.length>4)n.push({kind:"bold",value:l.slice(2,-2)}),k&&n.push({kind:"text",value:k});else if(/^https?:\/\//u.test(l))n.push({kind:"url",value:l,href:l}),k&&n.push({kind:"text",value:k});else{const x=Xe(l);x?(n.push({kind:"file",value:l,path:x.path,displayPath:l,downloadName:ft(x.path)}),k&&n.push({kind:"text",value:k})):n.push({kind:"text",value:a[0]})}s=L}return s<e.length&&n.push({kind:"text",value:e.slice(s)}),t.applyMarkdownMarkers===!1?n:ss(n)}function Bt(e,t){const n=[];let o=!1,s="";const a=i=>{i&&n.push({kind:"text",value:i})};for(const i of e){if(i.kind!=="text"){o&&(a(`${t.marker}${s}`),o=!1,s=""),n.push(i);continue}let r=i.value;for(;r.length>0;){const l=r.indexOf(t.marker);if(l<0){o?s+=r:a(r);break}const h=r.slice(0,l);if(o?s+=h:a(h),r=r.slice(l+t.marker.length),o){const g=s;g.length>0&&(!t.isValidContent||t.isValidContent(g))?n.push({kind:t.kind,value:g}):a(`${t.marker}${g}${t.marker}`),s="",o=!1}else o=!0}}return o&&a(`${t.marker}${s}`),n}function ss(e){const t=o=>o.trim().length>0&&!/^\s/u.test(o)&&!/\s$/u.test(o);let n=Bt(e,{marker:"**",kind:"bold",isValidContent:t});return n=Bt(n,{marker:"~~",kind:"strikethrough",isValidContent:t}),n=Bt(n,{marker:"*",kind:"italic",isValidContent:t}),n}function Dl(e,t={}){const n=[];let o=0,s=0;const a=(i,r)=>{let l=i.indexOf("[",r);for(;l>=0;){const h=i.indexOf("]",l+1);if(h<0)return null;if(i[h+1]!=="("){l=i.indexOf("[",l+1);continue}let g=1,b=h+2,L=!1;for(;b<i.length;){const y=i[b];if(y===`
|
|
28
|
-
`){L=!0;break}if(y==="("&&(g+=1),y===")"&&(g-=1,g===0)){const I=i.slice(l,b+1);if(Dt(I))return{start:l,end:b+1,token:I};break}b+=1}if(L){l=i.indexOf("[",l+1);continue}l=i.indexOf("[",l+1)}return null};for(;s<e.length;){const i=a(e,s);if(!i)break;const{start:r,end:l,token:h}=i,g=Zn(e,r,l,o,h),b=(g==null?void 0:g.segmentStart)??r,L=(g==null?void 0:g.segmentEnd)??l;b>o&&n.push(...qe(e.slice(o,b),t));const y=Dt(h);if(!y){n.push(...qe(e.slice(b,L),t)),o=L,s=L;continue}const I=y.label,k=y.target,E=mt(k);if(E)n.push({kind:"url",value:I||E,href:E});else if(/^https?:\/\//u.test(k))n.push({kind:"url",value:I||k,href:k});else{const x=Xe(k);x?n.push({kind:"file",value:k,path:x.path,displayPath:I||k,downloadName:ft(x.path)}):n.push({kind:"text",value:h})}o=L,s=L}return o<e.length&&n.push(...qe(e.slice(o),t)),n}function Hl(e){const t=e.includes("`"),n=Dl(e,{applyMarkdownMarkers:!t});if(!t)return n;if(!n.some(s=>s.kind==="text"&&s.value.includes("`")))return ss(n);const o=s=>{if(!s.includes("`"))return qe(s);const a=[];let i=0,r=0;for(;i<s.length;){if(s[i]!=="`"){i+=1;continue}let l=1;for(;i+l<s.length&&s[i+l]==="`";)l+=1;const h="`".repeat(l);let g=i+l,b=-1;for(;g<s.length;){const y=s.indexOf(h,g);if(y<0)break;const I=y>0&&s[y-1]==="`",k=y+l<s.length&&s[y+l]==="`",E=s.slice(i+l,y).includes(`
|
|
29
|
-
`);if(!I&&!k&&!E){b=y;break}g=y+1}if(b<0){i+=l;continue}i>r&&a.push(...qe(s.slice(r,i)));const L=s.slice(i+l,b);if(L.length>0){const y=Dt(L);if(y){const I=mt(y.target);if(I)a.push({kind:"url",value:y.label||I,href:I});else if(/^https?:\/\//u.test(y.target))a.push({kind:"url",value:y.label||y.target,href:y.target});else{const k=Xe(y.target);k?a.push({kind:"file",value:y.target,path:k.path,displayPath:y.label||y.target,downloadName:ft(k.path)}):a.push({kind:"code",value:L})}}else{const I=mt(L);if(I)a.push({kind:"url",value:I,href:I});else if(/^https?:\/\/[^\s]+$/u.test(L))a.push({kind:"url",value:L,href:L});else{const k=Xe(L);if(k){const E=k.line?`${k.path}:${String(k.line)}`:k.path;a.push({kind:"file",value:L,path:k.path,displayPath:E,downloadName:ft(k.path)})}else a.push({kind:"code",value:L})}}}else a.push({kind:"text",value:`${h}${h}`});i=b+l,r=i}return r<s.length&&a.push(...qe(s.slice(r))),a};return n.flatMap(s=>s.kind==="text"?o(s.value):[s])}function os(e){return e.replace(/\r\n/gu,`
|
|
30
|
-
`)}function xe(e){var n;return(((n=e.match(/^\s*/u))==null?void 0:n[0])??"").replace(/\t/gu," ").length}function as(e,t){if(t<=0)return e.trimStart();let n=0,o=0;for(;n<e.length&&o<t;){const s=e[n];o+=s===" "?4:1,n+=1}return e.slice(n)}function Te(e){return e.trim().length===0}function Ut(e){const t=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return t?{level:t[1].length,value:t[2].trim()}:null}function ut(e){const t=e.match(/^\s{0,3}>\s?(.*)$/u);return t?t[1]??"":null}function Ye(e){var n;const t=e.match(/^\s*[-*+]\s+(.+)$/u);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function Wl(e){var n;const t=e.match(/^(\s*)[-*+]\s+(.+)$/u);return t?{indent:xe(t[1]??""),text:((n=t[2])==null?void 0:n.trim())??""}:null}function Qe(e){var n;const t=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{checked:(t[1]??" ").toLowerCase()==="x",text:((n=t[2])==null?void 0:n.trim())??""}:null}function Bn(e){var n;const t=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{indent:xe(t[1]??""),item:{checked:(t[2]??" ").toLowerCase()==="x",text:((n=t[3])==null?void 0:n.trim())??""}}:null}function is(e){var n;const t=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return t?{indent:xe(t[1]??""),start:Number.parseInt(t[2]??"1",10)||1,text:((n=t[3])==null?void 0:n.trim())??""}:null}function Nt(e){var t;return((t=is(e))==null?void 0:t.text)??null}function Rn(e){return is(e)}function Vt(e){const t=e.trim();if(!t.includes("|"))return null;let n=t;n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const o=[];let s="",a=0;for(let i=0;i<n.length;i+=1){const r=n[i];if(r==="\\"&&n[i+1]==="|"){s+="|",i+=1;continue}if(r==="`"){let l=1;for(;n[i+l]==="`";)l+=1;s+=n.slice(i,i+l),a===0?a=l:a===l&&(a=0),i+=l-1;continue}if(r==="|"&&a===0){o.push(s.trim()),s="";continue}s+=r}return o.push(s.trim()),o.some(i=>i.length>0)?o:null}function jl(e){const t=Vt(e);if(!t||t.length===0)return null;const n=t.map(o=>{const s=o.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(s))return null;const a=s.startsWith(":"),i=s.endsWith(":");return a&&i?"center":i?"right":a?"left":null});return n.every((o,s)=>o!==null||/^-+$/u.test(t[s].replace(/\s+/gu,"")))?n:null}function On(e,t){return e.length===t?e:e.length>t?e.slice(0,t):[...e,...Array.from({length:t-e.length},()=>"")]}function Dn(e,t){var g;if(t+1>=e.length)return null;const n=e[t],o=e[t+1],s=Vt(n),a=jl(o);if(!s||!a||s.length!==a.length)return null;const i=n.trim();if(!i.startsWith("|")&&(((g=i.match(/\|/gu))==null?void 0:g.length)??0)<2)return null;const r=s.length,l=[];let h=t+2;for(;h<e.length&&!Te(e[h]);){const b=Vt(e[h]);if(!b)break;l.push(On(b,r)),h+=1}return{kind:"table",headers:On(s,r),rows:l,alignments:a}}function ql(e){return Te(e)||gt(e)!==null||zt(e)||Ut(e)!==null||ut(e)!==null||Qe(e)!==null||Ye(e)!==null||Nt(e)!==null}function Ul(e,t,n=-1){const o=[];let s=t;for(;s<e.length&&!(ql(e[s])||n>=0&&xe(e[s])<=n);)o.push(n>=0?as(e[s],n+1):e[s]),s+=1;const a=o.join(`
|
|
31
|
-
`).trim();return a?{value:a,nextIndex:s}:null}function rs(e,t){for(let n=t;n<e.length;n+=1)if(!Te(e[n]))return n;return-1}function Nl(e,t,n,o=null,s=!1){const a=[];let i=t;for(;i<e.length;){const r=e[i];if(Te(r)){const b=rs(e,i+1);if(b===-1){a.push(""),i=e.length;break}const L=o==null?void 0:o(e[b]);if(L&&L.indent===n||xe(e[b])<=n)break;a.push(""),i+=1;continue}const l=o==null?void 0:o(r);if(l&&l.indent===n)break;const h=xe(r),g=s&&(Qe(r)!==null||Ye(r)!==null);if(h<=n&&!g)break;a.push(h>n?as(r,n+1):r.trimStart()),i+=1}for(;a.length>0&&Te(a[0]);)a.shift();for(;a.length>0&&Te(a[a.length-1]);)a.pop();return a.length===0?null:{blocks:dt(a.join(`
|
|
32
|
-
`)),nextIndex:i}}function Hn(e,t,n,o=!1){const s=[];let a=t;const i=n(e[t]);if(!i)return null;const r=i.indent;for(;a<e.length;){const l=n(e[a]);if(l===null||l.indent!==r)break;const h=[l.text],g=[];for(a+=1;a<e.length;){if(Te(e[a])){const k=rs(e,a+1);if(k===-1){a=e.length;break}const E=n(e[k]);if(E&&E.indent===r){a=k;break}if(xe(e[k])<=r){a=k;break}a+=1;continue}const b=n(e[a]);if(b&&b.indent===r)break;const L=xe(e[a])>r,y=o&&(Qe(e[a])!==null||Ye(e[a])!==null);if(L||y){const k=Nl(e,a,r,n,o);if(k){g.push(...k.blocks),a=k.nextIndex;continue}}if(xe(e[a])<=r)break;const I=Ul(e,a,r);if(!I)break;h.push(I.value),a=I.nextIndex}s.push(g.length>0?{paragraphs:h,children:g}:{paragraphs:h})}return s.length>0?{items:s,nextIndex:a}:null}function zt(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}function gt(e){const t=e.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return t?{marker:t[1],language:(t[2]??"").trim()}:null}function dt(e){var a;const n=os(e).split(`
|
|
33
|
-
`),o=[];let s=0;for(;s<n.length;){if(Te(n[s])){s+=1;continue}const i=gt(n[s]);if(i){s+=1;const k=[];for(;s<n.length;){if(n[s].trim()===i.marker){s+=1;break}k.push(n[s]),s+=1}o.push({kind:"codeBlock",language:i.language,value:k.join(`
|
|
34
|
-
`)});continue}if(zt(n[s])){o.push({kind:"thematicBreak"}),s+=1;continue}const r=Ut(n[s]);if(r){o.push({kind:"heading",level:r.level,value:r.value}),s+=1;continue}if(ut(n[s])!==null){const k=[];for(;s<n.length;){const E=ut(n[s]);if(E===null)break;k.push(E),s+=1}o.push({kind:"blockquote",value:k.join(`
|
|
35
|
-
`).trim()});continue}const h=Dn(n,s);if(h){o.push(h),s+=2+h.rows.length;continue}if(Qe(n[s])!==null){const k=[],E=((a=Bn(n[s]))==null?void 0:a.indent)??0;for(;s<n.length;){const x=Bn(n[s]);if(x===null||x.indent!==E)break;k.push(x.item),s+=1}if(k.length>0){o.push({kind:"taskList",items:k});continue}}const b=Ye(n[s]);if(b!==null){const k=Hn(n,s,Wl);if(k){o.push({kind:"unorderedList",items:k.items}),s=k.nextIndex;continue}if(b.length>0){o.push({kind:"unorderedList",items:[{paragraphs:[b]}]}),s+=1;continue}}const L=Nt(n[s]);if(L!==null){const k=Rn(n[s]),E=Hn(n,s,Rn,!0);if(E){o.push({kind:"orderedList",items:E.items,start:(k==null?void 0:k.start)??1}),s=E.nextIndex;continue}if(L.length>0){o.push({kind:"orderedList",items:[{paragraphs:[L]}],start:(k==null?void 0:k.start)??1}),s+=1;continue}}const y=[];for(;s<n.length&&!(Te(n[s])||gt(n[s])||zt(n[s])||Ut(n[s])||Dn(n,s)||ut(n[s])!==null||Qe(n[s])!==null||Ye(n[s])!==null||Nt(n[s])!==null);)y.push(n[s]),s+=1;const I=y.join(`
|
|
36
|
-
`).trim();I&&o.push({kind:"paragraph",value:I})}return o}function Vl(e){if(!e.includes(")return dt(e);const t=[],n=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let o=0;for(const s of e.matchAll(n)){const[a,i,r]=s;if(typeof s.index!="number")continue;const l=s.index,h=l+a.length,g=Ol(r.trim());g&&(l>o&&t.push(...dt(e.slice(o,l))),t.push({kind:"image",url:g,alt:i.trim(),markdown:a}),o=h)}return o<e.length&&t.push(...dt(e.slice(o))),t}function Wn(e){const n=os(e).split(`
|
|
37
|
-
`),o=[];let s=0,a=0;const i=r=>{if(r<=a)return;const l=n.slice(a,r).join(`
|
|
38
|
-
`);o.push(...Vl(l))};for(;s<n.length;){const r=gt(n[s]);if(!r){s+=1;continue}i(s),s+=1;const l=[];for(;s<n.length;){if(n[s].trim()===r.marker){s+=1;break}l.push(n[s]),s+=1}o.push({kind:"codeBlock",language:r.language,value:l.join(`
|
|
39
|
-
`)}),a=s}return i(n.length),o.length>0?o:[{kind:"paragraph",value:e}]}const zl=300,Kl=1200,Gl=300,Zl=250;function Jl(e){const{getCwd:t,isVideoMediaUrl:n}=e,o=U(null),s=U(0);let a=null;const i=new Map,r=new Map,l=new Map,h=new Map;function g($,M,D,G){for($.has(M)&&$.delete(M),$.set(M,D);$.size>G;){const ae=$.keys().next().value;if(ae===void 0)break;$.delete(ae)}return D}function b(){return o.value?Promise.resolve():(a||(a=wo(()=>import("./common-BeuopZEI.js"),[]).then($=>{o.value=$.default,h.clear(),l.clear(),s.value+=1}).finally(()=>{a=null})),a)}function L(){return!!o.value}function y($){const M=r.get($);return M?(r.delete($),r.set($,M),M):g(r,$,Hl($),Kl)}function I($){const M=$.trim();if(!M)return"#";const D=N=>N.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(N),G=Xe(M),ae=(G==null?void 0:G.path)??M,B=Gn(ae,t());if(D(B)){const N=B.startsWith("/")?B:`/${B}`;return`/codex-local-browse${encodeURI(N)}`}return"#"}function k($){const M=$.trim();if(!M)return"";try{const D=new URL(M,window.location.href);return D.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${D.pathname.slice(19)}`}${D.search}${D.hash}`:""}catch{return""}}function E($){const M=i.get($.id);if(M&&M.text===$.text&&M.cwd===t())return i.delete($.id),i.set($.id,M),M.blocks;const D=Wn($.text);return g(i,$.id,{text:$.text,cwd:t(),blocks:D},zl).blocks}function x($){return $.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}function C($){var D;const M=((D=$.trim().split(/\s+/u)[0])==null?void 0:D.toLowerCase())??"";return M?Yn[M]??M:""}function A($,M){const D=C($);if(!D)return x(M);const G=o.value;if(!G)return x(M);try{if(G.getLanguage(D))return G.highlight(M,{language:D,ignoreIllegals:!0}).value}catch{}return x(M)}function _($,M){return St(R($,M))}function R($,M){const D=`${s.value}\0${C($)}\0${$}\0${M}`,G=h.get(D);return G!==void 0?(h.delete(D),h.set(D,G),G):g(h,D,A($,M),Zl)}function O($){return y($).map(M=>M.kind==="text"?x(M.value):M.kind==="bold"?`<strong class="message-bold-text">${x(M.value)}</strong>`:M.kind==="italic"?`<em class="message-italic-text">${x(M.value)}</em>`:M.kind==="strikethrough"?`<s class="message-strikethrough-text">${x(M.value)}</s>`:M.kind==="file"?`<a class="message-file-link" href="${x(I(M.path))}" target="_blank" rel="noopener noreferrer" title="${x(M.path)}">${x(M.displayPath)}</a>`:M.kind==="url"?`<a class="message-file-link" href="${x(M.href)}" target="_blank" rel="noopener noreferrer" title="${x(M.href)}">${x(M.value)}</a>`:`<code class="message-inline-code">${x(M.value)}</code>`).join("")}function q($){return $.paragraphs.map(M=>`<div class="message-list-item-text message-list-item-paragraph">${O(M)}</div>`).join("")}function ee($){var G;const M=q($),D=((G=$.children)==null?void 0:G.map(ae=>fe(ae)).join(""))??"";return St(M+D)}function V($){return $?` style="text-align:${$}"`:""}function fe($){if($.kind==="paragraph")return`<p class="message-text">${O($.value)}</p>`;if($.kind==="heading"){const M=Math.min(6,Math.max(1,Math.trunc($.level))),D=Jn(M),G=`message-heading ${Xn(M)}`;return`<${D} class="${G}">${O($.value)}</${D}>`}if($.kind==="blockquote")return`<blockquote class="message-blockquote">${O($.value)}</blockquote>`;if($.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${$.items.map(D=>`<li class="message-list-item"><div class="message-list-item-content">${ee(D)}</div></li>`).join("")}</ul>`;if($.kind==="taskList")return`<ul class="message-list message-task-list">${$.items.map(D=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${D.checked?"true":"false"}">${D.checked?"☑":"☐"}</span><div class="message-list-item-text">${O(D.text)}</div></li>`).join("")}</ul>`;if($.kind==="orderedList"){const M=$.items.map(D=>`<li class="message-list-item"><div class="message-list-item-content">${ee(D)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${$.start}">${M}</ol>`}if($.kind==="table"){const M=$.headers.map((ae,B)=>`<th class="message-table-head-cell"${V($.alignments[B]??null)}>${O(ae)}</th>`).join(""),D=$.rows.map(ae=>'<tr class="message-table-body-row">'+ae.map((B,N)=>`<td class="message-table-cell"${V($.alignments[N]??null)}>${O(B)}</td>`).join("")+"</tr>").join(""),G=D?`<tbody>${D}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${M}</tr></thead>${G}</table></div>`}return $.kind==="codeBlock"?`<div class="message-code-block">${$.language?`<div class="message-code-language">${x($.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${_($.language,$.value)}</code></pre></div>`:$.kind==="thematicBreak"?'<hr class="message-divider">':n($.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${x($.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${x($.url)}" alt="${x($.alt||"Embedded message image")}" loading="lazy">`}function Re($){const M=`${t()}\0${s.value}\0${$}`,D=l.get(M);if(D&&D.text===$&&D.cwd===t()&&D.highlightVersion===s.value)return l.delete(M),l.set(M,D),D.html;const G=Wn($).map(B=>fe(B)).join(""),ae=St(G);return g(l,M,{text:$,cwd:t(),highlightVersion:s.value,html:ae},Gl).html}function ze(){i.clear(),r.clear(),l.clear(),h.clear()}return{highlightCacheVersion:s,hasHighlightLoaded:L,ensureHighlightJsLoaded:b,getInlineSegments:y,toBrowseUrl:I,toEditUrlFromBrowseHref:k,getMessageBlocks:E,renderListItemContentAsHtml:ee,renderCachedHighlightedCodeAsHtml:_,renderMarkdownBlocksAsHtml:Re,clearRenderCaches:ze}}const Xl={key:0,class:"conversation-switching-bar",role:"status"},Yl={key:1,class:"conversation-loading"},Ql={key:2,class:"conversation-empty"},ec={key:0,class:"conversation-load-more"},tc=["disabled"],nc={key:1,class:"conversation-load-more conversation-warm-collapse"},sc=["disabled"],oc=["id"],ac={class:"message-row","data-role":"system"},ic={class:"message-stack","data-role":"system"},rc={class:"message-row","data-role":"system","data-message-type":"fileChange"},lc={class:"message-stack","data-role":"system"},cc={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},uc={class:"message-row","data-role":"system"},dc={class:"message-stack","data-role":"system"},fc={key:0,class:"work-block-list"},hc=["id","data-role","data-message-type"],mc={key:0,class:"message-row thread-compaction-row","data-role":"system"},gc={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},pc={key:1,class:"message-row thread-compaction-row","data-role":"system"},vc={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},kc={key:2,class:"message-row","data-role":"system"},yc={class:"message-stack","data-role":"system"},wc={class:"work-block-list"},bc=["data-role","data-message-type"],Cc=["data-role"],$c=["data-role"],xc={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},Tc={class:"message-stack","data-role":"system"},_c={class:"thread-plan-record"},Ic={class:"thread-plan-record-header"},Lc={key:0,class:"thread-plan-record-explanation"},Mc={key:1,class:"thread-plan-record-steps"},Ac=["data-status"],Sc={class:"thread-plan-record-marker","aria-hidden":"true"},Fc=["data-role","data-message-type"],Pc=["data-role"],Ec=["data-role"],Bc=["data-role"],Rc=["onClick"],Oc=["src"],Dc=["src","alt"],Hc={key:1,class:"message-file-attachments"},Wc=["href","title"],jc={key:2,class:"message-skill-attachments"},qc=["href","title"],Uc={class:"message-skill-chip-prefix"},Nc={class:"message-skill-chip-name"},Vc=["data-role"],zc={key:0,class:"automation-message-label"},Kc={key:0},Gc={key:1,class:"work-summary-wrap","aria-live":"polite"},Zc={class:"work-summary-text"},Jc={key:0,class:"message-text"},Xc={key:2,class:"message-blockquote"},Yc={key:3,class:"message-list message-list-unordered"},Qc=["innerHTML"],eu={key:4,class:"message-list message-task-list"},tu=["data-checked"],nu={class:"message-list-item-text"},su=["start"],ou=["innerHTML"],au={key:6,class:"message-table-wrap"},iu={class:"message-table"},ru={key:0},lu={key:7,class:"message-code-block"},cu={key:0,class:"message-code-language"},uu={class:"message-code-pre"},du=["innerHTML"],fu={key:8,class:"message-divider"},hu={key:9,class:"message-text"},mu=["onClick"],gu=["src"],pu=["src","alt","onError"],vu=["href","onClick"],ku=["title","aria-label"],yu=["aria-label"],wu=["src"],bu=["src","alt"],Cu=16,jn=30,qn=20,$u=200,xu=le({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},liveTurnId:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},hasMorePersistedAbove:{type:Boolean},isLoadingPersistedAbove:{type:Boolean},loadEarlierMessages:{type:Function}},emits:["forkThread","rollback","respondServerRequest","fileChangesChanged"],setup(e,{expose:t,emit:n}){function o(d){return Oo(d,a.cwd,J)}function s(d){return Ve(d,a.cwd)}const a=e,i=Jl({getCwd:()=>a.cwd,isVideoMediaUrl:lt}),{highlightCacheVersion:r,hasHighlightLoaded:l,ensureHighlightJsLoaded:h,getInlineSegments:g,toBrowseUrl:b,toEditUrlFromBrowseHref:L,getMessageBlocks:y,renderListItemContentAsHtml:I,renderCachedHighlightedCodeAsHtml:k,renderMarkdownBlocksAsHtml:E,clearRenderCaches:x}=i,C=Go({getMessages:()=>a.messages,getLiveOverlay:()=>a.liveOverlay,isCommandMessage:tt}),{hiddenGroupedCommandIds:A,isCommandExpanded:_,isCommandCompact:R,isCommandOutputCondensed:O,toggleCommandExpand:q,getWorkBlockCommands:ee,pruneCommandIdSets:V}=C,fe=Jo({toEditUrlFromBrowseHref:L}),{isFileLinkContextMenuVisible:Re,fileLinkContextMenuX:ze,fileLinkContextMenuY:$,fileLinkContextBrowseUrl:M,fileLinkContextEditUrl:D,handleConversationContextMenu:G,closeFileLinkContextMenu:ae}=fe,{isMobile:B}=bo(),N=zo({getMessages:()=>a.messages,getLiveTurnId:()=>a.liveTurnId??"",isFileChangeMessage:Qt,isCopyableAssistantMessage:en,isReasoningMessage:yt,isPlanMessage:kt,isFoldMember:pn,getHiddenGroupedCommandIds:()=>A.value,isMobile:()=>B.value}),{anchoredFileChangeSummaryByAnchorId:ue,hiddenFileChangeMessageIds:ye,isDiffViewerFileListOpen:ie,diffViewerChanges:re,activeDiffViewerChange:ge,activeDiffViewerLines:j,toggleFileChangeSummary:pe,isFileChangeSummaryExpanded:_e,openDiffViewer:et,closeDiffViewer:Ie,toggleDiffViewerFileList:ls,closeDiffViewerFileList:cs,selectDiffViewerChange:us,readAnchoredFileChangeSummaryById:ve,isFileChangeSummaryExpandedById:ds,toggleFileChangeSummaryById:fs,readStandaloneFileChangeSummary:we,isFileChangeSummaryVisible:Gt,pruneFileChangeSummaryIds:hs}=N,ms=Ko({getMessages:()=>a.messages,isCopyableAssistantMessage:en,isPlanMessage:kt,planStepCopyMarker:vn,buildFileChangeCopyText:o,getAnchoredFileChangeSummaries:()=>ue.value}),{copiedResponseAnchorId:gs,forkableTurnIndexByAnchorId:ps,showCopyResponseButton:vs,isCopyableUserMessage:ks,copyUserMessage:ys,showForkResponseButton:ws,copyResponse:bs}=ms,{buildFeedbackMailto:Cs,feedbackMailtoBase:$s,recordVisibleFailure:xs}=Vn(),{t:J}=me(),Zt=$s();function Ts(d,p){xs(p);const F=d.currentTarget;F instanceof HTMLAnchorElement&&(F.href=Cs())}function tt(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function _s(d){return d.messageType==="compaction.pending"}function Is(d){return d.messageType==="compaction.done"}function kt(d){return d.messageType==="plan"||d.messageType==="plan.live"}function yt(d){return d.messageType==="reasoning"&&!!d.reasoning}const wt=U(new Set);function Jt(d){return wt.value.has(d.id)}function Xt(d){const p=new Set(wt.value);p.has(d.id)?p.delete(d.id):p.add(d.id),wt.value=p}function Yt(d){return d.messageType==="toolCall"&&!!d.toolCall}function Ls(d){return d.messageType==="turnError"}function Qt(d){return d.messageType==="fileChange"&&d.fileChangeStatus==="completed"&&Array.isArray(d.fileChanges)&&d.fileChanges.length>0}function en(d){return d.role==="assistant"&&!tt(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const bt=n,Le=U(null),tn=U(null),Ms=Xo({isVideo:lt}),{modalImageUrl:nt,modalIsVideo:As,markdownImageFailureVersion:Ss,isMarkdownImageFailed:Fs,onMarkdownImageError:Ps,openImageModal:nn,closeImageModal:st}=Ms,Es=Zo({getActiveThreadId:()=>a.activeThreadId,getCwd:()=>a.cwd,onFileChangesChanged:()=>bt("fileChangesChanged",a.activeThreadId),updateThreadFileChanges:To,t:J}),{fileChangeActionKey:sn,isFileChangeActionable:on,fileChangeActionStatus:an,fileChangeActionErrorText:rn,fileChangeNextAction:ln,fileChangeActionLabel:cn,runFileChangeAction:Bs,resetFileChangeActions:Rs}=Es,Ce=U(null),Os=P(()=>{const d=Ce.value;return d?d.kind==="edit-message"?J("Rollback this turn?"):d.action==="undo"?J("Undo file changes?"):J("Redo file changes?"):""}),Ds=P(()=>{const d=Ce.value;return d?d.kind==="edit-message"?J("This rolls the thread back to this turn so you can edit the message. Later replies will be removed."):d.filePathLabel?d.action==="undo"?J("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:d.filePathLabel}):J("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:d.filePathLabel}):d.action==="undo"?J("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):J("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),Me=U(!0);let Ee=0,be=0,ot=0,Ke=null;const un=new WeakSet,Ae=U(qt(a.activeThreadId)),dn=P(()=>vt(Ae.value,a.activeThreadId)),Se=U(!1),Ct=P(()=>a.messages.filter(d=>!kt(d))),Oe=P(()=>Pl(Ct.value)),$t=P(()=>El({turnCount:Oe.value.length,hotTurns:jn,pageSize:qn,coldPage:dn.value.coldPage})),xt=P(()=>$t.value.warmStartTurn),De=P(()=>$t.value.warmEndTurn),fn=P(()=>$t.value.coldTurnCount),hn=P(()=>fn.value>0),Tt=P(()=>dn.value.expandedWarmTurns),Hs=P(()=>{const d=Ct.value,p=Oe.value,F=[],H=Tt.value;for(let ne=xt.value;ne<De.value;ne+=1){const de=p[ne];if(!de)continue;const T={turn:ne,userText:ns(de.userItem.text),assistantPreview:de.assistantPreview,toolCount:de.toolCount,expanded:H.has(ne)},z=H.has(ne)?d.slice(de.startIdx,de.endIdx).map(X=>({message:X})):[];F.push({key:`warm-${ne}`,warm:T,warmItems:z,processItems:[],fileChangeAnchorIds:[]})}const Y=En(d,p,De.value),v=Y[0];if(!v)return F;const he=a.messages.findIndex(ne=>ne.id===v.id),Fe=he>=0?a.messages.slice(he):Y;for(const ne of Il(Fe,{liveOverlayActive:a.liveOverlay!==null,liveTurnId:a.liveTurnId})){const de=ne.items.find(Z=>Z.kind==="user"),T=ne.items.find(Z=>Z.kind==="final-assistant"),z=ne.items.filter(Z=>Z!==de&&Z!==T&&Z.message.messageType!=="worked").map(Z=>({message:Z.message,presentation:Z.kind==="plan"?"plan":"process"})),X=ne.items.map(Z=>Z.message.id).filter(Z=>!!ve(Z));F.push({key:ne.key,warmItems:[],request:de?{message:de.message}:void 0,processItems:z,fileChangeAnchorIds:X,finalItem:T?{message:T.message,presentation:"final-assistant"}:void 0})}return F}),Ws=P(()=>Rl(a.messages));function js(d){var F,H;const p=((F=d.request)==null?void 0:F.message.turnId)??((H=d.finalItem)==null?void 0:H.message.turnId);return p?Ws.value[p]:void 0}function mn(){Ae.value=Ml(Ae.value,a.activeThreadId)}function qs(d){Ae.value=Pn(Ae.value,a.activeThreadId,d,!Tt.value.has(d))}const gn=P(()=>Oe.value.map((d,p)=>({turn:p,text:Ll(d.userItem.text)}))),Us=P(()=>Math.max(0,gn.value.length-1)),Ns=P(()=>{const d=new Map;return Oe.value.forEach((p,F)=>{d.set(p.userItem.id,F)}),d});function _t(d){return`question-anchor-${d}`}function Vs(d){const p=Ns.value.get(d.id);if(p!==void 0&&!(p<De.value))return _t(p)}function zs(d){if(d<De.value){let p=Ae.value;if(d<xt.value){const F=Bl({turn:d,turnCount:Oe.value.length,hotTurns:jn,pageSize:qn});p=Al(p,a.activeThreadId,F)}p=Pn(p,a.activeThreadId,d,!0),Ae.value=p}Me.value=!1,ct().then(()=>{const p=Le.value,F=document.getElementById(_t(d));if(!p||!F)return;const H=F.getBoundingClientRect(),Y=p.getBoundingClientRect(),v=p.scrollTop+H.top-Y.top-12;p.scrollTo({top:Math.max(0,v),behavior:"smooth"})})}const Ks=P(()=>{const d=Ct.value,p=Oe.value,F=[];for(let he=xt.value;he<De.value;he+=1){if(!Tt.value.has(he))continue;const Fe=p[he];Fe&&F.push(...d.slice(Fe.startIdx,Fe.endIdx))}const H=En(d,p,De.value),Y=H[0];if(!Y)return F;const v=a.messages.findIndex(he=>he.id===Y.id);return F.push(...v>=0?a.messages.slice(v):H),F}),It=P(()=>$l(Ks.value)),Ge=P(()=>{var p;const d=new Map;for(const F of It.value){const H=((p=F.messages[0])==null?void 0:p.id)??"";H&&d.set(H,F)}return d}),Gs=P(()=>{const d=new Set;for(const p of It.value)for(const F of p.messages)d.add(F.id);return d}),Zs=P(()=>{const d=new Set;for(const p of It.value)d.add(p.turnId);return d});function Js(d){return Ge.value.has(d.id)}function pn(d){return Gs.value.has(d.id)}function Xs(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.messages)??[]}function Ys(d){return $r(Xs(d))}function Qs(d){var p;return d.type==="batch"?`tool-batch-${d.kind}-${((p=d.messages[0])==null?void 0:p.id)??""}`:d.message.id}function eo(d){const p=Ge.value.get(d.id);return p?xl(p,{t:J,formatDuration:Ot}):""}function to(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.running)??!1}function no(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.hasOutsideContent)??!0}function so(d){return d.messageType==="worked"}const oo=P(()=>a.hasMorePersistedAbove===!0),ao=P(()=>!Me.value&&(a.messages.length>0||a.pendingRequests.length>0||!!a.liveOverlay));function vn(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function io(d){const p=ps.value[d];typeof p=="number"&&a.activeThreadId&&bt("forkThread",{threadId:a.activeThreadId,turnIndex:p})}const Lt=P(()=>{const d={};for(const p of a.messages){if(p.role!=="user"||typeof p.turnIndex!="number")continue;const F=typeof p.turnId=="string"&&p.turnId.length>0?p.turnId:"";!F||p.text.trim().length===0||(d[p.id]=F)}return d});function ro(d){return typeof Lt.value[d.id]=="string"}function lo(d){Lt.value[d]&&(Ce.value={kind:"edit-message",messageId:d})}function kn(d,p){sn(d)&&(Ce.value={kind:"file-change",summary:d,action:p})}function yn(d,p){!d||!sn(d)||!p.path||(Ce.value={kind:"file-change",summary:d,action:"undo",filePaths:[p.path],filePathLabel:s(p.path)})}function co(){const d=Ce.value;if(Ce.value=null,!!d){if(d.kind==="edit-message"){const p=Lt.value[d.messageId];p&&bt("rollback",{turnId:p});return}Bs(d.summary,d.action,d.filePaths)}}function uo(){const d=Le.value,p=tn.value;!d||!p||(d.scrollTop=d.scrollHeight,p.scrollIntoView({block:"end"}))}function fo(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=Cu}function ho(){if(Le.value&&Me.value){at();return}}function at(){Le.value&&uo()}function Mt(){return Me.value}function wn(){if(!Mt()){ot=0,be=0;return}if(at(),ot-=1,ot<=0){be=0;return}be=requestAnimationFrame(wn)}function it(d=6){Mt()&&(be&&(cancelAnimationFrame(be),be=0),ot=Math.max(d,1),be=requestAnimationFrame(wn))}function bn(){it(3)}function Cn(){Me.value=!0,at(),it(4)}async function $n(){var Y;const d=Le.value;if(!d||!a.hasMorePersistedAbove||Se.value||a.isLoadingPersistedAbove===!0)return;Se.value=!0;const p=a.activeThreadId,F=d.scrollHeight,H=d.scrollTop;try{await((Y=a.loadEarlierMessages)==null?void 0:Y.call(a,p)),await ct(),a.activeThreadId===p&&(d.scrollTop=H+(d.scrollHeight-F))}finally{Se.value=!1}}t({jumpToLatest:Cn});function mo(){if(!Mt())return;const d=Le.value;if(!d)return;const p=d.querySelectorAll("img.message-image-preview");for(const F of p)F.complete||un.has(F)||(un.add(F),F.addEventListener("load",bn,{once:!0}),F.addEventListener("error",bn,{once:!0}))}async function rt(){return Ke||(Ke=ct().then(()=>new Promise(d=>{Ee&&cancelAnimationFrame(Ee),Ee=requestAnimationFrame(()=>{Ee=0,Ke=null,ho(),mo(),it(),d()})})),Ke)}$e(()=>a.messages,async d=>{if(a.isLoading)return;const p=new Set(d.filter(F=>F.messageType==="commandExecution"&&F.commandExecution).map(F=>F.id));V(p),hs(),await rt()}),$e(()=>a.messages.some(d=>d.text.includes("```")),d=>{!d||l()||h()},{immediate:!0}),$e(()=>a.pendingRequests,async()=>{a.isLoading||await rt()},{deep:!0}),$e(()=>a.liveOverlay,async d=>{d&&Me.value&&(await ct(),at(),it(8))},{deep:!0}),$e(()=>a.isLoading,async d=>{d||await rt()}),$e(()=>a.activeThreadId,async()=>{Me.value=!0,nt.value="",Se.value=!1,Rs(),Ae.value=qt(a.activeThreadId),await rt()},{flush:"post"});function go(){const d=Le.value;!d||a.isLoading||(Me.value=fo(d),d.scrollTop<$u&&!Se.value&&(hn.value?mn():a.hasMorePersistedAbove===!0&&$n()))}const At=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function lt(d){const p=d.trim();if(!p)return!1;if(p.startsWith("data:video/"))return!0;try{const F=new URL(p,window.location.href);return At.test(F.pathname)?!0:F.pathname==="/codex-local-image"?At.test(F.searchParams.get("path")??""):!1}catch{return At.test(p)}}return pt(()=>{x(),Ee&&(cancelAnimationFrame(Ee),Ee=0),be&&(cancelAnimationFrame(be),be=0)}),(d,p)=>(c(),f(W,null,[m("section",{class:"conversation-root",onContextmenuCapture:p[4]||(p[4]=(...F)=>u(G)&&u(G)(...F))},[e.isLoading&&e.messages.length>0?(c(),f("div",Xl,w(u(J)("Loading messages...")),1)):S("",!0),e.isLoading&&e.messages.length===0?(c(),f("p",Yl,w(u(J)("Loading messages...")),1)):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(c(),f("p",Ql,w(u(J)("No messages in this thread yet.")),1)):(c(),f("ul",{key:3,ref_key:"conversationListRef",ref:Le,class:"conversation-list",onScroll:go},[oo.value?(c(),f("li",ec,[m("button",{type:"button",class:"load-more-button",disabled:Se.value||e.isLoadingPersistedAbove,onClick:$n},w(Se.value||e.isLoadingPersistedAbove?u(J)("Loading…"):u(J)("Load earlier messages")),9,tc)])):S("",!0),hn.value?(c(),f("li",nc,[m("button",{type:"button",class:"load-more-button",disabled:Se.value,onClick:mn},w(u(J)("Load earlier ({n} turns)",{n:fn.value})),9,sc)])):S("",!0),(c(!0),f(W,null,K(Hs.value,F=>(c(),se(tl,{key:F.key,"turn-key":F.key,warm:F.warm,"warm-items":F.warmItems,request:F.request,"process-items":F.processItems,"final-item":F.finalItem,"file-change-anchor-ids":F.fileChangeAnchorIds,"duration-ms":js(F)},{"warm-card":We(({warm:H})=>[m("li",{id:_t(H.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn"},[m("div",ac,[m("div",ic,[Q(ll,{"user-text":H.userText,"assistant-preview":H.assistantPreview,"tool-count":H.toolCount,expanded:H.expanded,onToggle:Y=>qs(H.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],8,oc)]),"file-change":We(({anchorMessageId:H})=>[m("div",rc,[m("div",lc,[u(Gt)(u(ve)(H))?(c(),se(Ln,{key:0,summary:u(ve)(H),expanded:u(ds)(H),cwd:a.cwd,actionable:u(on)(u(ve)(H)),"action-status":u(an)(u(ve)(H)),"action-error-text":u(rn)(u(ve)(H)),"next-action":u(ln)(u(ve)(H)),"action-label":u(cn)(u(ve)(H)),onToggle:Y=>u(fs)(H),onOpenDiff:Y=>u(et)(u(ve)(H),Y),onRequestAction:Y=>kn(u(ve)(H),Y),onRequestFileAction:Y=>yn(u(ve)(H),Y)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):S("",!0)])])]),default:We(({item:H,section:Y})=>[(c(!0),f(W,null,K([H.message],v=>{var he,Fe,ne,de;return c(),f(W,{key:v.id},[Js(v)?(c(),f("li",cc,[m("div",uc,[m("div",dc,[Q(sr,{label:eo(v),running:to(v),"has-outside-content":no(v)},{default:We(()=>[(c(!0),f(W,null,K(Ys(v),T=>(c(),f(W,{key:Qs(T)},[T.type==="batch"?(c(),se(jr,{key:0,kind:T.kind,messages:T.messages},null,8,["kind","messages"])):(c(!0),f(W,{key:1},K([T.message],z=>(c(),f(W,{key:z.id},[!u(A).has(z.id)&&!u(ye).has(z.id)?(c(),f(W,{key:0},[tt(z)?(c(),f("div",fc,[(c(!0),f(W,null,K(u(ee)(z),(X,Z)=>(c(),se(Sn,{key:`work-cmd-${X.id}`,command:X,"step-index":Z,expanded:u(_)(X),compact:u(R)(X),"output-condensed":u(O)(X),onToggle:xn=>u(q)(X)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):Yt(z)?(c(),se(jt,{key:1,message:z},null,8,["message"])):yt(z)?(c(),se(An,{key:2,message:z,expanded:Jt(z),"content-html":u(E)(z.text),onToggle:X=>Xt(z)},null,8,["message","expanded","content-html","onToggle"])):S("",!0)],64)):S("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!pn(v)&&!u(A).has(v.id)&&!u(ye).has(v.id)&&!(so(v)&&Zs.value.has(v.turnId??""))?(c(),f("li",{key:1,id:Vs(v),class:te(["conversation-item",{"conversation-item-request":Y==="request","conversation-item-process":Y==="process"||H.presentation==="process","conversation-item-final":Y==="final"||H.presentation==="final-assistant","conversation-item-plan":H.presentation==="plan"}]),"data-role":v.role,"data-message-type":v.messageType||""},[_s(v)?(c(),f("div",mc,[m("div",gc,[p[6]||(p[6]=m("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),m("span",null,w(u(J)("Compacting thread context…")),1)])])):Is(v)?(c(),f("div",pc,[m("div",vc,w(u(J)("Context compacted")),1)])):tt(v)?(c(),f("div",kc,[m("div",yc,[m("div",wc,[(c(!0),f(W,null,K(u(ee)(v),(T,z)=>(c(),se(Sn,{key:`work-cmd-${T.id}`,command:T,"step-index":z,expanded:u(_)(T),compact:u(R)(T),"output-condensed":u(O)(T),onToggle:X=>u(q)(T)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):Yt(v)?(c(),se(jt,{key:3,message:v},null,8,["message"])):Qt(v)?(c(),f("div",{key:4,class:"message-row","data-role":v.role,"data-message-type":v.messageType||""},[m("div",{class:"message-stack","data-role":v.role},[m("article",{class:"message-body","data-role":v.role},[u(Gt)(u(we)(v))?(c(),se(Ln,{key:0,summary:u(we)(v),expanded:u(_e)(v),cwd:a.cwd,actionable:u(on)(u(we)(v)),"action-status":u(an)(u(we)(v)),"action-error-text":u(rn)(u(we)(v)),"next-action":u(ln)(u(we)(v)),"action-label":u(cn)(u(we)(v)),onToggle:T=>u(pe)(v),onOpenDiff:T=>u(et)(u(we)(v),T),onRequestAction:T=>kn(u(we)(v),T),onRequestFileAction:T=>yn(u(we)(v),T)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):S("",!0)],8,$c)],8,Cc)],8,bc)):H.presentation==="plan"?(c(),f("div",xc,[m("div",Tc,[m("article",_c,[m("div",Ic,w(u(J)("Plan")),1),(he=u(Ze)(v))!=null&&he.explanation?(c(),f("p",Lc,w((Fe=u(Ze)(v))==null?void 0:Fe.explanation),1)):S("",!0),(ne=u(Ze)(v))!=null&&ne.steps.length?(c(),f("ol",Mc,[(c(!0),f(W,null,K((de=u(Ze)(v))==null?void 0:de.steps,(T,z)=>(c(),f("li",{key:`${v.id}-plan-${z}`,"data-status":T.status},[m("span",Sc,w(vn(T.status)),1),m("span",null,w(T.step),1)],8,Ac))),128))])):S("",!0)])])])):(c(),f("div",{key:6,class:te(["message-row",{"message-row-final":H.presentation==="final-assistant"}]),"data-role":v.role,"data-message-type":v.messageType||""},[m("div",{class:"message-stack","data-role":v.role},[m("article",{class:"message-body","data-role":v.role},[v.images&&v.images.length>0?(c(),f("ul",{key:0,class:te(["message-image-list",{"message-generated-image-list":v.messageType==="imageView"}]),"data-role":v.role},[(c(!0),f(W,null,K(v.images,T=>(c(),f("li",{key:T,class:"message-image-item"},[m("button",{class:"message-image-button",type:"button",onClick:z=>u(nn)(T)},[lt(T)?(c(),f("video",{key:0,class:te(["message-image-preview message-video-preview",{"message-generated-image-preview":v.messageType==="imageView"}]),src:T,controls:"",preload:"metadata"},null,10,Oc)):(c(),f("img",{key:1,class:te(["message-image-preview",{"message-generated-image-preview":v.messageType==="imageView"}]),src:T,alt:v.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,Dc))],8,Rc)]))),128))],10,Bc)):S("",!0),v.fileAttachments&&v.fileAttachments.length>0?(c(),f("div",Hc,[(c(!0),f(W,null,K(v.fileAttachments,T=>(c(),f("span",{key:`${v.id}:${T.path}`,class:"message-file-chip"},[p[7]||(p[7]=m("span",{class:"message-file-chip-icon"},"📄",-1)),m("a",{class:"message-file-link message-file-chip-name",href:u(b)(T.path),target:"_blank",rel:"noopener noreferrer",title:T.path},w(T.label),9,Wc)]))),128))])):S("",!0),v.skills&&v.skills.length>0?(c(),f("div",jc,[(c(!0),f(W,null,K(v.skills,T=>(c(),f("a",{key:`${v.id}:${T.path}`,class:"message-skill-chip",href:u(b)(T.path),title:T.path},[m("span",Uc,w(u(J)("Skill")),1),m("span",Nc,w(T.name),1)],8,qc))),128))])):S("",!0),v.text.length>0?(c(),f("article",{key:3,class:"message-card","data-role":v.role},[v.isAutomationRun?(c(),f("div",zc,[p[8]||(p[8]=m("span",null,"Sent via automation",-1)),v.automationDisplayName?(c(),f("code",Kc,w(v.automationDisplayName),1)):S("",!0)])):S("",!0),v.messageType==="worked"?(c(),f("div",Gc,[m("p",Zc,w(v.text),1)])):yt(v)?(c(),se(An,{key:2,message:v,expanded:Jt(v),"content-html":u(E)(v.text),onToggle:T=>Xt(v)},null,8,["message","expanded","content-html","onToggle"])):Co([v.id,v.text,a.cwd,u(r),u(Ss)],()=>(c(),f("div",{key:3,class:"message-text-flow"},[(c(!0),f(W,null,K(u(y)(v),(T,z)=>(c(),f(W,{key:`block-${z}`},[T.kind==="paragraph"?(c(),f("p",Jc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="heading"?(c(),se($o(u(Jn)(T.level)),{key:1,class:te(["message-heading",u(Xn)(T.level)])},{default:We(()=>[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])]),_:2},1032,["class"])):T.kind==="blockquote"?(c(),f("blockquote",Xc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="unorderedList"?(c(),f("ul",Yc,[(c(!0),f(W,null,K(T.items,(X,Z)=>(c(),f("li",{key:`ul-${z}-${Z}`,class:"message-list-item"},[m("div",{class:"message-list-item-content",innerHTML:u(I)(X)},null,8,Qc)]))),128))])):T.kind==="taskList"?(c(),f("ul",eu,[(c(!0),f(W,null,K(T.items,(X,Z)=>(c(),f("li",{key:`task-${z}-${Z}`,class:"message-task-item"},[m("span",{class:"message-task-checkbox","data-checked":X.checked},w(X.checked?"☑":"☐"),9,tu),m("div",nu,[Q(He,{segments:u(g)(X.text),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])]))),128))])):T.kind==="orderedList"?(c(),f("ol",{key:5,class:"message-list message-list-ordered",start:T.start},[(c(!0),f(W,null,K(T.items,(X,Z)=>(c(),f("li",{key:`ol-${z}-${Z}`,class:"message-list-item"},[m("div",{class:"message-list-item-content",innerHTML:u(I)(X)},null,8,ou)]))),128))],8,su)):T.kind==="table"?(c(),f("div",au,[m("table",iu,[m("thead",null,[m("tr",null,[(c(!0),f(W,null,K(T.headers,(X,Z)=>(c(),f("th",{key:`th-${z}-${Z}`,class:"message-table-head-cell",style:Je({textAlign:T.alignments[Z]??"left"})},[Q(He,{segments:u(g)(X),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])],4))),128))])]),T.rows.length>0?(c(),f("tbody",ru,[(c(!0),f(W,null,K(T.rows,(X,Z)=>(c(),f("tr",{key:`tr-${z}-${Z}`,class:"message-table-body-row"},[(c(!0),f(W,null,K(X,(xn,Tn)=>(c(),f("td",{key:`td-${z}-${Z}-${Tn}`,class:"message-table-cell",style:Je({textAlign:T.alignments[Tn]??"left"})},[Q(He,{segments:u(g)(xn),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])],4))),128))]))),128))])):S("",!0)])])):T.kind==="codeBlock"?(c(),f("div",lu,[T.language?(c(),f("div",cu,w(T.language),1)):S("",!0),m("pre",uu,[m("code",{class:"hljs",innerHTML:u(k)(T.language,T.value)},null,8,du)])])):T.kind==="thematicBreak"?(c(),f("hr",fu)):u(Fs)(v.id,z)?(c(),f("p",hu,w(T.markdown),1)):(c(),f("button",{key:10,class:"message-image-button",type:"button",onClick:X=>u(nn)(T.url)},[lt(T.url)?(c(),f("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:T.url,controls:"",preload:"metadata"},null,8,gu)):(c(),f("img",{key:1,class:"message-image-preview message-markdown-image",src:T.url,alt:T.alt||"Embedded message image",loading:"lazy",onError:X=>u(Ps)(v.id,z)},null,40,pu))],8,mu))],64))),128))])),p,0),Ls(v)?(c(),f("a",{key:4,class:"turn-error-feedback",href:u(Zt),onClick:T=>Ts(T,v.text)},w(u(J)("Send feedback")),9,vu)):S("",!0)],8,Vc)):S("",!0),Y!=="process"?(c(),se(Zi,{key:4,role:v.role,"show-edit":ro(v),"show-fork":u(ws)(v),"show-copy":u(vs)(v)||u(ks)(v),copied:u(gs)===v.id,onEdit:T=>lo(v.id),onFork:T=>io(v.id),onCopy:T=>v.role==="user"?u(ys)(v.id):u(bs)(v.id)},null,8,["role","show-edit","show-fork","show-copy","copied","onEdit","onFork","onCopy"])):S("",!0)],8,Ec)],8,Pc)],10,Fc))],10,hc)):S("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids","duration-ms"]))),128)),e.liveOverlay?(c(),se(Li,{key:2,overlay:e.liveOverlay,"feedback-mailto":u(Zt)},null,8,["overlay","feedback-mailto"])):S("",!0),m("li",{ref_key:"bottomAnchorRef",ref:tn,class:"conversation-bottom-anchor"},null,512)],544)),Q(cr,{anchors:gn.value,"active-turn":Us.value,onJump:zs},null,8,["anchors","active-turn"]),ao.value?(c(),f("button",{key:4,type:"button",class:"jump-to-latest-button",title:u(J)("Jump to latest"),"aria-label":u(J)("Jump to latest output"),onClick:Cn},[Q(xo,{class:"icon-svg jump-to-latest-icon"})],8,ku)):S("",!0),u(nt).length>0?(c(),f("div",{key:5,class:"image-modal-backdrop",onClick:p[3]||(p[3]=(...F)=>u(st)&&u(st)(...F))},[m("div",{class:"image-modal-content",onClick:p[2]||(p[2]=Ue(()=>{},["stop"]))},[m("button",{class:"image-modal-close",type:"button","aria-label":u(J)("Close image preview"),onClick:p[1]||(p[1]=(...F)=>u(st)&&u(st)(...F))},[Q(Nn,{class:"icon-svg"})],8,yu),u(As)?(c(),f("video",{key:0,class:"image-modal-image",src:u(nt),controls:"",autoplay:""},null,8,wu)):(c(),f("img",{key:1,class:"image-modal-image",src:u(nt),alt:u(J)("Expanded message image")},null,8,bu))])])):S("",!0),Q(ui,{visible:u(Re),x:u(ze),y:u($),"browse-url":u(M),"edit-url":u(D),onClose:u(ae)},null,8,["visible","x","y","browse-url","edit-url","onClose"]),Q(qa,{change:u(ge),changes:u(re),lines:u(j),"is-mobile":u(B),"is-file-list-open":u(ie),cwd:a.cwd,onClose:u(Ie),onSelectChange:u(us),onToggleFileList:u(ls),onCloseFileList:u(cs)},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd","onClose","onSelectChange","onToggleFileList","onCloseFileList"])],32),Q(sa,{visible:Ce.value!==null,title:Os.value,message:Ds.value,"confirm-label":"Confirm",danger:"",onConfirm:co,onCancel:p[5]||(p[5]=F=>Ce.value=null)},null,8,["visible","title","message"])],64))}}),Iu=oe(xu,[["__scopeId","data-v-75e349ec"]]);export{Iu as default};
|