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.
@@ -0,0 +1,39 @@
1
+ import{c as P,r as U,g as vo,o as vt,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 A,T as Un,_ as oe,u,F as W,l as K,m as ye,p as Q,I as Nn,q as ko,s as We,v as me,x as $e,y as Je,z as Vn,A as yo,B as Pe,C as wo,D as zn,E as Ot,G as bo,H as Co,J as ut,K as $o,L as xo,M as To,N as _o}from"./index-BJ-YiA9y.js";import{s as At}from"./sanitizeHtml-Bd3No2dT.js";function Io(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 ht(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 Lo(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=Lo(t);if(a)return je(`${a}/${n.slice(2)}`)}const s=Ne(t.trim());return je(s?`${s.replace(/\/+$/u,"")}/${n}`:n)}function mt(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=mt(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),Io(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 Mo(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:Mo(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=mt(o).core.trim()||o,i=mt(s).core.trim();return i?{label:a,target:i}:null}function gt(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 So(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:So(e.diff,t.diff),addedLineCount:e.addedLineCount+t.addedLineCount,removedLineCount:e.removedLineCount+t.removedLineCount}}function Fo(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(Fo)}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 Po(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 Eo(e){return Qn(e.addedLineCount,e.removedLineCount)}function es(e,t){return e===1?`1 ${t("file changed")}`:`${e} ${t("files changed")}`}function Bo(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 Ro(e,t){if(!e||e.changes.length===0)return t("Modified files");const n=es(e.changes.length,t),o=Bo(e,t);return o?`${n} · ${o}`:n}function Oo(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 Do(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 Ho(e){var o;const n=((o=(e.movedToPath||e.path).split(".").pop())==null?void 0:o.toLowerCase())??"";return Yn[n]??n??""}function Wo(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function jo(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 qo(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 Uo(e){return!e||!e.diff.trim()?[]:Wo(e)?qo(e):jo(e)}function No(e){return!!(e!=null&&e.diff.trim())}function Vo(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}function zo(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 Ko(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,pe;const B=new Map,N=new Map,ue=new Map,ge=j=>!o(j)&&!a(j)&&!i(j)&&!l().has(j.id)&&!r(j);for(const j of t()){const ve=typeof j.turnIndex=="number"?`turn:${j.turnIndex}`:`message:${j.id}`;if(ge(j)&&B.set(ve,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(ve);_e?_e.push(j):ue.set(ve,[j])}const ie={};for(const[j,ve]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(ve.flatMap(Ie=>Ie.fileChanges??[])),sourceMessageIds:ve.map(Ie=>Ie.id),source:"metadata",turnId:((pe=ve.find(Ie=>typeof Ie.turnId=="string"&&Ie.turnId.length>0))==null?void 0:pe.turnId)??et}}for(const[j,ve]of N.entries())ie[j]||(ie[j]=ve);return ie}),k=P(()=>{var ge;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}`,pe=B.get(re);pe?pe.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 pe=re[re.length-1];pe&&(ue[pe.id]={changes:Ft(re.flatMap(j=>j.fileChanges??[])),sourceMessageIds:re.map(j=>j.id),source:"metadata",turnId:pe.turnId??((ge=re.find(j=>typeof j.turnId=="string"&&j.turnId.length>0))==null?void 0:ge.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 ge of ue.sourceMessageIds)ge!==N&&B.add(ge);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]}),S=P(()=>Uo(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=zo(g.value,B)}return{anchoredFileChangeSummaryByAnchorId:I,standaloneFileChangeSummaryByMessageId:k,hiddenFileChangeMessageIds:E,isDiffViewerFileListOpen:y,diffViewerChanges:x,activeDiffViewerChange:C,activeDiffViewerLines:S,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 Go(e){const{getMessages:t,isCopyableAssistantMessage:n,isPlanMessage:o,planStepCopyMarker:s,buildFileChangeCopyText:a,getAnchoredFileChangeSummaries:i}=e,r=U("");let l=null;function h(S){var O;const _=Ze(S);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(S){const _=[],R=S.text.trim()||h(S),O=o(S)&&R?`Plan
14
+ ${R}`:R;O&&_.push(O);const q=(S.fileAttachments??[]).map(V=>V.path.trim()).filter(V=>V.length>0);q.length>0&&_.push(`Files:
15
+ ${q.join(`
16
+ `)}`);const ee=(S.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 S=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=S.get(ee);if(V){V.anchorMessageId=O.id,V.parts.push(q);continue}S.set(ee,{anchorMessageId:O.id,parts:[q]})}const _={};for(const O of S.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 S=new Map;for(const R of t()){if(!n(R)||typeof R.turnIndex!="number")continue;const O=`turn:${R.turnIndex}`,q=S.get(O);if(q){q.anchorMessageId=R.id,q.turnIndex=R.turnIndex;continue}S.set(O,{anchorMessageId:R.id,turnIndex:R.turnIndex})}const _={};for(const R of S.values())_[R.anchorMessageId]=R.turnIndex;return _});function y(S){return typeof b.value[S.id]=="string"}function I(S){return S.role==="user"&&g(S).length>0}function k(S){r.value=S,l&&clearTimeout(l),l=setTimeout(()=>{r.value===S&&(r.value=""),l=null},1800)}vo()&&vt(()=>{l&&(clearTimeout(l),l=null)});async function E(S){const _=t().find(q=>q.id===S);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(S)}function x(S){return typeof L.value[S.id]=="number"}async function C(S){const _=b.value[S]??"";if(!_)return;let R=!1;try{await Rt(_),R=!0}catch{R=!1}R||(R=_n(_)),R&&k(S)}return{copiedResponseAnchorId:r,copyableResponseContentByAnchorId:b,forkableTurnIndexByAnchorId:L,showCopyResponseButton:y,isCopyableUserMessage:I,copyUserMessage:E,showForkResponseButton:x,copyResponse:C}}function Zo(e){const{getMessages:t,getLiveOverlay:n,isCommandMessage:o}=e,s=U(new Set),a=P(()=>{var S;const C=t();for(let _=C.length-1;_>=0;_-=1){const R=C[_];if(R.messageType==="commandExecution"&&((S=R.commandExecution)==null?void 0:S.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(),S={};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];S[q.id]=O.slice(0,-1)}return S}),h=P(()=>{const C=new Set;for(const S of Object.values(l.value))for(const _ of S)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 S;return o(C)&&(r.value||((S=C.commandExecution)==null?void 0:S.status)==="inProgress")}function y(C){if(!o(C))return;const S=new Set(s.value);S.has(C.id)?S.delete(C.id):S.add(C.id),s.value=S}function I(C){return l.value[C.id]??[]}function k(C){return o(C)?[...I(C),C]:[]}function E(C,S){if(C.size===0)return C;const _=new Set;for(const R of C)S.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 Jo(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,S){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",S)}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 Xo(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 Yo(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 Qo=["aria-label"],ea={class:"confirm-dialog-title"},ta={class:"confirm-dialog-message"},na={class:"confirm-dialog-actions"},sa=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",ea,w(e.title),1),m("p",ta,w(e.message),1),m("div",na,[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,Qo)])):A("",!0)]))}}),oa=oe(sa,[["__scopeId","data-v-de94025d"]]),aa={key:0,class:"diff-viewer-sidebar"},ia={class:"diff-viewer-sidebar-header"},ra={class:"diff-viewer-sidebar-title"},la={class:"diff-viewer-sidebar-count"},ca={class:"diff-viewer-sidebar-list"},ua=["data-active","onClick"],da=["data-operation"],fa={class:"diff-viewer-file-label"},ha={key:0,class:"diff-viewer-file-delta"},ma={class:"diff-viewer-main"},ga={class:"diff-viewer-toolbar"},pa={class:"diff-viewer-title-wrap"},va={class:"diff-viewer-title"},ka={class:"diff-viewer-subtitle"},ya={key:0},wa={class:"diff-viewer-toolbar-actions"},ba=["aria-label"],Ca={key:0,class:"diff-viewer-empty"},$a={class:"diff-viewer-empty-title"},xa={class:"diff-viewer-empty-text"},Ta={key:1,class:"diff-viewer-panel"},_a={class:"diff-viewer-meta"},Ia={class:"diff-viewer-language"},La={class:"diff-viewer-lines"},Ma=["data-kind"],Sa={class:"diff-viewer-line-number"},Aa={class:"diff-viewer-line-number"},Fa={class:"diff-viewer-line-marker"},Pa=["innerHTML"],Ea={class:"diff-viewer-mobile-sheet-header"},Ba={class:"diff-viewer-sidebar-title"},Ra={class:"diff-viewer-sidebar-count"},Oa={class:"diff-viewer-mobile-sheet-list"},Da=["data-active","onClick"],Ha=["data-operation"],Wa={class:"diff-viewer-file-label"},ja={key:0,class:"diff-viewer-file-delta"},qa=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,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}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?A("",!0):(c(),f("aside",aa,[m("div",ia,[m("p",ra,w(u(n)("Changed files")),1),m("p",la,w(a.value(e.changes.length)),1)]),m("div",ca,[(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,da),m("span",fa,[ye(w(i.value(h.path))+" ",1),h.movedToPath?(c(),f(W,{key:0},[ye(" → "+w(i.value(h.movedToPath)),1)],64)):A("",!0)]),u(Be)(h)?(c(),f("span",ha,w(u(Be)(h)),1)):A("",!0)],8,ua))),128))])])),m("section",ma,[m("div",ga,[m("div",pa,[m("p",va,[ye(w(i.value(e.change.path))+" ",1),e.change.movedToPath?(c(),f(W,{key:0},[ye(" → "+w(i.value(e.change.movedToPath)),1)],64)):A("",!0)]),m("p",ka,[ye(w(s.value(e.change))+" ",1),u(Be)(e.change)?(c(),f("span",ya," · "+w(u(Be)(e.change)),1)):A("",!0)])]),m("div",wa,[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)):A("",!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,ba)])]),u(No)(e.change)?(c(),f("div",Ta,[m("div",_a,[m("span",Ia,w(u(Ho)(e.change)||"diff"),1)]),m("div",La,[(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",Sa,w(h.oldLine??""),1),m("span",Aa,w(h.newLine??""),1),m("span",Fa,w(u(Vo)(h)),1),m("code",{class:"diff-viewer-line-code",innerHTML:o(h.text)||" "},null,8,Pa)],8,Ma))),128))])])):(c(),f("div",Ca,[m("p",$a,w(u(n)("No diff available")),1),m("p",xa,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(ko,{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",Ea,[m("p",Ba,w(u(n)("Changed files")),1),m("p",Ra,w(a.value(e.changes.length)),1)]),m("div",Oa,[(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,Ha),m("span",Wa,[ye(w(i.value(h.path))+" ",1),h.movedToPath?(c(),f(W,{key:0},[ye(" → "+w(i.value(h.movedToPath)),1)],64)):A("",!0)]),u(Be)(h)?(c(),f("span",ja,w(u(Be)(h)),1)):A("",!0)],8,Da))),128))])])])):A("",!0)]),_:1})])])):A("",!0)]))}}),Ua=oe(qa,[["__scopeId","data-v-7ec6502b"]]),Na={},Va={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function za(e,t){return c(),f("svg",Va,[...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(Na,[["render",za]]),Ka={class:"file-change-summary-label"},Ga={class:"file-change-summary-status"},Za=["data-tone"],Ja={class:"file-change-panel-inner"},Xa={class:"file-change-list"},Ya=["data-operation","title"],Qa={class:"file-change-path-group"},ei=["title","onClick"],ti={key:0,class:"file-change-arrow"},ni=["title","onClick"],si={key:0,class:"file-change-delta"},oi=["data-tone"],ai=["title","aria-label","onClick"],ii={key:0,class:"file-change-actions"},ri={key:0,class:"file-change-action-error"},li=["disabled","title","aria-label"],ci=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=>Ro(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",Ka,w(s.value(e.summary)),1),m("span",Ga,[(c(!0),f(W,null,K(u(Oo)(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,Za))),128))])],2),m("div",{class:te(["file-change-panel",{"file-change-panel-visible":e.expanded}])},[m("div",Ja,[m("ul",Xa,[(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(Po)(h)),9,Ya),m("span",Qa,[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,ei),h.movedToPath?(c(),f("span",ti,"→")):A("",!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,ni)):A("",!0)]),h.addedLineCount>0||h.removedLineCount>0?(c(),f("span",si,[(c(!0),f(W,null,K(u(Eo)(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,oi))),128))])):A("",!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,ai)):A("",!0)]))),128))]),e.actionable?(c(),f("div",ii,[e.actionErrorText?(c(),f("p",ri,w(e.actionErrorText),1)):A("",!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"]),ye(" "+w(e.actionLabel),1)],8,li)])):A("",!0)])],2)],2)):A("",!0)}}),Ln=oe(ci,[["__scopeId","data-v-851281a0"]]),ui=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))}),vt(()=>{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 ")):A("",!0)],4)):A("",!0)}}),di=oe(ui,[["__scopeId","data-v-9cda1d9d"]]),fi=12e3,hi=240;function mi(e,{streaming:t,truncateStreaming:n=!0,maxChars:o=fi,maxLines:s=hi}){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 gi={class:"conversation-item conversation-item-overlay"},pi={class:"message-row"},vi={class:"message-stack"},ki={class:"live-overlay-inline","aria-live":"polite"},yi={class:"live-overlay-title-row"},wi={key:0,class:"live-overlay-spinner","aria-hidden":"true"},bi=["aria-expanded"],Ci={class:"live-overlay-label"},$i={class:"live-overlay-toggle","aria-hidden":"true"},xi={key:2,class:"live-overlay-label"},Ti={key:0,class:"live-overlay-reasoning"},_i={key:1,class:"live-overlay-error"},Ii=["href"],Li=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 mi(((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",gi,[m("div",pi,[m("div",vi,[m("article",ki,[m("div",yi,[(b=e.overlay)!=null&&b.errorText?A("",!0):(c(),f("span",wi)),(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",Ci,w((y=e.overlay)==null?void 0:y.activityLabel),1),m("span",$i,w(a.value?"▾":"▸"),1)],8,bi)):(c(),f("p",xi,w((I=e.overlay)==null?void 0:I.activityLabel),1))]),(k=e.overlay)!=null&&k.reasoningText&&a.value?(c(),f("p",Ti,w(r.value),1)):A("",!0),(E=e.overlay)!=null&&E.errorText?(c(),f("div",_i,[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,Ii)])):A("",!0)])])])])}}}),Mi=oe(Li,[["__scopeId","data-v-b69a0020"]]),Si={key:0},Ai={key:1,class:"message-bold-text"},Fi={key:2,class:"message-italic-text"},Pi={key:3,class:"message-strikethrough-text"},Ei=["href","title"],Bi=["href","title"],Ri={key:6,class:"message-inline-code"},Oi=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",Si,w(o.value),1)):o.kind==="bold"?(c(),f("strong",Ai,w(o.value),1)):o.kind==="italic"?(c(),f("em",Fi,w(o.value),1)):o.kind==="strikethrough"?(c(),f("s",Pi,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,Ei)):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,Bi)):(c(),f("code",Ri,w(o.value),1))],64))),128))}}),He=oe(Oi,[["__scopeId","data-v-e81c51c6"]]),Di={},Hi={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Wi(e,t){return c(),f("svg",Hi,[...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 ji=oe(Di,[["render",Wi]]),qi=["data-role"],Ui=["aria-label","title"],Ni={key:0,class:"message-rollback-label"},Vi=["aria-label","title"],zi={class:"message-fork-label"},Ki=["data-copied","aria-label","title"],Gi={key:0,class:"message-copy-label"},Zi=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",Ni,w(u(t)("Rollback")),1)):A("",!0)],8,Ui)):A("",!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(yo,{class:"icon-svg message-fork-icon"}),m("span",zi,w(u(t)("Fork")),1)],8,Vi)):A("",!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(ji,{class:"icon-svg message-copy-icon"}),e.role!=="user"?(c(),f("span",Gi,w(e.copied?"Copied":"Copy"),1)):A("",!0)],8,Ki)):A("",!0)],8,qi)):A("",!0)}}),Ji=oe(Zi,[["__scopeId","data-v-59a7a725"]]),Xi="codex-web-local.process-fold.v1",Mn="codex:web-local:process-fold";function Pt(){return typeof localStorage>"u"?"auto":localStorage.getItem(Xi)==="expanded"?"expanded":"auto"}function Yi(e){const t=n=>e(n.detail);return window.addEventListener(Mn,t),()=>window.removeEventListener(Mn,t)}const Qi=["aria-expanded"],er={class:"process-fold-label"},tr={class:"process-fold-toggle","aria-hidden":"true"},nr={key:0,class:"process-fold-body"},sr=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=Yi(()=>{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}),vt(()=>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",er,w(e.label),1),m("span",tr,w(n.value?"▾":"▸"),1)],8,Qi),n.value?(c(),f("div",nr,[Pe(r.$slots,"default",{},void 0)])):A("",!0)],2))}}),or=oe(sr,[["__scopeId","data-v-de9b3329"]]),ar=["aria-label"],ir=["data-turn","aria-label","onClick"],rr={class:"question-jump-preview-text"},lr=2,Et="#3b82f6",cr=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 S;const E=n.activeTurn===((S=n.anchors[k])==null?void 0:S.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,S=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<S&&(S=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 S=(O=Array.from(x.querySelectorAll(".question-jump-item"))[E])==null?void 0:O.getBoundingClientRect(),_=x.getBoundingClientRect();if(!S)return;const R=S.top+S.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>=lr?(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:S=>I(x)},[m("span",{class:"question-jump-dot",style:Je(h(C))},null,4)],40,ir))),128))],544),l.value?(c(),f("div",{key:0,class:"question-jump-preview",role:"tooltip",style:Je({top:r.value})},[m("span",rr,w(l.value.text),1)],4)):A("",!0)],8,ar)):A("",!0)}}),ur=oe(cr,[["__scopeId","data-v-96d087d4"]]),dr=["data-state"],fr=["aria-expanded"],hr={class:"reasoning-block-title"},mr={class:"reasoning-block-toggle","aria-hidden":"true"},gr={key:0,class:"reasoning-block-body"},pr={key:0,class:"reasoning-block-summary"},vr=["innerHTML"],kr=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",hr,w(u(n)("Thinking process")),1),m("span",mr,w(e.expanded?"▾":"▸"),1)],8,fr),e.expanded?(c(),f("div",gr,[o.value?(c(),f("p",pr,w(o.value),1)):A("",!0),m("div",{class:"reasoning-block-content message-card",innerHTML:e.contentHtml},null,8,vr)])):A("",!0)],8,dr))}}),Sn=oe(kr,[["__scopeId","data-v-5fa90230"]]),yr=new Set(["read_file","ls","grep","glob","web_fetch","read_skill","code_index","connect_tool_source"]),wr=new Set(["write_file","edit_file","multi_edit","move_file","delete_range","delete_symbol","notebook_edit"]),br=new Set(["task","run_skill","explore","research","review","security_review"]);function Cr(e){var n;const t=((n=e.toolCall)==null?void 0:n.tool)??"";return yr.has(t)?"readonly":wr.has(t)?"modify":br.has(t)?"delegate":null}const $r=2;function xr(e){var a;const t=[];let n=[],o=null;const s=()=>{if(o!==null&&n.length>=$r)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=Cr(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 Tr(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 _r={class:"message-row","data-role":"system"},Ir={class:"message-stack","data-role":"system"},Lr=["title"],Mr={key:0,class:"tool-call-server"},Sr={class:"tool-call-name"},Ar={class:"tool-call-status"},Fr={key:0,class:"work-block-spinner","aria-hidden":"true"},Pr={key:1,class:"tool-call-status-icon","aria-hidden":"true"},Er={key:2,class:"tool-call-status-icon","aria-hidden":"true"},Br=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",_r,[m("div",Ir,[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",Mr,w(e.message.toolCall.server),1)):A("",!0),m("code",Sr,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",Fr)):((b=e.message.toolCall)==null?void 0:b.status)==="completed"?(c(),f("span",Pr,"✓")):(c(),f("span",Er,"✗")),ye(" "+w(o.value),1)])],10,Lr)])])}}}),jt=oe(Br,[["__scopeId","data-v-e25278a7"]]),Rr=["aria-expanded","title"],Or={class:"tool-batch-toggle","aria-hidden":"true"},Dr={class:"tool-batch-label"},Hr={class:"tool-batch-count"},Wr={key:0,class:"tool-batch-body"},jr=le({__name:"ToolBatchBlock",props:{kind:{},messages:{}},setup(e){const t=e,{t:n}=me(),o=U(!1),s=P(()=>Tr(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",Or,w(o.value?"▾":"▸"),1),r[1]||(r[1]=m("span",{class:"tool-batch-icon","aria-hidden":"true"},"🛠",-1)),m("span",Dr,w(s.value),1),m("span",Hr,w(e.messages.length),1)],8,Rr),o.value?(c(),f("div",Wr,[(c(!0),f(W,null,K(e.messages,l=>(c(),se(jt,{key:l.id,message:l},null,8,["message"]))),128))])):A("",!0)],2))}}),qr=oe(jr,[["__scopeId","data-v-908995a9"]]),Ur=["data-turn-key"],Nr={key:0,class:"conversation-turn-request","aria-label":"User request"},Vr={class:"conversation-turn-items"},zr={key:1,class:"conversation-turn-process","aria-label":"Turn process"},Kr=["aria-expanded","aria-label"],Gr={key:2,class:"conversation-turn-time"},Zr={class:"conversation-turn-process-count"},Jr={key:1,class:"conversation-turn-process-heading"},Xr={key:0,class:"conversation-turn-time"},Yr={key:2,class:"conversation-turn-items conversation-turn-process-items"},Qr={key:2,class:"conversation-turn-final","aria-label":"Assistant final response"},el={class:"conversation-turn-items"},tl=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",Nr,[m("ol",Vr,[Pe(i.$slots,"default",{item:e.request,section:"request"},void 0)])])):A("",!0),s.value>0?(c(),f("section",zr,[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(wo,{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",Gr,w(u(Ot)(e.durationMs)),1)):A("",!0),m("span",Zr,w(u(n)("{n} process items",{n:s.value})),1)],8,Kr)):(c(),f("div",Jr,[ye(w(u(n)("Turn process"))+" ",1),e.durationMs!=null&&e.durationMs>0?(c(),f("span",Xr,w(u(Ot)(e.durationMs)),1)):A("",!0)])),o.value?(c(),f("ol",Yr,[(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))])):A("",!0)])):A("",!0),e.finalItem?(c(),f("section",Qr,[m("ol",el,[Pe(i.$slots,"default",{item:e.finalItem,section:"final"},void 0)])])):A("",!0)],8,Ur))}}),nl=oe(tl,[["__scopeId","data-v-03c06fab"]]),sl=["aria-expanded"],ol={class:"warm-turn__preview"},al={key:0,class:"warm-turn__meta"},il={class:"warm-turn__content"},rl={key:1,class:"warm-turn__assistant"},ll=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",ol,w(e.userText),1),e.toolCount>0?(c(),f("span",al,w(u(o)("{n} tools",{n:e.toolCount})),1)):A("",!0)],8,sl),m("div",il,[e.expanded?Pe(a.$slots,"default",{},void 0,!0,0):e.assistantPreview?(c(),f("div",rl,w(e.assistantPreview),1)):A("",!0)])],2))}}),cl=oe(ll,[["__scopeId","data-v-7e3ebbc7"]]),ul=["aria-expanded"],dl=["title"],fl={class:"work-block-command"},hl={class:"work-block-status"},ml={key:0,class:"work-block-spinner","aria-hidden":"true"},gl={key:1,class:"work-block-status-icon","aria-hidden":"true"},pl={key:2,class:"work-block-status-icon","aria-hidden":"true"},vl={class:"work-block-output-inner"},kl=["textContent"],yl=["textContent"],wl={key:0,class:"work-block-permission-hint",role:"note"},bl=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,dl),m("code",fl,w(u(n)("Command")),1),m("span",hl,[((h=e.command.commandExecution)==null?void 0:h.status)==="inProgress"?(c(),f("span",ml)):((g=e.command.commandExecution)==null?void 0:g.status)==="completed"&&((b=e.command.commandExecution)==null?void 0:b.exitCode)===0?(c(),f("span",gl,"✓")):((L=e.command.commandExecution)==null?void 0:L.status)==="failed"?(c(),f("span",pl,"✗")):A("",!0),ye(" "+w(s.value),1)])],8,ul),m("div",{class:te(["work-block-output-wrap",{"work-block-output-visible":e.expanded}])},[m("div",vl,[m("pre",{class:"work-block-output-command",textContent:w(((y=e.command.commandExecution)==null?void 0:y.command)||"(command)")},null,8,kl),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,yl)])],2),i.value?(c(),f("p",wl,w(i.value),1)):A("",!0)],2)}}}),An=oe(bl,[["__scopeId","data-v-e9fdf684"]]),Cl=2;function Fn(e){const t=e.messageType;return t==="commandExecution"||t==="toolCall"}function $l(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 xl(e,t){return e.messages.every(n=>t(n))}function Tl(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<Cl)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),$l(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 _l(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 Il(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 Ll(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 Ml(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:Il(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=>Ll(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 Sl(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 kt(e,t){return e.sessionKey===t?e:qt(t)}function Al(e,t){const n=kt(e,t);return{...n,coldPage:n.coldPage+1}}function Fl(e,t,n){const o=kt(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=kt(e,t),a=new Set(s.expandedWarmTurns);return o?a.add(n):a.delete(n),{...s,expandedWarmTurns:a}}function Pl(e){return e.role==="user"}function El(e){var t;return((t=e.messageType)==null?void 0:t.endsWith(".live"))===!0}function Bl(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(Pl(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"&&!El(r)&&h&&(l.assistantPreview=ns(h)),r.messageType==="toolCall"&&(l.toolCount+=1)}}return t}function Rl({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 Ol({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 Dl(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 Hl(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=mt(l);l=y.core;const I=y.leading,k=y.trailing+h;I&&n.push({kind:"text",value:I});const E=gt(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:ht(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 Wl(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=gt(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:ht(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 jl(e){const t=e.includes("`"),n=Wl(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=gt(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:ht(k.path)}):a.push({kind:"code",value:L})}}else{const I=gt(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:ht(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 dt(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 ql(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 Ul(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=Ul(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 Nl(e){return Te(e)||pt(e)!==null||zt(e)||Ut(e)!==null||dt(e)!==null||Qe(e)!==null||Ye(e)!==null||Nt(e)!==null}function Vl(e,t,n=-1){const o=[];let s=t;for(;s<e.length&&!(Nl(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 zl(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:ft(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=zl(e,a,r,n,o);if(k){g.push(...k.blocks),a=k.nextIndex;continue}}if(xe(e[a])<=r)break;const I=Vl(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 pt(e){const t=e.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return t?{marker:t[1],language:(t[2]??"").trim()}:null}function ft(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=pt(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(dt(n[s])!==null){const k=[];for(;s<n.length;){const E=dt(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,ql);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])||pt(n[s])||zt(n[s])||Ut(n[s])||Dn(n,s)||dt(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 Kl(e){if(!e.includes("![")||!e.includes("]("))return ft(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=Hl(r.trim());g&&(l>o&&t.push(...ft(e.slice(o,l))),t.push({kind:"image",url:g,alt:i.trim(),markdown:a}),o=h)}return o<e.length&&t.push(...ft(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(...Kl(l))};for(;s<n.length;){const r=pt(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 Gl=300,Zl=1200,Jl=300,Xl=250;function Yl(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=bo(()=>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,$,jl($),Zl)}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},Gl).blocks}function x($){return $.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function C($){var D;const M=((D=$.trim().split(/\s+/u)[0])==null?void 0:D.toLowerCase())??"";return M?Yn[M]??M:""}function S($,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 At(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,S($,M),Xl)}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 At(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=At(G);return g(l,M,{text:$,cwd:t(),highlightVersion:s.value,html:ae},Jl).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 Ql={key:0,class:"conversation-switching-bar",role:"status"},ec={key:1,class:"conversation-loading"},tc={key:2,class:"conversation-empty"},nc={key:0,class:"conversation-load-more"},sc=["disabled"],oc={key:1,class:"conversation-load-more conversation-warm-collapse"},ac=["disabled"],ic=["id"],rc={class:"message-row","data-role":"system"},lc={class:"message-stack","data-role":"system"},cc={class:"message-row","data-role":"system","data-message-type":"fileChange"},uc={class:"message-stack","data-role":"system"},dc={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},fc={class:"message-row","data-role":"system"},hc={class:"message-stack","data-role":"system"},mc={key:0,class:"work-block-list"},gc=["id","data-role","data-message-type"],pc={key:0,class:"message-row thread-compaction-row","data-role":"system"},vc={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},kc={key:1,class:"message-row thread-compaction-row","data-role":"system"},yc={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},wc={key:2,class:"message-row","data-role":"system"},bc={class:"message-stack","data-role":"system"},Cc={class:"work-block-list"},$c=["data-role","data-message-type"],xc=["data-role"],Tc=["data-role"],_c={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},Ic={class:"message-stack","data-role":"system"},Lc={class:"thread-plan-record"},Mc={class:"thread-plan-record-header"},Sc={key:0,class:"thread-plan-record-explanation"},Ac={key:1,class:"thread-plan-record-steps"},Fc=["data-status"],Pc={class:"thread-plan-record-marker","aria-hidden":"true"},Ec=["data-role","data-message-type"],Bc=["data-role"],Rc=["data-role"],Oc=["data-role"],Dc=["onClick"],Hc=["src"],Wc=["src","alt"],jc={key:1,class:"message-file-attachments"},qc=["href","title"],Uc={key:2,class:"message-skill-attachments"},Nc=["href","title"],Vc={class:"message-skill-chip-prefix"},zc={class:"message-skill-chip-name"},Kc=["data-role"],Gc={key:0,class:"automation-message-label"},Zc={key:0},Jc={key:1,class:"work-summary-wrap","aria-live":"polite"},Xc={class:"work-summary-text"},Yc={key:0,class:"message-text"},Qc={key:2,class:"message-blockquote"},eu={key:3,class:"message-list message-list-unordered"},tu=["innerHTML"],nu={key:4,class:"message-list message-task-list"},su=["data-checked"],ou={class:"message-list-item-text"},au=["start"],iu=["innerHTML"],ru={key:6,class:"message-table-wrap"},lu={class:"message-table"},cu={key:0},uu={key:7,class:"message-code-block"},du={key:0,class:"message-code-language"},fu={class:"message-code-pre"},hu=["innerHTML"],mu={key:8,class:"message-divider"},gu={key:9,class:"message-text"},pu=["onClick"],vu=["src"],ku=["src","alt","onError"],yu=["href","onClick"],wu=["title","aria-label"],bu=["aria-label"],Cu=["src"],$u=["src","alt"],xu=16,jn=30,qn=20,Tu=200,_u=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 Do(d,a.cwd,J)}function s(d){return Ve(d,a.cwd)}const a=e,i=Yl({getCwd:()=>a.cwd,isVideoMediaUrl:ct}),{highlightCacheVersion:r,hasHighlightLoaded:l,ensureHighlightJsLoaded:h,getInlineSegments:g,toBrowseUrl:b,toEditUrlFromBrowseHref:L,getMessageBlocks:y,renderListItemContentAsHtml:I,renderCachedHighlightedCodeAsHtml:k,renderMarkdownBlocksAsHtml:E,clearRenderCaches:x}=i,C=Zo({getMessages:()=>a.messages,getLiveOverlay:()=>a.liveOverlay,isCommandMessage:tt}),{hiddenGroupedCommandIds:S,isCommandExpanded:_,isCommandCompact:R,isCommandOutputCondensed:O,toggleCommandExpand:q,getWorkBlockCommands:ee,pruneCommandIdSets:V}=C,fe=Xo({toEditUrlFromBrowseHref:L}),{isFileLinkContextMenuVisible:Re,fileLinkContextMenuX:ze,fileLinkContextMenuY:$,fileLinkContextBrowseUrl:M,fileLinkContextEditUrl:D,handleConversationContextMenu:G,closeFileLinkContextMenu:ae}=fe,{isMobile:B}=Co(),N=Ko({getMessages:()=>a.messages,getLiveTurnId:()=>a.liveTurnId??"",isFileChangeMessage:Qt,isCopyableAssistantMessage:en,isReasoningMessage:wt,isPlanMessage:yt,isFoldMember:pn,getHiddenGroupedCommandIds:()=>S.value,isMobile:()=>B.value}),{anchoredFileChangeSummaryByAnchorId:ue,hiddenFileChangeMessageIds:ge,isDiffViewerFileListOpen:ie,diffViewerChanges:re,activeDiffViewerChange:pe,activeDiffViewerLines:j,toggleFileChangeSummary:ve,isFileChangeSummaryExpanded:_e,openDiffViewer:et,closeDiffViewer:Ie,toggleDiffViewerFileList:ls,closeDiffViewerFileList:cs,selectDiffViewerChange:us,readAnchoredFileChangeSummaryById:ke,isFileChangeSummaryExpandedById:ds,toggleFileChangeSummaryById:fs,readStandaloneFileChangeSummary:we,isFileChangeSummaryVisible:Gt,pruneFileChangeSummaryIds:hs}=N,ms=Go({getMessages:()=>a.messages,isCopyableAssistantMessage:en,isPlanMessage:yt,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 yt(d){return d.messageType==="plan"||d.messageType==="plan.live"}function wt(d){return d.messageType==="reasoning"&&!!d.reasoning}const bt=U(new Set);function Jt(d){return bt.value.has(d.id)}function Xt(d){const p=new Set(bt.value);p.has(d.id)?p.delete(d.id):p.add(d.id),bt.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 Ct=n,Le=U(null),tn=U(null),Ms=Yo({isVideo:ct}),{modalImageUrl:nt,modalIsVideo:Ss,markdownImageFailureVersion:As,isMarkdownImageFailed:Fs,onMarkdownImageError:Ps,openImageModal:nn,closeImageModal:st}=Ms,Es=Jo({getActiveThreadId:()=>a.activeThreadId,getCwd:()=>a.cwd,onFileChangesChanged:()=>Ct("fileChangesChanged",a.activeThreadId),updateThreadFileChanges:_o,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,Se=U(qt(a.activeThreadId)),dn=P(()=>kt(Se.value,a.activeThreadId)),Ae=U(!1),$t=P(()=>a.messages.filter(d=>!yt(d))),Oe=P(()=>Bl($t.value)),xt=P(()=>Rl({turnCount:Oe.value.length,hotTurns:jn,pageSize:qn,coldPage:dn.value.coldPage})),Tt=P(()=>xt.value.warmStartTurn),De=P(()=>xt.value.warmEndTurn),fn=P(()=>xt.value.coldTurnCount),hn=P(()=>fn.value>0),_t=P(()=>dn.value.expandedWarmTurns),Hs=P(()=>{const d=$t.value,p=Oe.value,F=[],H=_t.value;for(let ne=Tt.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 Ml(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=>!!ke(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(()=>Dl(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(){Se.value=Al(Se.value,a.activeThreadId)}function qs(d){Se.value=Pn(Se.value,a.activeThreadId,d,!_t.value.has(d))}const gn=P(()=>Oe.value.map((d,p)=>({turn:p,text:Sl(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 It(d){return`question-anchor-${d}`}function Vs(d){const p=Ns.value.get(d.id);if(p!==void 0&&!(p<De.value))return It(p)}function zs(d){if(d<De.value){let p=Se.value;if(d<Tt.value){const F=Ol({turn:d,turnCount:Oe.value.length,hotTurns:jn,pageSize:qn});p=Fl(p,a.activeThreadId,F)}p=Pn(p,a.activeThreadId,d,!0),Se.value=p}Me.value=!1,ut().then(()=>{const p=Le.value,F=document.getElementById(It(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=$t.value,p=Oe.value,F=[];for(let he=Tt.value;he<De.value;he+=1){if(!_t.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}),at=P(()=>Tl(Ks.value)),Ge=P(()=>{var p;const d=new Map;for(const F of at.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 at.value)for(const F of p.messages)d.add(F.id);return d}),Zs=P(()=>{var F;const d=new Set,p=H=>S.value.has(H.id)||ge.value.has(H.id);for(const H of at.value)xl(H,p)&&d.add(((F=H.messages[0])==null?void 0:F.id)??"");return d}),Js=P(()=>{const d=new Set;for(const p of at.value)d.add(p.turnId);return d});function Xs(d){return Ge.value.has(d.id)}function pn(d){return Gs.value.has(d.id)}function Ys(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.messages)??[]}function Qs(d){return xr(Ys(d))}function eo(d){var p;return d.type==="batch"?`tool-batch-${d.kind}-${((p=d.messages[0])==null?void 0:p.id)??""}`:d.message.id}function to(d){const p=Ge.value.get(d.id);return p?_l(p,{t:J,formatDuration:Ot}):""}function no(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.running)??!1}function so(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.hasOutsideContent)??!0}function oo(d){return d.messageType==="worked"}const ao=P(()=>a.hasMorePersistedAbove===!0),io=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 ro(d){const p=ps.value[d];typeof p=="number"&&a.activeThreadId&&Ct("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 lo(d){return typeof Lt.value[d.id]=="string"}function co(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 uo(){const d=Ce.value;if(Ce.value=null,!!d){if(d.kind==="edit-message"){const p=Lt.value[d.messageId];p&&Ct("rollback",{turnId:p});return}Bs(d.summary,d.action,d.filePaths)}}function fo(){const d=Le.value,p=tn.value;!d||!p||(d.scrollTop=d.scrollHeight,p.scrollIntoView({block:"end"}))}function ho(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=xu}function mo(){if(Le.value&&Me.value){it();return}}function it(){Le.value&&fo()}function Mt(){return Me.value}function wn(){if(!Mt()){ot=0,be=0;return}if(it(),ot-=1,ot<=0){be=0;return}be=requestAnimationFrame(wn)}function rt(d=6){Mt()&&(be&&(cancelAnimationFrame(be),be=0),ot=Math.max(d,1),be=requestAnimationFrame(wn))}function bn(){rt(3)}function Cn(){Me.value=!0,it(),rt(4)}async function $n(){var Y;const d=Le.value;if(!d||!a.hasMorePersistedAbove||Ae.value||a.isLoadingPersistedAbove===!0)return;Ae.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 ut(),a.activeThreadId===p&&(d.scrollTop=H+(d.scrollHeight-F))}finally{Ae.value=!1}}t({jumpToLatest:Cn});function go(){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 lt(){return Ke||(Ke=ut().then(()=>new Promise(d=>{Ee&&cancelAnimationFrame(Ee),Ee=requestAnimationFrame(()=>{Ee=0,Ke=null,mo(),go(),rt(),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 lt()}),$e(()=>a.messages.some(d=>d.text.includes("```")),d=>{!d||l()||h()},{immediate:!0}),$e(()=>a.pendingRequests,async()=>{a.isLoading||await lt()},{deep:!0}),$e(()=>a.liveOverlay,async d=>{d&&Me.value&&(await ut(),it(),rt(8))},{deep:!0}),$e(()=>a.isLoading,async d=>{d||await lt()}),$e(()=>a.activeThreadId,async()=>{Me.value=!0,nt.value="",Ae.value=!1,Rs(),Se.value=qt(a.activeThreadId),await lt()},{flush:"post"});function po(){const d=Le.value;!d||a.isLoading||(Me.value=ho(d),d.scrollTop<Tu&&!Ae.value&&(hn.value?mn():a.hasMorePersistedAbove===!0&&$n()))}const St=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function ct(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 St.test(F.pathname)?!0:F.pathname==="/codex-local-image"?St.test(F.searchParams.get("path")??""):!1}catch{return St.test(p)}}return vt(()=>{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",Ql,w(u(J)("Loading messages...")),1)):A("",!0),e.isLoading&&e.messages.length===0?(c(),f("p",ec,w(u(J)("Loading messages...")),1)):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(c(),f("p",tc,w(u(J)("No messages in this thread yet.")),1)):(c(),f("ul",{key:3,ref_key:"conversationListRef",ref:Le,class:"conversation-list",onScroll:po},[ao.value?(c(),f("li",nc,[m("button",{type:"button",class:"load-more-button",disabled:Ae.value||e.isLoadingPersistedAbove,onClick:$n},w(Ae.value||e.isLoadingPersistedAbove?u(J)("Loading…"):u(J)("Load earlier messages")),9,sc)])):A("",!0),hn.value?(c(),f("li",oc,[m("button",{type:"button",class:"load-more-button",disabled:Ae.value,onClick:mn},w(u(J)("Load earlier ({n} turns)",{n:fn.value})),9,ac)])):A("",!0),(c(!0),f(W,null,K(Hs.value,F=>(c(),se(nl,{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:It(H.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn"},[m("div",rc,[m("div",lc,[Q(cl,{"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,ic)]),"file-change":We(({anchorMessageId:H})=>[m("div",cc,[m("div",uc,[u(Gt)(u(ke)(H))?(c(),se(Ln,{key:0,summary:u(ke)(H),expanded:u(ds)(H),cwd:a.cwd,actionable:u(on)(u(ke)(H)),"action-status":u(an)(u(ke)(H)),"action-error-text":u(rn)(u(ke)(H)),"next-action":u(ln)(u(ke)(H)),"action-label":u(cn)(u(ke)(H)),onToggle:Y=>u(fs)(H),onOpenDiff:Y=>u(et)(u(ke)(H),Y),onRequestAction:Y=>kn(u(ke)(H),Y),onRequestFileAction:Y=>yn(u(ke)(H),Y)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):A("",!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},[Xs(v)&&!Zs.value.has(v.id)?(c(),f("li",dc,[m("div",fc,[m("div",hc,[Q(or,{label:to(v),running:no(v),"has-outside-content":so(v)},{default:We(()=>[(c(!0),f(W,null,K(Qs(v),T=>(c(),f(W,{key:eo(T)},[T.type==="batch"?(c(),se(qr,{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(S).has(z.id)&&!u(ge).has(z.id)?(c(),f(W,{key:0},[tt(z)?(c(),f("div",mc,[(c(!0),f(W,null,K(u(ee)(z),(X,Z)=>(c(),se(An,{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"])):wt(z)?(c(),se(Sn,{key:2,message:z,expanded:Jt(z),"content-html":u(E)(z.text),onToggle:X=>Xt(z)},null,8,["message","expanded","content-html","onToggle"])):A("",!0)],64)):A("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!pn(v)&&!u(S).has(v.id)&&!u(ge).has(v.id)&&!(oo(v)&&Js.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",pc,[m("div",vc,[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",kc,[m("div",yc,w(u(J)("Context compacted")),1)])):tt(v)?(c(),f("div",wc,[m("div",bc,[m("div",Cc,[(c(!0),f(W,null,K(u(ee)(v),(T,z)=>(c(),se(An,{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(ve)(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"])):A("",!0)],8,Tc)],8,xc)],8,$c)):H.presentation==="plan"?(c(),f("div",_c,[m("div",Ic,[m("article",Lc,[m("div",Mc,w(u(J)("Plan")),1),(he=u(Ze)(v))!=null&&he.explanation?(c(),f("p",Sc,w((Fe=u(Ze)(v))==null?void 0:Fe.explanation),1)):A("",!0),(ne=u(Ze)(v))!=null&&ne.steps.length?(c(),f("ol",Ac,[(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",Pc,w(vn(T.status)),1),m("span",null,w(T.step),1)],8,Fc))),128))])):A("",!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)},[ct(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,Hc)):(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,Wc))],8,Dc)]))),128))],10,Oc)):A("",!0),v.fileAttachments&&v.fileAttachments.length>0?(c(),f("div",jc,[(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,qc)]))),128))])):A("",!0),v.skills&&v.skills.length>0?(c(),f("div",Uc,[(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",Vc,w(u(J)("Skill")),1),m("span",zc,w(T.name),1)],8,Nc))),128))])):A("",!0),v.text.length>0?(c(),f("article",{key:3,class:"message-card","data-role":v.role},[v.isAutomationRun?(c(),f("div",Gc,[p[8]||(p[8]=m("span",null,"Sent via automation",-1)),v.automationDisplayName?(c(),f("code",Zc,w(v.automationDisplayName),1)):A("",!0)])):A("",!0),v.messageType==="worked"?(c(),f("div",Jc,[m("p",Xc,w(v.text),1)])):wt(v)?(c(),se(Sn,{key:2,message:v,expanded:Jt(v),"content-html":u(E)(v.text),onToggle:T=>Xt(v)},null,8,["message","expanded","content-html","onToggle"])):$o([v.id,v.text,a.cwd,u(r),u(As)],()=>(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",Yc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="heading"?(c(),se(xo(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",Qc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="unorderedList"?(c(),f("ul",eu,[(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,tu)]))),128))])):T.kind==="taskList"?(c(),f("ul",nu,[(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,su),m("div",ou,[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,iu)]))),128))],8,au)):T.kind==="table"?(c(),f("div",ru,[m("table",lu,[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",cu,[(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))])):A("",!0)])])):T.kind==="codeBlock"?(c(),f("div",uu,[T.language?(c(),f("div",du,w(T.language),1)):A("",!0),m("pre",fu,[m("code",{class:"hljs",innerHTML:u(k)(T.language,T.value)},null,8,hu)])])):T.kind==="thematicBreak"?(c(),f("hr",mu)):u(Fs)(v.id,z)?(c(),f("p",gu,w(T.markdown),1)):(c(),f("button",{key:10,class:"message-image-button",type:"button",onClick:X=>u(nn)(T.url)},[ct(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,vu)):(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,ku))],8,pu))],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,yu)):A("",!0)],8,Kc)):A("",!0),Y!=="process"?(c(),se(Ji,{key:4,role:v.role,"show-edit":lo(v),"show-fork":u(ws)(v),"show-copy":u(vs)(v)||u(ks)(v),copied:u(gs)===v.id,onEdit:T=>co(v.id),onFork:T=>ro(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"])):A("",!0)],8,Rc)],8,Bc)],10,Ec))],10,gc)):A("",!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(Mi,{key:2,overlay:e.liveOverlay,"feedback-mailto":u(Zt)},null,8,["overlay","feedback-mailto"])):A("",!0),m("li",{ref_key:"bottomAnchorRef",ref:tn,class:"conversation-bottom-anchor"},null,512)],544)),Q(ur,{anchors:gn.value,"active-turn":Us.value,onJump:zs},null,8,["anchors","active-turn"]),io.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(To,{class:"icon-svg jump-to-latest-icon"})],8,wu)):A("",!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,bu),u(Ss)?(c(),f("video",{key:0,class:"image-modal-image",src:u(nt),controls:"",autoplay:""},null,8,Cu)):(c(),f("img",{key:1,class:"image-modal-image",src:u(nt),alt:u(J)("Expanded message image")},null,8,$u))])])):A("",!0),Q(di,{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(Ua,{change:u(pe),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(oa,{visible:Ce.value!==null,title:Os.value,message:Ds.value,"confirm-label":"Confirm",danger:"",onConfirm:uo,onCancel:p[5]||(p[5]=F=>Ce.value=null)},null,8,["visible","title","message"])],64))}}),Mu=oe(_u,[["__scopeId","data-v-2f3bab98"]]);export{Mu as default};
@@ -1 +1 @@
1
- import{e as De,x as re,f as c,h as Pe,i as p,j as u,F as E,t as d,k as y,u as f,l as I,n as L,a0 as Ne,w as je,m as Qe,p as B,W,y as He,T as Le,c as ie,r as x,v as Be,_ as We}from"./index-Cu_hRJGY.js";const ze={class:"thread-pending-request-title"},Ke=["title"],Ye={class:"thread-pending-request-approval"},Je=["aria-label"],Ze=["aria-pressed","onClick"],Ge={class:"thread-pending-request-option-index"},Xe={class:"thread-pending-request-option-label"},_e={class:"thread-pending-request-footer thread-pending-request-footer--approval"},et=["value","placeholder"],tt={key:0,class:"thread-pending-request-validation-error",role:"alert"},nt={class:"thread-pending-request-header"},rt={class:"thread-pending-request-heading"},it={class:"thread-pending-request-eyebrow"},st={class:"thread-pending-request-title"},ot={key:0,class:"thread-pending-request-counter"},at={key:0,class:"thread-pending-request-preview"},lt={class:"thread-pending-request-preview-code"},ut={key:1,class:"thread-pending-request-validation-error",role:"alert"},dt={key:2,class:"thread-pending-request-user-input"},ct={key:0,class:"thread-pending-request-question-description"},pt=["href"],ft={class:"thread-pending-request-question-title"},ht={key:0},mt={key:0,class:"thread-pending-request-question-text"},gt={key:1,class:"thread-pending-request-input-wrap"},yt={class:"thread-pending-request-select-label"},vt=["type","value","onInput"],qt={key:2,class:"thread-pending-request-select-wrap"},bt={class:"thread-pending-request-select-label"},kt={key:3,class:"thread-pending-request-select-wrap"},At={class:"thread-pending-request-select-label"},wt={key:4,class:"thread-pending-request-question-options"},Ct=["checked","onChange"],Et={class:"thread-pending-request-checkbox-label"},xt={key:2,class:"thread-pending-request-validation-error"},Rt={class:"thread-pending-request-footer"},St={key:3,class:"thread-pending-request-user-input"},$t={class:"thread-pending-request-question-title"},Tt={key:0,class:"thread-pending-request-question-text"},Vt={key:1,class:"thread-pending-request-question-options"},Mt={class:"thread-pending-request-select-wrap"},Ot={class:"thread-pending-request-select-label"},It={key:0,class:"thread-pending-request-question-description"},Ut={key:2,class:"thread-pending-request-input-wrap"},Ft={class:"thread-pending-request-select-label"},Dt=["value","placeholder","onInput"],Pt={class:"thread-pending-request-footer"},Nt={key:4,class:"thread-pending-request-actions"},jt={key:5,class:"thread-pending-request-actions"},Qt=De({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean},panelWidth:{},visualViewportHeight:{},panelError:{}},emits:["respondServerRequest"],setup(s,{emit:se}){const k=s,b=se,oe=ie(()=>{const e=typeof k.panelWidth=="number"&&k.panelWidth>0?k.panelWidth:0,t=typeof k.visualViewportHeight=="number"&&k.visualViewportHeight>0?`${k.visualViewportHeight}px`:"100dvh";return{...e>0?{width:`${e}px`}:{},"--visual-viewport-height":t}}),q=x("accept"),R=x(""),T=x({}),V=x({}),A=x({}),w=x(""),{t:o}=Be();function m(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function h(e){return typeof e=="string"?e.trim():""}function ae(e){return typeof e=="string"?e:null}function le(e){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:JSON.stringify(e)}function ue(e){const n=(Array.isArray(e.commandActions)?e.commandActions:[]).map(r=>m(r)).map(r=>h(r==null?void 0:r.command)).find(r=>r.length>0);if(n)return n.replace(/\s+/g," ").trim();if(Array.isArray(e.command)){const r=e.command.filter(i=>typeof i=="string").map(i=>i.trim()).filter(i=>i.length>0);if(r.length>0)return r.map(i=>le(i)).join(" ")}return pe(h(e.command))}function U(e){return e.method==="item/commandExecution/requestApproval"||e.method==="execCommandApproval"}function F(e){return e.method==="item/fileChange/requestApproval"||e.method==="applyPatchApproval"}function S(e){return e.method==="item/permissions/requestApproval"}function D(e){return U(e)||F(e)||S(e)}function P(e){return e.method==="mcpServer/elicitation/request"}function de(e){const t=m(e.params);return h(t==null?void 0:t.reason)||h(t==null?void 0:t.prompt)||h(t==null?void 0:t.message)}function ce(e){return D(e)?o("Awaiting approval"):P(e)?o("MCP server input required"):e.method==="item/tool/requestUserInput"?o("Awaiting response"):e.method==="item/tool/call"?o("Tool call waiting for response"):e.method}function z(e){const t=de(e);return t||(U(e)?o("Do you want to run this command?"):F(e)?o("Do you want to make these changes?"):S(e)?o("Do you want to grant these permissions?"):P(e)?o("An MCP server needs your input before Codex can continue."):e.method==="item/tool/requestUserInput"?o("Codex needs your answer before it can continue."):o("Codex is waiting for a response before it can continue."))}function pe(e){var a;const t=e.trim();if(!t)return"";const n=t.match(/-Command\s+(.+)$/i),r=((a=n==null?void 0:n[1])==null?void 0:a.trim())??t;return(r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function $(e){const t=m(e.params);if(!t)return"";if(U(e))return ue(t);if(F(e)){const n=h(t.grantRoot)||h(t.grant_root);if(n)return n.replace(/\s+/g," ").trim();const r=m(t.fileChanges)??m(t.changes);if(!r)return"";const i=Object.keys(r).map(a=>a.trim()).filter(a=>a.length>0);return i.length===0?"":i.slice(0,3).join(", ")}return S(e)?fe(t.permissions):P(e)?h(t.serverName)||h(t.url):""}function fe(e){const t=m(e);if(!t)return"";const n=[],r=m(t.fileSystem),i=m(t.network),a=Array.isArray(r==null?void 0:r.read)?r.read.filter(v=>typeof v=="string"):[],l=Array.isArray(r==null?void 0:r.write)?r.write.filter(v=>typeof v=="string"):[];return a.length>0&&n.push(`${o("Read")}: ${a.join(", ")}`),l.length>0&&n.push(`${o("Write")}: ${l.join(", ")}`),(i==null?void 0:i.enabled)===!0&&n.push(o("Network access")),n.join(" • ")}function he(e){return!e||!D(e)?[]:[{id:"accept",label:o("Yes")},{id:"acceptForSession",label:o("Yes for Session")}]}const N=ie(()=>he(k.request));re(()=>{var e;return((e=k.request)==null?void 0:e.id)??0},()=>{var e;R.value="",T.value={},V.value={},A.value={},w.value="",q.value=((e=N.value[0])==null?void 0:e.id)??"accept"},{immediate:!0}),re(N,e=>{var t;q.value!=="decline"&&(e.some(n=>n.id===q.value)||(q.value=((t=e[0])==null?void 0:t.id)??"accept"))},{immediate:!0});function M(e,t){return`${String(e)}:${t}`}function K(e){const t=m(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const i of n){const a=m(i);if(!a)continue;const l=h(a.id);if(!l)continue;const v=Array.isArray(a.options)?a.options.map(g=>m(g)).map(g=>({label:h(g==null?void 0:g.label),description:h(g==null?void 0:g.description)})).filter(g=>g.label.length>0):[];r.push({id:l,header:h(a.header),question:h(a.question),isOther:a.isOther===!0,options:v})}return r}function j(e,t,n){const r=M(e,t),i=T.value[r];return typeof i=="string"&&i.length>0?i:n}function Y(e,t){return V.value[M(e,t)]??""}function me(e,t,n){const r=M(e,t);T.value={...T.value,[r]:n}}function ge(e){return e.options.map(t=>({value:t.label,label:t.label}))}function ye(e,t,n){const r=n.target;if(!(r instanceof HTMLInputElement))return;const i=M(e,t);V.value={...V.value,[i]:r.value}}function J(e,t,n){var i,a;const r=j(e,t,((i=n[0])==null?void 0:i.label)||"");return((a=n.find(l=>l.label===r))==null?void 0:a.description)??""}function O(e,t){return`${String(e)}:${t}`}function Z(e){var t;return h((t=m(e.params))==null?void 0:t.serverName)}function G(e){var n;const t=h((n=m(e.params))==null?void 0:n.url);if(!t)return"";try{const r=new URL(t),i=r.protocol.toLowerCase();return i==="https:"||i==="http:"?r.toString():""}catch{return""}}function Q(e){const t=m(e.params),n=m(t==null?void 0:t.requestedSchema),r=m(n==null?void 0:n.properties);if(!r)return[];const i=new Set(Array.isArray(n==null?void 0:n.required)?n.required.filter(a=>typeof a=="string"):[]);return Object.entries(r).map(([a,l])=>ve(a,m(l),i.has(a))).filter(a=>a!==null)}function ve(e,t,n){if(!t)return null;const r=h(t.title)||e,i=h(t.description),a=h(t.type);if(a==="boolean")return{key:e,label:r,description:i,required:n,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof t.default=="boolean"?t.default:null,hasExplicitDefault:typeof t.default=="boolean"};if(a==="number"||a==="integer")return{key:e,label:r,description:i,required:n,kind:"number",inputType:"number",options:[],defaultValue:typeof t.default=="number"?t.default:null,hasExplicitDefault:typeof t.default=="number"};const l=X(t);if(a==="array")return{key:e,label:r,description:i,required:n,kind:"multiEnum",inputType:"checkbox",options:l,defaultValue:Array.isArray(t.default)?t.default.filter(g=>typeof g=="string"):[],hasExplicitDefault:Array.isArray(t.default)};const v=ae(t.default);return l.length>0?{key:e,label:r,description:i,required:n,kind:"singleEnum",inputType:"select",options:l,defaultValue:v,hasExplicitDefault:v!==null}:{key:e,label:r,description:i,required:n,kind:"string",inputType:qe(t),options:[],defaultValue:v,hasExplicitDefault:v!==null}}function X(e){const n=(Array.isArray(e.oneOf)?e.oneOf:Array.isArray(e.anyOf)?e.anyOf:[]).map(l=>m(l)).map(l=>({value:h(l==null?void 0:l.const),label:h(l==null?void 0:l.title)||h(l==null?void 0:l.const)})).filter(l=>l.value.length>0);if(n.length>0)return n;const r=m(e.items);if(r){const l=X(r);if(l.length>0)return l}const i=Array.isArray(e.enum)?e.enum.filter(l=>typeof l=="string"):[],a=Array.isArray(e.enumNames)?e.enumNames.filter(l=>typeof l=="string"):[];return i.map((l,v)=>({value:l,label:a[v]||l}))}function qe(e){const t=h(e.format);return t==="email"?"email":t==="uri"?"url":t==="date"?"date":t==="date-time"?"datetime-local":"text"}function C(e,t){const n=A.value[O(e,t.key)];return n!==void 0?n:t.defaultValue}function _(e,t){const n=C(e,t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}function be(e,t,n){const r=n.target;r instanceof HTMLInputElement&&ee(e,t,r.value)}function ee(e,t,n){const r=(t.kind==="number",n);A.value={...A.value,[O(e,t.key)]:n.length>0?r:null},w.value=""}function ke(e,t,n){let r=null;n==="true"?r=!0:n==="false"&&(r=!1),A.value={...A.value,[O(e,t.key)]:r},w.value=""}function Ae(e,t,n,r){const i=r.target;if(!(i instanceof HTMLInputElement))return;const a=new Set(_(e,t));i.checked?a.add(n):a.delete(n),A.value={...A.value,[O(e,t.key)]:Array.from(a)},w.value=""}function we(e){return e===!0?"true":e===!1?"false":""}function Ce(e){const t=[{value:"true",label:o("True")},{value:"false",label:o("False")}];return e.hasExplicitDefault||t.unshift({value:"",label:o("Select true or false")}),t}function Ee(e){const t=e.options.map(n=>({value:n.value,label:n.label}));return e.hasExplicitDefault||t.unshift({value:"",label:o("Select an option")}),t}function xe(e,t){const n=C(e,t);return t.kind==="multiEnum"?Array.isArray(n)&&n.length>0:t.kind==="boolean"?typeof n=="boolean":t.kind==="number"&&typeof n=="number"?!0:typeof n=="string"&&n.trim().length>0}function Re(e){const t=Q(e).filter(n=>n.required&&!xe(e.id,n)).map(n=>n.label);return t.length===0?"":t.length===1?`${o("Answer the required field")}: ${t[0]}.`:`${o("Answer the required field")}: ${t.join(", ")}.`}function Se(e){const t={};for(const n of Q(e)){const r=C(e.id,n);if(n.kind==="multiEnum"){const a=Array.isArray(r)?r:[];(a.length>0||n.required)&&(t[n.key]=a);continue}if(n.kind==="boolean"){typeof r=="boolean"&&(t[n.key]=r);continue}if(n.kind==="number"){const a=typeof r=="number"?r:Number(String(r).trim());Number.isNaN(a)||(t[n.key]=a);continue}const i=String(r??"").trim();(i.length>0||n.required)&&(t[n.key]=i)}return t}function $e(e){q.value=e}function Te(){q.value="decline"}function Ve(e){const t=e.target;t instanceof HTMLInputElement&&(R.value=t.value,q.value="decline")}function te(e,t){var n;if(S(e)){if(t==="decline"||t==="cancel"){b("respondServerRequest",{id:e.id,error:{code:-32e3,message:t==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const r=m((n=m(e.params))==null?void 0:n.permissions)??{};b("respondServerRequest",{id:e.id,result:{permissions:r,scope:t==="acceptForSession"?"session":"turn"}});return}b("respondServerRequest",{id:e.id,result:{decision:t}})}function ne(e){const t=R.value.trim(),n=t.length>0?"decline":q.value;if(S(e)){te(e,n);return}b("respondServerRequest",{id:e.id,result:{decision:n},followUpMessageText:t||void 0})}function H(e,t){const n=m(e.params),r={action:t};if(t==="accept"&&h(n==null?void 0:n.mode)==="form"){const i=Re(e);if(i){w.value=i;return}r.content=Se(e)}b("respondServerRequest",{id:e.id,result:r})}function Me(e){var r;const t=K(e),n={};for(const i of t){const a=j(e.id,i.id,((r=i.options[0])==null?void 0:r.label)||""),l=Y(e.id,i.id).trim(),v=[a,l].map(g=>g.trim()).filter(g=>g.length>0);n[i.id]={answers:v}}b("respondServerRequest",{id:e.id,result:{answers:n}})}function Oe(e){b("respondServerRequest",{id:e.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function Ie(e){b("respondServerRequest",{id:e.id,result:{success:!0,contentItems:[]}})}function Ue(e){b("respondServerRequest",{id:e.id,result:{}})}function Fe(e){b("respondServerRequest",{id:e.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(e,t)=>(c(),Pe(Le,{to:"body"},[s.request?(c(),p("section",{key:0,class:"thread-pending-request",style:He(oe.value)},[u("article",{class:L(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":s.hasQueueAbove}])},[D(s.request)?(c(),p(E,{key:0},[u("p",ze,d(z(s.request)),1),$(s.request)?(c(),p("p",{key:0,class:"thread-pending-request-command-line",title:$(s.request)},d($(s.request)),9,Ke)):y("",!0),u("section",Ye,[u("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":f(o)("Approval choices")},[(c(!0),p(E,null,I(N.value,(n,r)=>(c(),p("button",{key:n.id,type:"button",class:L(["thread-pending-request-option",{"is-selected":q.value===n.id}]),"aria-pressed":q.value===n.id,onClick:i=>$e(n.id)},[u("span",Ge,d(r+1)+".",1),u("span",Xe,d(n.label),1)],10,Ze))),128))],8,Je),u("footer",_e,[u("label",{class:L(["thread-pending-request-inline-input",{"is-active":q.value==="decline"||R.value.length>0}])},[t[11]||(t[11]=u("span",{class:"thread-pending-request-option-index"},"3.",-1)),u("input",{class:"thread-pending-request-inline-control",type:"text",value:R.value,placeholder:f(o)("No, and tell Codex what to do differently"),onFocus:Te,onInput:Ve,onKeydown:t[0]||(t[0]=Ne(je(n=>ne(s.request),["prevent"]),["enter"]))},null,40,et)],2),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[1]||(t[1]=n=>te(s.request,"cancel"))},d(f(o)("Skip")),1),u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[2]||(t[2]=n=>ne(s.request))},d(f(o)("Send")),1)]),s.panelError?(c(),p("p",tt,d(s.panelError),1)):y("",!0)])],64)):(c(),p(E,{key:1},[u("header",nt,[u("div",rt,[u("p",it,d(ce(s.request)),1),u("p",st,d(z(s.request)),1)]),(s.requestCount??0)>1?(c(),p("span",ot,d(s.requestCount??0)+" "+d(f(o)("pending")),1)):y("",!0)]),$(s.request)?(c(),p("div",at,[u("code",lt,d($(s.request)),1)])):y("",!0),s.panelError?(c(),p("p",ut,d(s.panelError),1)):y("",!0),s.request.method==="mcpServer/elicitation/request"?(c(),p("section",dt,[Z(s.request)?(c(),p("p",ct,d(f(o)("Server"))+": "+d(Z(s.request)),1)):y("",!0),G(s.request)?(c(),p("a",{key:1,class:"thread-pending-request-link",href:G(s.request),target:"_blank",rel:"noopener noreferrer"},d(f(o)("Open authorization link")),9,pt)):y("",!0),(c(!0),p(E,null,I(Q(s.request),n=>(c(),p("div",{key:`${s.request.id}:${n.key}`,class:"thread-pending-request-question"},[u("p",ft,[Qe(d(n.label),1),n.required?(c(),p("span",ht," *")):y("",!0)]),n.description?(c(),p("p",mt,d(n.description),1)):y("",!0),n.kind==="string"||n.kind==="number"?(c(),p("label",gt,[u("span",yt,d(f(o)("Value")),1),u("input",{class:"thread-pending-request-input",type:n.inputType,value:String(C(s.request.id,n)??""),onInput:r=>be(s.request.id,n,r)},null,40,vt)])):n.kind==="boolean"?(c(),p("div",qt,[u("span",bt,d(f(o)("Choice")),1),B(W,{class:"thread-pending-request-dropdown","model-value":we(C(s.request.id,n)),options:Ce(n),placeholder:f(o)("Select true or false"),"onUpdate:modelValue":r=>ke(s.request.id,n,r)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):n.kind==="singleEnum"?(c(),p("div",kt,[u("span",At,d(f(o)("Choice")),1),B(W,{class:"thread-pending-request-dropdown","model-value":String(C(s.request.id,n)??""),options:Ee(n),placeholder:f(o)("Select an option"),"enable-search":"","search-placeholder":f(o)("Search options..."),"onUpdate:modelValue":r=>ee(s.request.id,n,r)},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])])):(c(),p("div",wt,[(c(!0),p(E,null,I(n.options,r=>(c(),p("label",{key:`${s.request.id}:${n.key}:${r.value}`,class:"thread-pending-request-checkbox-row"},[u("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:_(s.request.id,n).includes(r.value),onChange:i=>Ae(s.request.id,n,r.value,i)},null,40,Ct),u("span",Et,d(r.label),1)]))),128))]))]))),128)),w.value?(c(),p("p",xt,d(w.value),1)):y("",!0),u("footer",Rt,[u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[3]||(t[3]=n=>H(s.request,"cancel"))},d(f(o)("Cancel")),1),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[4]||(t[4]=n=>H(s.request,"decline"))},d(f(o)("Decline")),1),u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[5]||(t[5]=n=>H(s.request,"accept"))},d(f(o)("Continue")),1)])])):s.request.method==="item/tool/requestUserInput"?(c(),p("section",St,[(c(!0),p(E,null,I(K(s.request),n=>{var r;return c(),p("div",{key:`${s.request.id}:${n.id}`,class:"thread-pending-request-question"},[u("p",$t,d(n.header||n.question),1),n.question?(c(),p("p",Tt,d(n.question),1)):y("",!0),n.options.length>0?(c(),p("div",Vt,[u("div",Mt,[u("span",Ot,d(f(o)("Choice")),1),B(W,{class:"thread-pending-request-dropdown","model-value":j(s.request.id,n.id,((r=n.options[0])==null?void 0:r.label)||""),options:ge(n),placeholder:f(o)("Choice"),"onUpdate:modelValue":i=>me(s.request.id,n.id,i)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),J(s.request.id,n.id,n.options)?(c(),p("p",It,d(J(s.request.id,n.id,n.options)),1)):y("",!0)])):y("",!0),n.isOther?(c(),p("label",Ut,[u("span",Ft,d(f(o)("Other answer")),1),u("input",{class:"thread-pending-request-input",type:"text",value:Y(s.request.id,n.id),placeholder:f(o)("Other answer"),onInput:i=>ye(s.request.id,n.id,i)},null,40,Dt)])):y("",!0)])}),128)),u("footer",Pt,[u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[6]||(t[6]=n=>Me(s.request))},d(f(o)("Send")),1)])])):s.request.method==="item/tool/call"?(c(),p("section",Nt,[u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[7]||(t[7]=n=>Oe(s.request))},d(f(o)("Fail Tool Call")),1),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[8]||(t[8]=n=>Ie(s.request))},d(f(o)("Success (Empty)")),1)])):(c(),p("section",jt,[u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[9]||(t[9]=n=>Ue(s.request))},d(f(o)("Return Empty Result")),1),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[10]||(t[10]=n=>Fe(s.request))},d(f(o)("Reject Request")),1)]))],64))],2)],4)):y("",!0)]))}}),Lt=We(Qt,[["__scopeId","data-v-1f49cff5"]]);export{Lt as default};
1
+ import{e as De,x as re,f as c,h as Pe,i as p,j as u,F as E,t as d,k as y,u as f,l as I,n as L,a0 as Ne,w as je,m as Qe,p as B,W,y as He,T as Le,c as ie,r as x,v as Be,_ as We}from"./index-BJ-YiA9y.js";const ze={class:"thread-pending-request-title"},Ke=["title"],Ye={class:"thread-pending-request-approval"},Je=["aria-label"],Ze=["aria-pressed","onClick"],Ge={class:"thread-pending-request-option-index"},Xe={class:"thread-pending-request-option-label"},_e={class:"thread-pending-request-footer thread-pending-request-footer--approval"},et=["value","placeholder"],tt={key:0,class:"thread-pending-request-validation-error",role:"alert"},nt={class:"thread-pending-request-header"},rt={class:"thread-pending-request-heading"},it={class:"thread-pending-request-eyebrow"},st={class:"thread-pending-request-title"},ot={key:0,class:"thread-pending-request-counter"},at={key:0,class:"thread-pending-request-preview"},lt={class:"thread-pending-request-preview-code"},ut={key:1,class:"thread-pending-request-validation-error",role:"alert"},dt={key:2,class:"thread-pending-request-user-input"},ct={key:0,class:"thread-pending-request-question-description"},pt=["href"],ft={class:"thread-pending-request-question-title"},ht={key:0},mt={key:0,class:"thread-pending-request-question-text"},gt={key:1,class:"thread-pending-request-input-wrap"},yt={class:"thread-pending-request-select-label"},vt=["type","value","onInput"],qt={key:2,class:"thread-pending-request-select-wrap"},bt={class:"thread-pending-request-select-label"},kt={key:3,class:"thread-pending-request-select-wrap"},At={class:"thread-pending-request-select-label"},wt={key:4,class:"thread-pending-request-question-options"},Ct=["checked","onChange"],Et={class:"thread-pending-request-checkbox-label"},xt={key:2,class:"thread-pending-request-validation-error"},Rt={class:"thread-pending-request-footer"},St={key:3,class:"thread-pending-request-user-input"},$t={class:"thread-pending-request-question-title"},Tt={key:0,class:"thread-pending-request-question-text"},Vt={key:1,class:"thread-pending-request-question-options"},Mt={class:"thread-pending-request-select-wrap"},Ot={class:"thread-pending-request-select-label"},It={key:0,class:"thread-pending-request-question-description"},Ut={key:2,class:"thread-pending-request-input-wrap"},Ft={class:"thread-pending-request-select-label"},Dt=["value","placeholder","onInput"],Pt={class:"thread-pending-request-footer"},Nt={key:4,class:"thread-pending-request-actions"},jt={key:5,class:"thread-pending-request-actions"},Qt=De({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean},panelWidth:{},visualViewportHeight:{},panelError:{}},emits:["respondServerRequest"],setup(s,{emit:se}){const k=s,b=se,oe=ie(()=>{const e=typeof k.panelWidth=="number"&&k.panelWidth>0?k.panelWidth:0,t=typeof k.visualViewportHeight=="number"&&k.visualViewportHeight>0?`${k.visualViewportHeight}px`:"100dvh";return{...e>0?{width:`${e}px`}:{},"--visual-viewport-height":t}}),q=x("accept"),R=x(""),T=x({}),V=x({}),A=x({}),w=x(""),{t:o}=Be();function m(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function h(e){return typeof e=="string"?e.trim():""}function ae(e){return typeof e=="string"?e:null}function le(e){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:JSON.stringify(e)}function ue(e){const n=(Array.isArray(e.commandActions)?e.commandActions:[]).map(r=>m(r)).map(r=>h(r==null?void 0:r.command)).find(r=>r.length>0);if(n)return n.replace(/\s+/g," ").trim();if(Array.isArray(e.command)){const r=e.command.filter(i=>typeof i=="string").map(i=>i.trim()).filter(i=>i.length>0);if(r.length>0)return r.map(i=>le(i)).join(" ")}return pe(h(e.command))}function U(e){return e.method==="item/commandExecution/requestApproval"||e.method==="execCommandApproval"}function F(e){return e.method==="item/fileChange/requestApproval"||e.method==="applyPatchApproval"}function S(e){return e.method==="item/permissions/requestApproval"}function D(e){return U(e)||F(e)||S(e)}function P(e){return e.method==="mcpServer/elicitation/request"}function de(e){const t=m(e.params);return h(t==null?void 0:t.reason)||h(t==null?void 0:t.prompt)||h(t==null?void 0:t.message)}function ce(e){return D(e)?o("Awaiting approval"):P(e)?o("MCP server input required"):e.method==="item/tool/requestUserInput"?o("Awaiting response"):e.method==="item/tool/call"?o("Tool call waiting for response"):e.method}function z(e){const t=de(e);return t||(U(e)?o("Do you want to run this command?"):F(e)?o("Do you want to make these changes?"):S(e)?o("Do you want to grant these permissions?"):P(e)?o("An MCP server needs your input before Codex can continue."):e.method==="item/tool/requestUserInput"?o("Codex needs your answer before it can continue."):o("Codex is waiting for a response before it can continue."))}function pe(e){var a;const t=e.trim();if(!t)return"";const n=t.match(/-Command\s+(.+)$/i),r=((a=n==null?void 0:n[1])==null?void 0:a.trim())??t;return(r.startsWith('"')&&r.endsWith('"')?r.slice(1,-1):r).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function $(e){const t=m(e.params);if(!t)return"";if(U(e))return ue(t);if(F(e)){const n=h(t.grantRoot)||h(t.grant_root);if(n)return n.replace(/\s+/g," ").trim();const r=m(t.fileChanges)??m(t.changes);if(!r)return"";const i=Object.keys(r).map(a=>a.trim()).filter(a=>a.length>0);return i.length===0?"":i.slice(0,3).join(", ")}return S(e)?fe(t.permissions):P(e)?h(t.serverName)||h(t.url):""}function fe(e){const t=m(e);if(!t)return"";const n=[],r=m(t.fileSystem),i=m(t.network),a=Array.isArray(r==null?void 0:r.read)?r.read.filter(v=>typeof v=="string"):[],l=Array.isArray(r==null?void 0:r.write)?r.write.filter(v=>typeof v=="string"):[];return a.length>0&&n.push(`${o("Read")}: ${a.join(", ")}`),l.length>0&&n.push(`${o("Write")}: ${l.join(", ")}`),(i==null?void 0:i.enabled)===!0&&n.push(o("Network access")),n.join(" • ")}function he(e){return!e||!D(e)?[]:[{id:"accept",label:o("Yes")},{id:"acceptForSession",label:o("Yes for Session")}]}const N=ie(()=>he(k.request));re(()=>{var e;return((e=k.request)==null?void 0:e.id)??0},()=>{var e;R.value="",T.value={},V.value={},A.value={},w.value="",q.value=((e=N.value[0])==null?void 0:e.id)??"accept"},{immediate:!0}),re(N,e=>{var t;q.value!=="decline"&&(e.some(n=>n.id===q.value)||(q.value=((t=e[0])==null?void 0:t.id)??"accept"))},{immediate:!0});function M(e,t){return`${String(e)}:${t}`}function K(e){const t=m(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const i of n){const a=m(i);if(!a)continue;const l=h(a.id);if(!l)continue;const v=Array.isArray(a.options)?a.options.map(g=>m(g)).map(g=>({label:h(g==null?void 0:g.label),description:h(g==null?void 0:g.description)})).filter(g=>g.label.length>0):[];r.push({id:l,header:h(a.header),question:h(a.question),isOther:a.isOther===!0,options:v})}return r}function j(e,t,n){const r=M(e,t),i=T.value[r];return typeof i=="string"&&i.length>0?i:n}function Y(e,t){return V.value[M(e,t)]??""}function me(e,t,n){const r=M(e,t);T.value={...T.value,[r]:n}}function ge(e){return e.options.map(t=>({value:t.label,label:t.label}))}function ye(e,t,n){const r=n.target;if(!(r instanceof HTMLInputElement))return;const i=M(e,t);V.value={...V.value,[i]:r.value}}function J(e,t,n){var i,a;const r=j(e,t,((i=n[0])==null?void 0:i.label)||"");return((a=n.find(l=>l.label===r))==null?void 0:a.description)??""}function O(e,t){return`${String(e)}:${t}`}function Z(e){var t;return h((t=m(e.params))==null?void 0:t.serverName)}function G(e){var n;const t=h((n=m(e.params))==null?void 0:n.url);if(!t)return"";try{const r=new URL(t),i=r.protocol.toLowerCase();return i==="https:"||i==="http:"?r.toString():""}catch{return""}}function Q(e){const t=m(e.params),n=m(t==null?void 0:t.requestedSchema),r=m(n==null?void 0:n.properties);if(!r)return[];const i=new Set(Array.isArray(n==null?void 0:n.required)?n.required.filter(a=>typeof a=="string"):[]);return Object.entries(r).map(([a,l])=>ve(a,m(l),i.has(a))).filter(a=>a!==null)}function ve(e,t,n){if(!t)return null;const r=h(t.title)||e,i=h(t.description),a=h(t.type);if(a==="boolean")return{key:e,label:r,description:i,required:n,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof t.default=="boolean"?t.default:null,hasExplicitDefault:typeof t.default=="boolean"};if(a==="number"||a==="integer")return{key:e,label:r,description:i,required:n,kind:"number",inputType:"number",options:[],defaultValue:typeof t.default=="number"?t.default:null,hasExplicitDefault:typeof t.default=="number"};const l=X(t);if(a==="array")return{key:e,label:r,description:i,required:n,kind:"multiEnum",inputType:"checkbox",options:l,defaultValue:Array.isArray(t.default)?t.default.filter(g=>typeof g=="string"):[],hasExplicitDefault:Array.isArray(t.default)};const v=ae(t.default);return l.length>0?{key:e,label:r,description:i,required:n,kind:"singleEnum",inputType:"select",options:l,defaultValue:v,hasExplicitDefault:v!==null}:{key:e,label:r,description:i,required:n,kind:"string",inputType:qe(t),options:[],defaultValue:v,hasExplicitDefault:v!==null}}function X(e){const n=(Array.isArray(e.oneOf)?e.oneOf:Array.isArray(e.anyOf)?e.anyOf:[]).map(l=>m(l)).map(l=>({value:h(l==null?void 0:l.const),label:h(l==null?void 0:l.title)||h(l==null?void 0:l.const)})).filter(l=>l.value.length>0);if(n.length>0)return n;const r=m(e.items);if(r){const l=X(r);if(l.length>0)return l}const i=Array.isArray(e.enum)?e.enum.filter(l=>typeof l=="string"):[],a=Array.isArray(e.enumNames)?e.enumNames.filter(l=>typeof l=="string"):[];return i.map((l,v)=>({value:l,label:a[v]||l}))}function qe(e){const t=h(e.format);return t==="email"?"email":t==="uri"?"url":t==="date"?"date":t==="date-time"?"datetime-local":"text"}function C(e,t){const n=A.value[O(e,t.key)];return n!==void 0?n:t.defaultValue}function _(e,t){const n=C(e,t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}function be(e,t,n){const r=n.target;r instanceof HTMLInputElement&&ee(e,t,r.value)}function ee(e,t,n){const r=(t.kind==="number",n);A.value={...A.value,[O(e,t.key)]:n.length>0?r:null},w.value=""}function ke(e,t,n){let r=null;n==="true"?r=!0:n==="false"&&(r=!1),A.value={...A.value,[O(e,t.key)]:r},w.value=""}function Ae(e,t,n,r){const i=r.target;if(!(i instanceof HTMLInputElement))return;const a=new Set(_(e,t));i.checked?a.add(n):a.delete(n),A.value={...A.value,[O(e,t.key)]:Array.from(a)},w.value=""}function we(e){return e===!0?"true":e===!1?"false":""}function Ce(e){const t=[{value:"true",label:o("True")},{value:"false",label:o("False")}];return e.hasExplicitDefault||t.unshift({value:"",label:o("Select true or false")}),t}function Ee(e){const t=e.options.map(n=>({value:n.value,label:n.label}));return e.hasExplicitDefault||t.unshift({value:"",label:o("Select an option")}),t}function xe(e,t){const n=C(e,t);return t.kind==="multiEnum"?Array.isArray(n)&&n.length>0:t.kind==="boolean"?typeof n=="boolean":t.kind==="number"&&typeof n=="number"?!0:typeof n=="string"&&n.trim().length>0}function Re(e){const t=Q(e).filter(n=>n.required&&!xe(e.id,n)).map(n=>n.label);return t.length===0?"":t.length===1?`${o("Answer the required field")}: ${t[0]}.`:`${o("Answer the required field")}: ${t.join(", ")}.`}function Se(e){const t={};for(const n of Q(e)){const r=C(e.id,n);if(n.kind==="multiEnum"){const a=Array.isArray(r)?r:[];(a.length>0||n.required)&&(t[n.key]=a);continue}if(n.kind==="boolean"){typeof r=="boolean"&&(t[n.key]=r);continue}if(n.kind==="number"){const a=typeof r=="number"?r:Number(String(r).trim());Number.isNaN(a)||(t[n.key]=a);continue}const i=String(r??"").trim();(i.length>0||n.required)&&(t[n.key]=i)}return t}function $e(e){q.value=e}function Te(){q.value="decline"}function Ve(e){const t=e.target;t instanceof HTMLInputElement&&(R.value=t.value,q.value="decline")}function te(e,t){var n;if(S(e)){if(t==="decline"||t==="cancel"){b("respondServerRequest",{id:e.id,error:{code:-32e3,message:t==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const r=m((n=m(e.params))==null?void 0:n.permissions)??{};b("respondServerRequest",{id:e.id,result:{permissions:r,scope:t==="acceptForSession"?"session":"turn"}});return}b("respondServerRequest",{id:e.id,result:{decision:t}})}function ne(e){const t=R.value.trim(),n=t.length>0?"decline":q.value;if(S(e)){te(e,n);return}b("respondServerRequest",{id:e.id,result:{decision:n},followUpMessageText:t||void 0})}function H(e,t){const n=m(e.params),r={action:t};if(t==="accept"&&h(n==null?void 0:n.mode)==="form"){const i=Re(e);if(i){w.value=i;return}r.content=Se(e)}b("respondServerRequest",{id:e.id,result:r})}function Me(e){var r;const t=K(e),n={};for(const i of t){const a=j(e.id,i.id,((r=i.options[0])==null?void 0:r.label)||""),l=Y(e.id,i.id).trim(),v=[a,l].map(g=>g.trim()).filter(g=>g.length>0);n[i.id]={answers:v}}b("respondServerRequest",{id:e.id,result:{answers:n}})}function Oe(e){b("respondServerRequest",{id:e.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function Ie(e){b("respondServerRequest",{id:e.id,result:{success:!0,contentItems:[]}})}function Ue(e){b("respondServerRequest",{id:e.id,result:{}})}function Fe(e){b("respondServerRequest",{id:e.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(e,t)=>(c(),Pe(Le,{to:"body"},[s.request?(c(),p("section",{key:0,class:"thread-pending-request",style:He(oe.value)},[u("article",{class:L(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":s.hasQueueAbove}])},[D(s.request)?(c(),p(E,{key:0},[u("p",ze,d(z(s.request)),1),$(s.request)?(c(),p("p",{key:0,class:"thread-pending-request-command-line",title:$(s.request)},d($(s.request)),9,Ke)):y("",!0),u("section",Ye,[u("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":f(o)("Approval choices")},[(c(!0),p(E,null,I(N.value,(n,r)=>(c(),p("button",{key:n.id,type:"button",class:L(["thread-pending-request-option",{"is-selected":q.value===n.id}]),"aria-pressed":q.value===n.id,onClick:i=>$e(n.id)},[u("span",Ge,d(r+1)+".",1),u("span",Xe,d(n.label),1)],10,Ze))),128))],8,Je),u("footer",_e,[u("label",{class:L(["thread-pending-request-inline-input",{"is-active":q.value==="decline"||R.value.length>0}])},[t[11]||(t[11]=u("span",{class:"thread-pending-request-option-index"},"3.",-1)),u("input",{class:"thread-pending-request-inline-control",type:"text",value:R.value,placeholder:f(o)("No, and tell Codex what to do differently"),onFocus:Te,onInput:Ve,onKeydown:t[0]||(t[0]=Ne(je(n=>ne(s.request),["prevent"]),["enter"]))},null,40,et)],2),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[1]||(t[1]=n=>te(s.request,"cancel"))},d(f(o)("Skip")),1),u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[2]||(t[2]=n=>ne(s.request))},d(f(o)("Send")),1)]),s.panelError?(c(),p("p",tt,d(s.panelError),1)):y("",!0)])],64)):(c(),p(E,{key:1},[u("header",nt,[u("div",rt,[u("p",it,d(ce(s.request)),1),u("p",st,d(z(s.request)),1)]),(s.requestCount??0)>1?(c(),p("span",ot,d(s.requestCount??0)+" "+d(f(o)("pending")),1)):y("",!0)]),$(s.request)?(c(),p("div",at,[u("code",lt,d($(s.request)),1)])):y("",!0),s.panelError?(c(),p("p",ut,d(s.panelError),1)):y("",!0),s.request.method==="mcpServer/elicitation/request"?(c(),p("section",dt,[Z(s.request)?(c(),p("p",ct,d(f(o)("Server"))+": "+d(Z(s.request)),1)):y("",!0),G(s.request)?(c(),p("a",{key:1,class:"thread-pending-request-link",href:G(s.request),target:"_blank",rel:"noopener noreferrer"},d(f(o)("Open authorization link")),9,pt)):y("",!0),(c(!0),p(E,null,I(Q(s.request),n=>(c(),p("div",{key:`${s.request.id}:${n.key}`,class:"thread-pending-request-question"},[u("p",ft,[Qe(d(n.label),1),n.required?(c(),p("span",ht," *")):y("",!0)]),n.description?(c(),p("p",mt,d(n.description),1)):y("",!0),n.kind==="string"||n.kind==="number"?(c(),p("label",gt,[u("span",yt,d(f(o)("Value")),1),u("input",{class:"thread-pending-request-input",type:n.inputType,value:String(C(s.request.id,n)??""),onInput:r=>be(s.request.id,n,r)},null,40,vt)])):n.kind==="boolean"?(c(),p("div",qt,[u("span",bt,d(f(o)("Choice")),1),B(W,{class:"thread-pending-request-dropdown","model-value":we(C(s.request.id,n)),options:Ce(n),placeholder:f(o)("Select true or false"),"onUpdate:modelValue":r=>ke(s.request.id,n,r)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):n.kind==="singleEnum"?(c(),p("div",kt,[u("span",At,d(f(o)("Choice")),1),B(W,{class:"thread-pending-request-dropdown","model-value":String(C(s.request.id,n)??""),options:Ee(n),placeholder:f(o)("Select an option"),"enable-search":"","search-placeholder":f(o)("Search options..."),"onUpdate:modelValue":r=>ee(s.request.id,n,r)},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])])):(c(),p("div",wt,[(c(!0),p(E,null,I(n.options,r=>(c(),p("label",{key:`${s.request.id}:${n.key}:${r.value}`,class:"thread-pending-request-checkbox-row"},[u("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:_(s.request.id,n).includes(r.value),onChange:i=>Ae(s.request.id,n,r.value,i)},null,40,Ct),u("span",Et,d(r.label),1)]))),128))]))]))),128)),w.value?(c(),p("p",xt,d(w.value),1)):y("",!0),u("footer",Rt,[u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[3]||(t[3]=n=>H(s.request,"cancel"))},d(f(o)("Cancel")),1),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[4]||(t[4]=n=>H(s.request,"decline"))},d(f(o)("Decline")),1),u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[5]||(t[5]=n=>H(s.request,"accept"))},d(f(o)("Continue")),1)])])):s.request.method==="item/tool/requestUserInput"?(c(),p("section",St,[(c(!0),p(E,null,I(K(s.request),n=>{var r;return c(),p("div",{key:`${s.request.id}:${n.id}`,class:"thread-pending-request-question"},[u("p",$t,d(n.header||n.question),1),n.question?(c(),p("p",Tt,d(n.question),1)):y("",!0),n.options.length>0?(c(),p("div",Vt,[u("div",Mt,[u("span",Ot,d(f(o)("Choice")),1),B(W,{class:"thread-pending-request-dropdown","model-value":j(s.request.id,n.id,((r=n.options[0])==null?void 0:r.label)||""),options:ge(n),placeholder:f(o)("Choice"),"onUpdate:modelValue":i=>me(s.request.id,n.id,i)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),J(s.request.id,n.id,n.options)?(c(),p("p",It,d(J(s.request.id,n.id,n.options)),1)):y("",!0)])):y("",!0),n.isOther?(c(),p("label",Ut,[u("span",Ft,d(f(o)("Other answer")),1),u("input",{class:"thread-pending-request-input",type:"text",value:Y(s.request.id,n.id),placeholder:f(o)("Other answer"),onInput:i=>ye(s.request.id,n.id,i)},null,40,Dt)])):y("",!0)])}),128)),u("footer",Pt,[u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[6]||(t[6]=n=>Me(s.request))},d(f(o)("Send")),1)])])):s.request.method==="item/tool/call"?(c(),p("section",Nt,[u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[7]||(t[7]=n=>Oe(s.request))},d(f(o)("Fail Tool Call")),1),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[8]||(t[8]=n=>Ie(s.request))},d(f(o)("Success (Empty)")),1)])):(c(),p("section",jt,[u("button",{type:"button",class:"thread-pending-request-primary",onClick:t[9]||(t[9]=n=>Ue(s.request))},d(f(o)("Return Empty Result")),1),u("button",{type:"button",class:"thread-pending-request-secondary",onClick:t[10]||(t[10]=n=>Fe(s.request))},d(f(o)("Reject Request")),1)]))],64))],2)],4)):y("",!0)]))}}),Lt=We(Qt,[["__scopeId","data-v-1f49cff5"]]);export{Lt as default};
@@ -1,4 +1,4 @@
1
- import{e as dn,r as ct,O as un,P as _n,o as fn,x as pn,Q as vs,J as gn,R as vn,S as mn,U as Sn,f as Ht,i as Wt,j as Ke,F as wn,l as bn,n as ms,t as zt,u as Ft,k as yn,v as Cn,V as kn,_ as xn}from"./index-Cu_hRJGY.js";/**
1
+ import{e as dn,r as ct,O as un,P as _n,o as fn,x as pn,Q as vs,J as gn,R as vn,S as mn,U as Sn,f as Ht,i as Wt,j as Ke,F as wn,l as bn,n as ms,t as zt,u as Ft,k as yn,v as Cn,V as kn,_ as xn}from"./index-BJ-YiA9y.js";/**
2
2
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
3
3
  * @license MIT
4
4
  *