codex-mobile-re 0.1.111 → 0.1.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{e as Ze,H as Je,r as y,x as G,O as Qe,P as et,o as tt,f as o,h as at,p as Z,s as ke,j as a,n as se,u as c,w as ne,t as s,i as r,k as w,I as st,W as nt,F as C,l as E,y as U,m as N,q as ge,T as it,v as lt,c as b,X as ot,Y as rt,Z as ut,_ as dt}from"./index-kOwa0g4Z.js";const ct={class:"review-pane-header"},vt={class:"review-pane-heading"},pt={class:"review-pane-eyebrow"},ht={class:"review-pane-title"},ft={class:"review-pane-header-actions"},wt=["aria-label"],mt={class:"review-pane-toolbar"},_t={class:"review-pane-toolbar-controls"},yt={key:0,class:"review-pane-control-cluster"},bt={class:"review-pane-control-label"},kt={class:"review-pane-segmented"},gt=["data-active"],Ct=["data-active","disabled"],Bt={key:1,class:"review-pane-control-cluster"},Ft={class:"review-pane-control-label"},St={key:2,class:"review-pane-control-cluster"},It={class:"review-pane-control-label"},xt={class:"review-pane-segmented"},Lt=["data-active"],$t=["data-active"],At={class:"review-pane-toolbar-actions"},Pt=["disabled"],Et={key:1,class:"review-pane-meta"},Rt={class:"review-pane-summary-pill review-pane-summary-pill-add"},Tt={class:"review-pane-summary-pill review-pane-summary-pill-remove"},Nt={key:0},Mt={key:1},Dt={key:2},Wt={class:"review-pane-content"},zt={key:0,class:"review-pane-empty"},Vt={class:"review-pane-empty-title"},Gt={key:1,class:"review-pane-empty"},Ut={class:"review-pane-empty-title"},Ht={class:"review-pane-empty-text"},Ot=["disabled"],Xt={key:2,class:"review-pane-empty"},Kt={class:"review-pane-empty-title"},jt={class:"review-pane-empty-text"},Yt={key:0,class:"review-pane-bulk-actions"},qt=["disabled","onClick"],Zt={key:1,class:"review-pane-empty"},Jt={class:"review-pane-empty-title"},Qt={class:"review-pane-empty-text"},ea={key:0,class:"review-pane-file-list"},ta=["data-expanded","onClick"],aa=["data-expanded"],sa={class:"review-pane-tree-folder-name"},na={class:"review-pane-tree-folder-count"},ia=["data-active","title","onClick"],la={class:"review-pane-file-meta-row"},oa={class:"review-pane-file-path"},ra={class:"review-pane-file-delta"},ua={class:"review-pane-delta-add"},da={class:"review-pane-delta-remove"},ca=["data-operation"],va={class:"review-pane-diff"},pa={class:"review-pane-file-header"},ha={class:"review-pane-file-header-main"},fa={class:"review-pane-file-title"},wa={class:"review-pane-file-subtitle"},ma={key:0,class:"review-pane-row-actions"},_a=["disabled","onClick"],ya={key:0,class:"review-pane-raw-diff"},ba={key:1,class:"review-pane-hunks"},ka=["data-active","onClick"],ga={class:"review-pane-hunk-header"},Ca={class:"review-pane-hunk-title"},Ba={class:"review-pane-hunk-meta"},Fa={key:0,class:"review-pane-row-actions"},Sa=["disabled","onClick"],Ia={class:"review-pane-lines"},xa=["data-kind"],La={class:"review-pane-line-number"},$a={class:"review-pane-line-number"},Aa={class:"review-pane-line-marker"},Pa={class:"review-pane-line-code"},Ea={class:"review-pane-sheet-header"},Ra={class:"review-pane-sheet-title"},Ta={class:"review-pane-sheet-count"},Na={class:"review-pane-sheet-list"},Ma=["data-expanded","onClick"],Da=["data-expanded"],Wa={class:"review-pane-tree-folder-name"},za={class:"review-pane-tree-folder-count"},Va=["data-active","title","onClick"],Ga={class:"review-pane-file-meta-row"},Ua={class:"review-pane-file-path"},Ha={class:"review-pane-file-delta"},Oa={class:"review-pane-delta-add"},Xa={class:"review-pane-delta-remove"},Ka=["data-operation"],Ce="codex-web-local.review-pane-file-list-width.v1",ja=220,Ya=420,Be=288,qa=Ze({__name:"ReviewPane",props:{threadId:{},cwd:{},isThreadInProgress:{type:Boolean},initialFilePath:{},commitSha:{}},emits:["close"],setup(Fe,{emit:Se}){const g=Fe,Ie=Se,{isMobile:B}=Je(),{t:l}=lt(),m=y("workspace"),F=y("unstaged"),d=y(null),x=y(""),H=y(!1),L=y(""),I=y(""),O=y(!1),J=y(!1),R=y(!1),X=y(!1),M=y(""),$=y(""),K=y("");let j=null,A=null;const k=b(()=>{var e,t;return((e=d.value)==null?void 0:e.files.find(u=>u.id===L.value))??((t=d.value)==null?void 0:t.files[0])??null}),T=y({}),S=b(()=>{var e;return!!((e=g.commitSha)!=null&&e.trim())}),xe=b(()=>{var e;return(((e=d.value)==null?void 0:e.baseBranchOptions)??[]).map(t=>({value:t,label:t}))}),Le=b(()=>{var e;return((e=d.value)==null?void 0:e.scope)==="commit"||S.value?l("No file changes in this commit."):m.value==="workspace"?l("Your current workspace is clean."):l("No merge diff found against the base branch.")});function ie(e){return e.trim().replace(/\\/g,"/")}function $e(e){const t=ie(e);return!t||!d.value?null:d.value.files.find(u=>[u.path,u.absolutePath,u.previousPath,u.previousAbsolutePath].some(v=>typeof v=="string"&&ie(v)===t))??null}function le(){const e=$e(g.initialFilePath??"");return e?(te(e.id),!0):!1}const Ae=b(()=>{var e,t;return(e=d.value)!=null&&e.isGitRepo?S.value?d.value.commitSha?`${l("Commit")} ${ye(d.value.commitSha)}`:l("Commit"):m.value==="workspace"?F.value==="staged"?l("Staged changes"):l("Workspace changes"):(t=d.value)!=null&&t.baseBranch?`${l("Against")} ${d.value.baseBranch}`:l("Base branch"):l("Repository review")}),oe=b(()=>{var e;return!S.value&&m.value==="workspace"&&((e=d.value)==null?void 0:e.isGitRepo)===!0&&d.value.files.length>0}),re=b(()=>oe.value&&!R.value),Pe=b(()=>F.value==="staged"?[{value:"unstage",label:l("Unstage all")}]:[{value:"stage",label:l("Stage all")},{value:"revert",label:l("Revert all")}]),Ee=b(()=>F.value==="staged"?[{value:"unstage",label:l("Unstage file")}]:[{value:"stage",label:l("Stage file")},{value:"revert",label:l("Revert file")}]),Re=b(()=>F.value==="staged"?[{value:"unstage",label:l("Unstage hunk")}]:[{value:"stage",label:l("Stage hunk")},{value:"revert",label:l("Revert hunk")}]),ue=b(()=>$.value||M.value||K.value),Te=b(()=>!!($.value||M.value)),Y=y(De()),Ne=b(()=>{const e={};return B.value||(e["--review-file-list-width"]=`${Y.value}px`),e}),de=b(()=>{var e;return Ge(((e=d.value)==null?void 0:e.files)??[],T.value)}),ce=b(()=>de.value.nodes),Me=b(()=>de.value.folderIdsByFileId);function Q(e){return Number.isFinite(e)?Math.min(Ya,Math.max(ja,Math.round(e))):Be}function De(){if(typeof window>"u")return Be;const e=window.localStorage.getItem(Ce),t=e?Number(e):Number.NaN;return Q(t)}function We(e){typeof window>"u"||window.localStorage.setItem(Ce,String(Q(e)))}function ze(e){if(B.value)return;e.preventDefault(),A==null||A();const t=e.clientX,u=Y.value,v=i=>{Y.value=Q(u+(i.clientX-t))},p=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",n),A=null},n=()=>{p(),We(Y.value)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",n),A=p}function Ve(e){return e==="add"?"+":e==="remove"?"-":e==="hunk"?"@@":" "}function ve(e){const t=e.split("/").filter(Boolean);return t[t.length-1]??e}function pe(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function Ge(e,t){const u={folders:new Map,files:[]},v={};for(const f of e){const _=f.path.split("/").filter(Boolean),W=_.pop()??f.path;let h=u,P="";const be=[];for(const[qe,z]of _.entries()){P=P?`${P}/${z}`:z;let V=h.folders.get(z);V||(V={id:P,name:z,depth:qe,folders:new Map,files:[]},h.folders.set(z,V)),h=V,be.push(V.id)}h.files.push({file:f,name:W,depth:_.length}),v[f.id]=be}const p=[],n=f=>f.files.length+Array.from(f.folders.values()).reduce((_,W)=>_+n(W),0),i=f=>{const _=Array.from(f.folders.values()).sort((h,P)=>pe(h.name,P.name)),W=[...f.files].sort((h,P)=>pe(h.name,P.name));for(const h of _)p.push({kind:"folder",treeKey:`folder:${h.id}`,id:h.id,name:h.name,depth:h.depth,fileCount:n(h)}),t[h.id]!==!1&&i(h);for(const h of W)p.push({kind:"file",treeKey:`file:${h.file.id}`,id:h.file.id,name:h.name,depth:h.depth,file:h.file})};return i(u),{nodes:p,folderIdsByFileId:v}}function D(e){return T.value[e]!==!1}function he(e){T.value={...T.value,[e]:!D(e)}}function fe(e){const t=Me.value[e]??[];if(t.length===0)return;const u={...T.value};let v=!1;for(const p of t)u[p]===!1&&(u[p]=!0,v=!0);v&&(T.value=u)}function we(e){const t=B.value?8:10,u=B.value?12:14;return{paddingLeft:`${t+e*u}px`}}function me(){return{paddingLeft:B.value?"8px":"10px"}}function ee(e){return l(e==="add"?"Added":e==="delete"?"Deleted":e==="rename"?"Renamed":"Modified")}function Ue(e){const t=e.params!==null&&typeof e.params=="object"&&!Array.isArray(e.params)?e.params:null;return typeof(t==null?void 0:t.threadId)=="string"?t.threadId:""}async function q(){var e,t,u,v;if(g.cwd.trim()){J.value=!0,M.value="";try{const p=m.value==="baseBranch"?x.value.trim():"",n=((e=g.commitSha)==null?void 0:e.trim())??"",i=await ot(g.cwd,S.value?"commit":m.value,F.value,p||null,n||null);if(i.baseBranchOptions.length>0){const _=i.baseBranch??i.baseBranchOptions[0]??"";x.value!==_&&(H.value=!0,x.value=_)}else x.value!==""&&(H.value=!0,x.value="");d.value=i;const f=i.files.some(_=>_.id===L.value);!le()&&!f&&(L.value=((t=i.files[0])==null?void 0:t.id)??"",I.value=((v=(u=i.files[0])==null?void 0:u.hunks[0])==null?void 0:v.id)??"")}catch(p){M.value=p instanceof Error?p.message:"Failed to load review snapshot"}finally{J.value=!1}}}async function _e(){await q()}function He(){Ie("close")}function te(e){var u,v;fe(e),L.value=e;const t=((u=d.value)==null?void 0:u.files.find(p=>p.id===e))??null;I.value=((v=t==null?void 0:t.hunks[0])==null?void 0:v.id)??"",B.value&&(O.value=!1)}function ye(e){return e.trim().slice(0,7)}async function ae(e,t,u=""){var v,p,n;if(d.value){R.value=!0,$.value="";try{const i=await ut({cwd:g.cwd,scope:m.value,workspaceView:F.value,action:e,level:t,patch:u});d.value=i,i.files.some(_=>_.id===L.value)||(L.value=((v=i.files[0])==null?void 0:v.id)??"",I.value=((n=(p=i.files[0])==null?void 0:p.hunks[0])==null?void 0:n.id)??"")}catch(i){$.value=i instanceof Error?i.message:"Failed to apply review action"}finally{R.value=!1}}}async function Oe(e){await ae(e,"all")}async function Xe(e,t){await ae(e,"file",t.diff)}async function Ke(e,t){I.value=t.id,await ae(e,"hunk",t.patch)}async function je(){if(g.cwd.trim()){X.value=!0,$.value="";try{await rt(g.cwd),await q()}catch(e){$.value=e instanceof Error?e.message:"Failed to initialize Git"}finally{X.value=!1}}}function Ye(e){if(Ue(e)!==g.threadId)return;const t=e.params!==null&&typeof e.params=="object"&&!Array.isArray(e.params)?e.params:null,u=(t==null?void 0:t.item)!==null&&typeof(t==null?void 0:t.item)=="object"&&!Array.isArray(t.item)?t.item:null,v=typeof(u==null?void 0:u.type)=="string"?u.type:"";if(e.method==="item/started"&&v==="enteredReviewMode"){K.value=typeof(u==null?void 0:u.review)=="string"?u.review:"Review in progress";return}e.method==="item/completed"&&v==="exitedReviewMode"&&(K.value="")}return G(()=>[g.threadId,g.cwd,g.commitSha],()=>{S.value&&(m.value="workspace"),L.value="",I.value="",$.value="",K.value="",_e()},{immediate:!0}),G(()=>[g.initialFilePath,g.commitSha],()=>{le()}),G(()=>[m.value,F.value],()=>{L.value="",I.value="",$.value="",M.value="",q()}),G(x,(e,t)=>{if(H.value){H.value=!1;return}m.value==="baseBranch"&&(!e||e===t||q())}),G(k,e=>{var t;e&&(fe(e.id),e.hunks.some(u=>u.id===I.value)||(I.value=((t=e.hunks[0])==null?void 0:t.id)??""))}),Qe(()=>{j=et(Ye)}),tt(()=>{j&&(j(),j=null),A==null||A()}),(e,t)=>(o(),at(it,{to:"body"},[Z(ge,{name:"review-pane-modal"},{default:ke(()=>{var u,v,p;return[a("div",{class:se(["review-pane-backdrop",{"is-mobile":c(B)}]),onClick:He},[a("section",{class:se(["review-pane",{"is-mobile":c(B)}]),onPointerdown:t[9]||(t[9]=ne(()=>{},["stop"])),onClick:t[10]||(t[10]=ne(()=>{},["stop"]))},[a("header",ct,[a("div",vt,[a("p",pt,s(c(l)("Review")),1),a("p",ht,s(Ae.value),1)]),a("div",ft,[c(B)&&((u=d.value)!=null&&u.files.length)?(o(),r("button",{key:0,type:"button",class:"review-pane-mobile-files-button",onClick:t[0]||(t[0]=n=>O.value=!0)},s(c(l)("Files")),1)):w("",!0),a("button",{type:"button",class:"review-pane-close","aria-label":c(l)("Close review pane"),onClick:t[1]||(t[1]=n=>e.$emit("close"))},[Z(st,{class:"icon-svg"})],8,wt)])]),a("div",mt,[a("div",_t,[S.value?w("",!0):(o(),r("div",yt,[a("span",bt,s(c(l)("Compare")),1),a("div",kt,[a("button",{type:"button",class:"review-pane-segmented-button review-pane-scope","data-active":m.value==="workspace",onClick:t[2]||(t[2]=n=>m.value="workspace")},s(c(l)("Workspace")),9,gt),a("button",{type:"button",class:"review-pane-segmented-button review-pane-scope","data-active":m.value==="baseBranch",disabled:!((v=d.value)!=null&&v.baseBranch),onClick:t[3]||(t[3]=n=>m.value="baseBranch")},s(c(l)("Base branch")),9,Ct)])])),!S.value&&m.value==="baseBranch"&&((p=d.value)!=null&&p.baseBranchOptions.length)?(o(),r("div",Bt,[a("span",Ft,s(c(l)("Branch")),1),Z(nt,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=n=>x.value=n),class:"review-pane-branch-dropdown",options:xe.value,placeholder:c(l)("Branch"),"enable-search":"","search-placeholder":c(l)("Search branches...")},null,8,["modelValue","options","placeholder","search-placeholder"])])):w("",!0),!S.value&&m.value==="workspace"?(o(),r("div",St,[a("span",It,s(c(l)("Changes")),1),a("div",xt,[a("button",{type:"button",class:"review-pane-segmented-button review-pane-view","data-active":F.value==="unstaged",onClick:t[5]||(t[5]=n=>F.value="unstaged")},s(c(l)("Unstaged")),9,Lt),a("button",{type:"button",class:"review-pane-segmented-button review-pane-view","data-active":F.value==="staged",onClick:t[6]||(t[6]=n=>F.value="staged")},s(c(l)("Staged")),9,$t)])])):w("",!0)]),a("div",At,[a("button",{type:"button",class:"review-pane-refresh",disabled:J.value,onClick:_e},s(c(l)("Refresh")),9,Pt)])]),ue.value?(o(),r("div",{key:0,class:se(["review-pane-banner",{"is-error":Te.value}])},s(ue.value),3)):w("",!0),d.value?(o(),r("div",Et,[a("span",null,s(d.value.summary.fileCount)+" "+s(c(l)("files")),1),a("span",Rt,"+"+s(d.value.summary.addedLineCount),1),a("span",Tt,"-"+s(d.value.summary.removedLineCount),1),d.value.headBranch?(o(),r("span",Nt,s(d.value.headBranch),1)):w("",!0),S.value&&d.value.commitSha?(o(),r("span",Mt,s(ye(d.value.commitSha)),1)):w("",!0),!S.value&&m.value==="baseBranch"&&d.value.baseBranch?(o(),r("span",Dt,"vs "+s(d.value.baseBranch),1)):w("",!0)])):w("",!0),a("div",Wt,[d.value?d.value.isGitRepo?!S.value&&m.value==="baseBranch"&&!d.value.baseBranch?(o(),r("div",Xt,[a("p",Kt,s(c(l)("Base branch unavailable")),1),a("p",jt,s(c(l)("Could not resolve `origin/HEAD`, `main`, or `master` for this repository.")),1)])):(o(),r(C,{key:3},[oe.value?(o(),r("div",Yt,[(o(!0),r(C,null,E(Pe.value,n=>(o(),r("button",{key:n.value,type:"button",class:"review-pane-bulk-button",disabled:R.value,onClick:i=>Oe(n.value)},s(n.label),9,qt))),128))])):w("",!0),d.value.files.length?(o(),r("div",{key:2,class:"review-pane-main",style:U(Ne.value)},[c(B)?w("",!0):(o(),r("aside",ea,[(o(!0),r(C,null,E(ce.value,n=>{var i;return o(),r(C,{key:n.treeKey},[n.kind==="folder"?(o(),r("button",{key:0,type:"button",class:"review-pane-tree-folder",style:U(we(n.depth)),"data-expanded":D(n.id),onClick:f=>he(n.id)},[a("span",{class:"review-pane-tree-caret","data-expanded":D(n.id)},null,8,aa),a("span",sa,s(n.name),1),a("span",na,s(n.fileCount),1)],12,ta)):(o(),r("button",{key:1,type:"button",class:"review-pane-file review-pane-tree-file",style:U(me()),"data-active":((i=k.value)==null?void 0:i.id)===n.file.id,title:n.file.path,onClick:f=>te(n.file.id)},[a("span",la,[a("span",oa,[N(s(n.name)+" ",1),n.file.previousPath?(o(),r(C,{key:0},[N(" ← "+s(ve(n.file.previousPath)),1)],64)):w("",!0)]),a("span",ra,[a("span",ua,"+"+s(n.file.addedLineCount),1),t[11]||(t[11]=a("span",{class:"review-pane-delta-separator"},"/",-1)),a("span",da,"-"+s(n.file.removedLineCount),1)])]),a("span",{class:"review-pane-file-op","data-operation":n.file.operation},s(ee(n.file.operation)),9,ca)],12,ia))],64)}),128))])),c(B)?w("",!0):(o(),r("div",{key:1,class:"review-pane-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize file list",onPointerdown:ze},null,32)),a("section",va,[k.value?(o(),r(C,{key:0},[a("div",pa,[a("div",ha,[a("p",fa,[N(s(k.value.path)+" ",1),k.value.previousPath?(o(),r(C,{key:0},[N(" ← "+s(k.value.previousPath),1)],64)):w("",!0)]),a("p",wa,s(ee(k.value.operation))+" · +"+s(k.value.addedLineCount)+" / -"+s(k.value.removedLineCount),1)]),re.value?(o(),r("div",ma,[(o(!0),r(C,null,E(Ee.value,n=>(o(),r("button",{key:`${k.value.id}:${n.value}`,type:"button",class:"review-pane-row-button",disabled:R.value,onClick:i=>Xe(n.value,k.value)},s(n.label),9,_a))),128))])):w("",!0)]),k.value.hunks.length===0?(o(),r("div",ya,[a("pre",null,s(k.value.diff||"No unified diff available."),1)])):(o(),r("div",ba,[(o(!0),r(C,null,E(k.value.hunks,n=>(o(),r("article",{key:n.id,class:"review-pane-hunk","data-active":I.value===n.id,onClick:i=>I.value=n.id},[a("div",ga,[a("div",null,[a("p",Ca,s(n.header),1),a("p",Ba,"+"+s(n.addedLineCount)+" / -"+s(n.removedLineCount),1)]),re.value?(o(),r("div",Fa,[(o(!0),r(C,null,E(Re.value,i=>(o(),r("button",{key:`${n.id}:${i.value}`,type:"button",class:"review-pane-row-button",disabled:R.value,onClick:f=>Ke(i.value,n)},s(i.label),9,Sa))),128))])):w("",!0)]),a("div",Ia,[(o(!0),r(C,null,E(n.lines,i=>(o(),r("div",{key:i.key,class:"review-pane-line","data-kind":i.kind},[a("span",La,s(i.oldLine??""),1),a("span",$a,s(i.newLine??""),1),a("span",Aa,s(Ve(i.kind)),1),a("code",Pa,s(i.text||" "),1)],8,xa))),128))])],8,ka))),128))]))],64)):w("",!0)])],4)):(o(),r("div",Zt,[a("p",Jt,s(c(l)("No changes in this scope")),1),a("p",Qt,s(Le.value),1)]))],64)):(o(),r("div",Gt,[a("p",Ut,s(c(l)("This folder is not a Git repository")),1),a("p",Ht,s(c(l)("Initialize Git to review local changes and run Codex review.")),1),a("button",{type:"button",class:"review-pane-primary-cta",disabled:X.value,onClick:je},s(X.value?c(l)("Initializing…"):c(l)("Initialize Git")),9,Ot)])):(o(),r("div",zt,[a("p",Vt,s(c(l)("Loading review state")),1)]))]),Z(ge,{name:"review-pane-sheet"},{default:ke(()=>{var n;return[c(B)&&O.value&&((n=d.value)!=null&&n.files.length)?(o(),r("div",{key:0,class:"review-pane-sheet-backdrop",onClick:t[8]||(t[8]=i=>O.value=!1)},[a("div",{class:"review-pane-sheet",onClick:t[7]||(t[7]=ne(()=>{},["stop"]))},[t[13]||(t[13]=a("div",{class:"review-pane-sheet-handle","aria-hidden":"true"},null,-1)),a("div",Ea,[a("p",Ra,s(c(l)("Changed files")),1),a("p",Ta,s(d.value.files.length),1)]),a("div",Na,[(o(!0),r(C,null,E(ce.value,i=>{var f;return o(),r(C,{key:`sheet:${i.treeKey}`},[i.kind==="folder"?(o(),r("button",{key:0,type:"button",class:"review-pane-tree-folder review-pane-tree-folder-sheet",style:U(we(i.depth)),"data-expanded":D(i.id),onClick:_=>he(i.id)},[a("span",{class:"review-pane-tree-caret","data-expanded":D(i.id)},null,8,Da),a("span",Wa,s(i.name),1),a("span",za,s(i.fileCount),1)],12,Ma)):(o(),r("button",{key:1,type:"button",class:"review-pane-file review-pane-tree-file",style:U(me()),"data-active":((f=k.value)==null?void 0:f.id)===i.file.id,title:i.file.path,onClick:_=>te(i.file.id)},[a("span",Ga,[a("span",Ua,[N(s(i.name)+" ",1),i.file.previousPath?(o(),r(C,{key:0},[N(" ← "+s(ve(i.file.previousPath)),1)],64)):w("",!0)]),a("span",Ha,[a("span",Oa,"+"+s(i.file.addedLineCount),1),t[12]||(t[12]=a("span",{class:"review-pane-delta-separator"},"/",-1)),a("span",Xa,"-"+s(i.file.removedLineCount),1)])]),a("span",{class:"review-pane-file-op","data-operation":i.file.operation},s(ee(i.file.operation)),9,Ka)],12,Va))],64)}),128))])])])):w("",!0)]}),_:1})],34)],2)]}),_:1})]))}}),Ja=dt(qa,[["__scopeId","data-v-e9fd9327"]]);export{Ja as default};
1
+ import{e as Ze,H as Je,r as y,x as G,O as Qe,P as et,o as tt,f as o,h as at,p as Z,s as ke,j as a,n as se,u as c,w as ne,t as s,i as r,k as w,I as st,W as nt,F as C,l as E,y as U,m as N,q as ge,T as it,v as lt,c as b,X as ot,Y as rt,Z as ut,_ as dt}from"./index-Cu_hRJGY.js";const ct={class:"review-pane-header"},vt={class:"review-pane-heading"},pt={class:"review-pane-eyebrow"},ht={class:"review-pane-title"},ft={class:"review-pane-header-actions"},wt=["aria-label"],mt={class:"review-pane-toolbar"},_t={class:"review-pane-toolbar-controls"},yt={key:0,class:"review-pane-control-cluster"},bt={class:"review-pane-control-label"},kt={class:"review-pane-segmented"},gt=["data-active"],Ct=["data-active","disabled"],Bt={key:1,class:"review-pane-control-cluster"},Ft={class:"review-pane-control-label"},St={key:2,class:"review-pane-control-cluster"},It={class:"review-pane-control-label"},xt={class:"review-pane-segmented"},Lt=["data-active"],$t=["data-active"],At={class:"review-pane-toolbar-actions"},Pt=["disabled"],Et={key:1,class:"review-pane-meta"},Rt={class:"review-pane-summary-pill review-pane-summary-pill-add"},Tt={class:"review-pane-summary-pill review-pane-summary-pill-remove"},Nt={key:0},Mt={key:1},Dt={key:2},Wt={class:"review-pane-content"},zt={key:0,class:"review-pane-empty"},Vt={class:"review-pane-empty-title"},Gt={key:1,class:"review-pane-empty"},Ut={class:"review-pane-empty-title"},Ht={class:"review-pane-empty-text"},Ot=["disabled"],Xt={key:2,class:"review-pane-empty"},Kt={class:"review-pane-empty-title"},jt={class:"review-pane-empty-text"},Yt={key:0,class:"review-pane-bulk-actions"},qt=["disabled","onClick"],Zt={key:1,class:"review-pane-empty"},Jt={class:"review-pane-empty-title"},Qt={class:"review-pane-empty-text"},ea={key:0,class:"review-pane-file-list"},ta=["data-expanded","onClick"],aa=["data-expanded"],sa={class:"review-pane-tree-folder-name"},na={class:"review-pane-tree-folder-count"},ia=["data-active","title","onClick"],la={class:"review-pane-file-meta-row"},oa={class:"review-pane-file-path"},ra={class:"review-pane-file-delta"},ua={class:"review-pane-delta-add"},da={class:"review-pane-delta-remove"},ca=["data-operation"],va={class:"review-pane-diff"},pa={class:"review-pane-file-header"},ha={class:"review-pane-file-header-main"},fa={class:"review-pane-file-title"},wa={class:"review-pane-file-subtitle"},ma={key:0,class:"review-pane-row-actions"},_a=["disabled","onClick"],ya={key:0,class:"review-pane-raw-diff"},ba={key:1,class:"review-pane-hunks"},ka=["data-active","onClick"],ga={class:"review-pane-hunk-header"},Ca={class:"review-pane-hunk-title"},Ba={class:"review-pane-hunk-meta"},Fa={key:0,class:"review-pane-row-actions"},Sa=["disabled","onClick"],Ia={class:"review-pane-lines"},xa=["data-kind"],La={class:"review-pane-line-number"},$a={class:"review-pane-line-number"},Aa={class:"review-pane-line-marker"},Pa={class:"review-pane-line-code"},Ea={class:"review-pane-sheet-header"},Ra={class:"review-pane-sheet-title"},Ta={class:"review-pane-sheet-count"},Na={class:"review-pane-sheet-list"},Ma=["data-expanded","onClick"],Da=["data-expanded"],Wa={class:"review-pane-tree-folder-name"},za={class:"review-pane-tree-folder-count"},Va=["data-active","title","onClick"],Ga={class:"review-pane-file-meta-row"},Ua={class:"review-pane-file-path"},Ha={class:"review-pane-file-delta"},Oa={class:"review-pane-delta-add"},Xa={class:"review-pane-delta-remove"},Ka=["data-operation"],Ce="codex-web-local.review-pane-file-list-width.v1",ja=220,Ya=420,Be=288,qa=Ze({__name:"ReviewPane",props:{threadId:{},cwd:{},isThreadInProgress:{type:Boolean},initialFilePath:{},commitSha:{}},emits:["close"],setup(Fe,{emit:Se}){const g=Fe,Ie=Se,{isMobile:B}=Je(),{t:l}=lt(),m=y("workspace"),F=y("unstaged"),d=y(null),x=y(""),H=y(!1),L=y(""),I=y(""),O=y(!1),J=y(!1),R=y(!1),X=y(!1),M=y(""),$=y(""),K=y("");let j=null,A=null;const k=b(()=>{var e,t;return((e=d.value)==null?void 0:e.files.find(u=>u.id===L.value))??((t=d.value)==null?void 0:t.files[0])??null}),T=y({}),S=b(()=>{var e;return!!((e=g.commitSha)!=null&&e.trim())}),xe=b(()=>{var e;return(((e=d.value)==null?void 0:e.baseBranchOptions)??[]).map(t=>({value:t,label:t}))}),Le=b(()=>{var e;return((e=d.value)==null?void 0:e.scope)==="commit"||S.value?l("No file changes in this commit."):m.value==="workspace"?l("Your current workspace is clean."):l("No merge diff found against the base branch.")});function ie(e){return e.trim().replace(/\\/g,"/")}function $e(e){const t=ie(e);return!t||!d.value?null:d.value.files.find(u=>[u.path,u.absolutePath,u.previousPath,u.previousAbsolutePath].some(v=>typeof v=="string"&&ie(v)===t))??null}function le(){const e=$e(g.initialFilePath??"");return e?(te(e.id),!0):!1}const Ae=b(()=>{var e,t;return(e=d.value)!=null&&e.isGitRepo?S.value?d.value.commitSha?`${l("Commit")} ${ye(d.value.commitSha)}`:l("Commit"):m.value==="workspace"?F.value==="staged"?l("Staged changes"):l("Workspace changes"):(t=d.value)!=null&&t.baseBranch?`${l("Against")} ${d.value.baseBranch}`:l("Base branch"):l("Repository review")}),oe=b(()=>{var e;return!S.value&&m.value==="workspace"&&((e=d.value)==null?void 0:e.isGitRepo)===!0&&d.value.files.length>0}),re=b(()=>oe.value&&!R.value),Pe=b(()=>F.value==="staged"?[{value:"unstage",label:l("Unstage all")}]:[{value:"stage",label:l("Stage all")},{value:"revert",label:l("Revert all")}]),Ee=b(()=>F.value==="staged"?[{value:"unstage",label:l("Unstage file")}]:[{value:"stage",label:l("Stage file")},{value:"revert",label:l("Revert file")}]),Re=b(()=>F.value==="staged"?[{value:"unstage",label:l("Unstage hunk")}]:[{value:"stage",label:l("Stage hunk")},{value:"revert",label:l("Revert hunk")}]),ue=b(()=>$.value||M.value||K.value),Te=b(()=>!!($.value||M.value)),Y=y(De()),Ne=b(()=>{const e={};return B.value||(e["--review-file-list-width"]=`${Y.value}px`),e}),de=b(()=>{var e;return Ge(((e=d.value)==null?void 0:e.files)??[],T.value)}),ce=b(()=>de.value.nodes),Me=b(()=>de.value.folderIdsByFileId);function Q(e){return Number.isFinite(e)?Math.min(Ya,Math.max(ja,Math.round(e))):Be}function De(){if(typeof window>"u")return Be;const e=window.localStorage.getItem(Ce),t=e?Number(e):Number.NaN;return Q(t)}function We(e){typeof window>"u"||window.localStorage.setItem(Ce,String(Q(e)))}function ze(e){if(B.value)return;e.preventDefault(),A==null||A();const t=e.clientX,u=Y.value,v=i=>{Y.value=Q(u+(i.clientX-t))},p=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",n),A=null},n=()=>{p(),We(Y.value)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",n),A=p}function Ve(e){return e==="add"?"+":e==="remove"?"-":e==="hunk"?"@@":" "}function ve(e){const t=e.split("/").filter(Boolean);return t[t.length-1]??e}function pe(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function Ge(e,t){const u={folders:new Map,files:[]},v={};for(const f of e){const _=f.path.split("/").filter(Boolean),W=_.pop()??f.path;let h=u,P="";const be=[];for(const[qe,z]of _.entries()){P=P?`${P}/${z}`:z;let V=h.folders.get(z);V||(V={id:P,name:z,depth:qe,folders:new Map,files:[]},h.folders.set(z,V)),h=V,be.push(V.id)}h.files.push({file:f,name:W,depth:_.length}),v[f.id]=be}const p=[],n=f=>f.files.length+Array.from(f.folders.values()).reduce((_,W)=>_+n(W),0),i=f=>{const _=Array.from(f.folders.values()).sort((h,P)=>pe(h.name,P.name)),W=[...f.files].sort((h,P)=>pe(h.name,P.name));for(const h of _)p.push({kind:"folder",treeKey:`folder:${h.id}`,id:h.id,name:h.name,depth:h.depth,fileCount:n(h)}),t[h.id]!==!1&&i(h);for(const h of W)p.push({kind:"file",treeKey:`file:${h.file.id}`,id:h.file.id,name:h.name,depth:h.depth,file:h.file})};return i(u),{nodes:p,folderIdsByFileId:v}}function D(e){return T.value[e]!==!1}function he(e){T.value={...T.value,[e]:!D(e)}}function fe(e){const t=Me.value[e]??[];if(t.length===0)return;const u={...T.value};let v=!1;for(const p of t)u[p]===!1&&(u[p]=!0,v=!0);v&&(T.value=u)}function we(e){const t=B.value?8:10,u=B.value?12:14;return{paddingLeft:`${t+e*u}px`}}function me(){return{paddingLeft:B.value?"8px":"10px"}}function ee(e){return l(e==="add"?"Added":e==="delete"?"Deleted":e==="rename"?"Renamed":"Modified")}function Ue(e){const t=e.params!==null&&typeof e.params=="object"&&!Array.isArray(e.params)?e.params:null;return typeof(t==null?void 0:t.threadId)=="string"?t.threadId:""}async function q(){var e,t,u,v;if(g.cwd.trim()){J.value=!0,M.value="";try{const p=m.value==="baseBranch"?x.value.trim():"",n=((e=g.commitSha)==null?void 0:e.trim())??"",i=await ot(g.cwd,S.value?"commit":m.value,F.value,p||null,n||null);if(i.baseBranchOptions.length>0){const _=i.baseBranch??i.baseBranchOptions[0]??"";x.value!==_&&(H.value=!0,x.value=_)}else x.value!==""&&(H.value=!0,x.value="");d.value=i;const f=i.files.some(_=>_.id===L.value);!le()&&!f&&(L.value=((t=i.files[0])==null?void 0:t.id)??"",I.value=((v=(u=i.files[0])==null?void 0:u.hunks[0])==null?void 0:v.id)??"")}catch(p){M.value=p instanceof Error?p.message:"Failed to load review snapshot"}finally{J.value=!1}}}async function _e(){await q()}function He(){Ie("close")}function te(e){var u,v;fe(e),L.value=e;const t=((u=d.value)==null?void 0:u.files.find(p=>p.id===e))??null;I.value=((v=t==null?void 0:t.hunks[0])==null?void 0:v.id)??"",B.value&&(O.value=!1)}function ye(e){return e.trim().slice(0,7)}async function ae(e,t,u=""){var v,p,n;if(d.value){R.value=!0,$.value="";try{const i=await ut({cwd:g.cwd,scope:m.value,workspaceView:F.value,action:e,level:t,patch:u});d.value=i,i.files.some(_=>_.id===L.value)||(L.value=((v=i.files[0])==null?void 0:v.id)??"",I.value=((n=(p=i.files[0])==null?void 0:p.hunks[0])==null?void 0:n.id)??"")}catch(i){$.value=i instanceof Error?i.message:"Failed to apply review action"}finally{R.value=!1}}}async function Oe(e){await ae(e,"all")}async function Xe(e,t){await ae(e,"file",t.diff)}async function Ke(e,t){I.value=t.id,await ae(e,"hunk",t.patch)}async function je(){if(g.cwd.trim()){X.value=!0,$.value="";try{await rt(g.cwd),await q()}catch(e){$.value=e instanceof Error?e.message:"Failed to initialize Git"}finally{X.value=!1}}}function Ye(e){if(Ue(e)!==g.threadId)return;const t=e.params!==null&&typeof e.params=="object"&&!Array.isArray(e.params)?e.params:null,u=(t==null?void 0:t.item)!==null&&typeof(t==null?void 0:t.item)=="object"&&!Array.isArray(t.item)?t.item:null,v=typeof(u==null?void 0:u.type)=="string"?u.type:"";if(e.method==="item/started"&&v==="enteredReviewMode"){K.value=typeof(u==null?void 0:u.review)=="string"?u.review:"Review in progress";return}e.method==="item/completed"&&v==="exitedReviewMode"&&(K.value="")}return G(()=>[g.threadId,g.cwd,g.commitSha],()=>{S.value&&(m.value="workspace"),L.value="",I.value="",$.value="",K.value="",_e()},{immediate:!0}),G(()=>[g.initialFilePath,g.commitSha],()=>{le()}),G(()=>[m.value,F.value],()=>{L.value="",I.value="",$.value="",M.value="",q()}),G(x,(e,t)=>{if(H.value){H.value=!1;return}m.value==="baseBranch"&&(!e||e===t||q())}),G(k,e=>{var t;e&&(fe(e.id),e.hunks.some(u=>u.id===I.value)||(I.value=((t=e.hunks[0])==null?void 0:t.id)??""))}),Qe(()=>{j=et(Ye)}),tt(()=>{j&&(j(),j=null),A==null||A()}),(e,t)=>(o(),at(it,{to:"body"},[Z(ge,{name:"review-pane-modal"},{default:ke(()=>{var u,v,p;return[a("div",{class:se(["review-pane-backdrop",{"is-mobile":c(B)}]),onClick:He},[a("section",{class:se(["review-pane",{"is-mobile":c(B)}]),onPointerdown:t[9]||(t[9]=ne(()=>{},["stop"])),onClick:t[10]||(t[10]=ne(()=>{},["stop"]))},[a("header",ct,[a("div",vt,[a("p",pt,s(c(l)("Review")),1),a("p",ht,s(Ae.value),1)]),a("div",ft,[c(B)&&((u=d.value)!=null&&u.files.length)?(o(),r("button",{key:0,type:"button",class:"review-pane-mobile-files-button",onClick:t[0]||(t[0]=n=>O.value=!0)},s(c(l)("Files")),1)):w("",!0),a("button",{type:"button",class:"review-pane-close","aria-label":c(l)("Close review pane"),onClick:t[1]||(t[1]=n=>e.$emit("close"))},[Z(st,{class:"icon-svg"})],8,wt)])]),a("div",mt,[a("div",_t,[S.value?w("",!0):(o(),r("div",yt,[a("span",bt,s(c(l)("Compare")),1),a("div",kt,[a("button",{type:"button",class:"review-pane-segmented-button review-pane-scope","data-active":m.value==="workspace",onClick:t[2]||(t[2]=n=>m.value="workspace")},s(c(l)("Workspace")),9,gt),a("button",{type:"button",class:"review-pane-segmented-button review-pane-scope","data-active":m.value==="baseBranch",disabled:!((v=d.value)!=null&&v.baseBranch),onClick:t[3]||(t[3]=n=>m.value="baseBranch")},s(c(l)("Base branch")),9,Ct)])])),!S.value&&m.value==="baseBranch"&&((p=d.value)!=null&&p.baseBranchOptions.length)?(o(),r("div",Bt,[a("span",Ft,s(c(l)("Branch")),1),Z(nt,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=n=>x.value=n),class:"review-pane-branch-dropdown",options:xe.value,placeholder:c(l)("Branch"),"enable-search":"","search-placeholder":c(l)("Search branches...")},null,8,["modelValue","options","placeholder","search-placeholder"])])):w("",!0),!S.value&&m.value==="workspace"?(o(),r("div",St,[a("span",It,s(c(l)("Changes")),1),a("div",xt,[a("button",{type:"button",class:"review-pane-segmented-button review-pane-view","data-active":F.value==="unstaged",onClick:t[5]||(t[5]=n=>F.value="unstaged")},s(c(l)("Unstaged")),9,Lt),a("button",{type:"button",class:"review-pane-segmented-button review-pane-view","data-active":F.value==="staged",onClick:t[6]||(t[6]=n=>F.value="staged")},s(c(l)("Staged")),9,$t)])])):w("",!0)]),a("div",At,[a("button",{type:"button",class:"review-pane-refresh",disabled:J.value,onClick:_e},s(c(l)("Refresh")),9,Pt)])]),ue.value?(o(),r("div",{key:0,class:se(["review-pane-banner",{"is-error":Te.value}])},s(ue.value),3)):w("",!0),d.value?(o(),r("div",Et,[a("span",null,s(d.value.summary.fileCount)+" "+s(c(l)("files")),1),a("span",Rt,"+"+s(d.value.summary.addedLineCount),1),a("span",Tt,"-"+s(d.value.summary.removedLineCount),1),d.value.headBranch?(o(),r("span",Nt,s(d.value.headBranch),1)):w("",!0),S.value&&d.value.commitSha?(o(),r("span",Mt,s(ye(d.value.commitSha)),1)):w("",!0),!S.value&&m.value==="baseBranch"&&d.value.baseBranch?(o(),r("span",Dt,"vs "+s(d.value.baseBranch),1)):w("",!0)])):w("",!0),a("div",Wt,[d.value?d.value.isGitRepo?!S.value&&m.value==="baseBranch"&&!d.value.baseBranch?(o(),r("div",Xt,[a("p",Kt,s(c(l)("Base branch unavailable")),1),a("p",jt,s(c(l)("Could not resolve `origin/HEAD`, `main`, or `master` for this repository.")),1)])):(o(),r(C,{key:3},[oe.value?(o(),r("div",Yt,[(o(!0),r(C,null,E(Pe.value,n=>(o(),r("button",{key:n.value,type:"button",class:"review-pane-bulk-button",disabled:R.value,onClick:i=>Oe(n.value)},s(n.label),9,qt))),128))])):w("",!0),d.value.files.length?(o(),r("div",{key:2,class:"review-pane-main",style:U(Ne.value)},[c(B)?w("",!0):(o(),r("aside",ea,[(o(!0),r(C,null,E(ce.value,n=>{var i;return o(),r(C,{key:n.treeKey},[n.kind==="folder"?(o(),r("button",{key:0,type:"button",class:"review-pane-tree-folder",style:U(we(n.depth)),"data-expanded":D(n.id),onClick:f=>he(n.id)},[a("span",{class:"review-pane-tree-caret","data-expanded":D(n.id)},null,8,aa),a("span",sa,s(n.name),1),a("span",na,s(n.fileCount),1)],12,ta)):(o(),r("button",{key:1,type:"button",class:"review-pane-file review-pane-tree-file",style:U(me()),"data-active":((i=k.value)==null?void 0:i.id)===n.file.id,title:n.file.path,onClick:f=>te(n.file.id)},[a("span",la,[a("span",oa,[N(s(n.name)+" ",1),n.file.previousPath?(o(),r(C,{key:0},[N(" ← "+s(ve(n.file.previousPath)),1)],64)):w("",!0)]),a("span",ra,[a("span",ua,"+"+s(n.file.addedLineCount),1),t[11]||(t[11]=a("span",{class:"review-pane-delta-separator"},"/",-1)),a("span",da,"-"+s(n.file.removedLineCount),1)])]),a("span",{class:"review-pane-file-op","data-operation":n.file.operation},s(ee(n.file.operation)),9,ca)],12,ia))],64)}),128))])),c(B)?w("",!0):(o(),r("div",{key:1,class:"review-pane-resizer",role:"separator","aria-orientation":"vertical","aria-label":"Resize file list",onPointerdown:ze},null,32)),a("section",va,[k.value?(o(),r(C,{key:0},[a("div",pa,[a("div",ha,[a("p",fa,[N(s(k.value.path)+" ",1),k.value.previousPath?(o(),r(C,{key:0},[N(" ← "+s(k.value.previousPath),1)],64)):w("",!0)]),a("p",wa,s(ee(k.value.operation))+" · +"+s(k.value.addedLineCount)+" / -"+s(k.value.removedLineCount),1)]),re.value?(o(),r("div",ma,[(o(!0),r(C,null,E(Ee.value,n=>(o(),r("button",{key:`${k.value.id}:${n.value}`,type:"button",class:"review-pane-row-button",disabled:R.value,onClick:i=>Xe(n.value,k.value)},s(n.label),9,_a))),128))])):w("",!0)]),k.value.hunks.length===0?(o(),r("div",ya,[a("pre",null,s(k.value.diff||"No unified diff available."),1)])):(o(),r("div",ba,[(o(!0),r(C,null,E(k.value.hunks,n=>(o(),r("article",{key:n.id,class:"review-pane-hunk","data-active":I.value===n.id,onClick:i=>I.value=n.id},[a("div",ga,[a("div",null,[a("p",Ca,s(n.header),1),a("p",Ba,"+"+s(n.addedLineCount)+" / -"+s(n.removedLineCount),1)]),re.value?(o(),r("div",Fa,[(o(!0),r(C,null,E(Re.value,i=>(o(),r("button",{key:`${n.id}:${i.value}`,type:"button",class:"review-pane-row-button",disabled:R.value,onClick:f=>Ke(i.value,n)},s(i.label),9,Sa))),128))])):w("",!0)]),a("div",Ia,[(o(!0),r(C,null,E(n.lines,i=>(o(),r("div",{key:i.key,class:"review-pane-line","data-kind":i.kind},[a("span",La,s(i.oldLine??""),1),a("span",$a,s(i.newLine??""),1),a("span",Aa,s(Ve(i.kind)),1),a("code",Pa,s(i.text||" "),1)],8,xa))),128))])],8,ka))),128))]))],64)):w("",!0)])],4)):(o(),r("div",Zt,[a("p",Jt,s(c(l)("No changes in this scope")),1),a("p",Qt,s(Le.value),1)]))],64)):(o(),r("div",Gt,[a("p",Ut,s(c(l)("This folder is not a Git repository")),1),a("p",Ht,s(c(l)("Initialize Git to review local changes and run Codex review.")),1),a("button",{type:"button",class:"review-pane-primary-cta",disabled:X.value,onClick:je},s(X.value?c(l)("Initializing…"):c(l)("Initialize Git")),9,Ot)])):(o(),r("div",zt,[a("p",Vt,s(c(l)("Loading review state")),1)]))]),Z(ge,{name:"review-pane-sheet"},{default:ke(()=>{var n;return[c(B)&&O.value&&((n=d.value)!=null&&n.files.length)?(o(),r("div",{key:0,class:"review-pane-sheet-backdrop",onClick:t[8]||(t[8]=i=>O.value=!1)},[a("div",{class:"review-pane-sheet",onClick:t[7]||(t[7]=ne(()=>{},["stop"]))},[t[13]||(t[13]=a("div",{class:"review-pane-sheet-handle","aria-hidden":"true"},null,-1)),a("div",Ea,[a("p",Ra,s(c(l)("Changed files")),1),a("p",Ta,s(d.value.files.length),1)]),a("div",Na,[(o(!0),r(C,null,E(ce.value,i=>{var f;return o(),r(C,{key:`sheet:${i.treeKey}`},[i.kind==="folder"?(o(),r("button",{key:0,type:"button",class:"review-pane-tree-folder review-pane-tree-folder-sheet",style:U(we(i.depth)),"data-expanded":D(i.id),onClick:_=>he(i.id)},[a("span",{class:"review-pane-tree-caret","data-expanded":D(i.id)},null,8,Da),a("span",Wa,s(i.name),1),a("span",za,s(i.fileCount),1)],12,Ma)):(o(),r("button",{key:1,type:"button",class:"review-pane-file review-pane-tree-file",style:U(me()),"data-active":((f=k.value)==null?void 0:f.id)===i.file.id,title:i.file.path,onClick:_=>te(i.file.id)},[a("span",Ga,[a("span",Ua,[N(s(i.name)+" ",1),i.file.previousPath?(o(),r(C,{key:0},[N(" ← "+s(ve(i.file.previousPath)),1)],64)):w("",!0)]),a("span",Ha,[a("span",Oa,"+"+s(i.file.addedLineCount),1),t[12]||(t[12]=a("span",{class:"review-pane-delta-separator"},"/",-1)),a("span",Xa,"-"+s(i.file.removedLineCount),1)])]),a("span",{class:"review-pane-file-op","data-operation":i.file.operation},s(ee(i.file.operation)),9,Ka)],12,Va))],64)}),128))])])])):w("",!0)]}),_:1})],34)],2)]}),_:1})]))}}),Ja=dt(qa,[["__scopeId","data-v-e9fd9327"]]);export{Ja as default};
@@ -1 +1 @@
1
- import{e as u,x as _,aC as g,f as a,i as r,j as i,t,u as n,k as w,v as m,r as p,c as y,_ as k}from"./index-kOwa0g4Z.js";const b={class:"right-file-preview"},x={class:"right-file-preview-header"},F={class:"right-file-preview-title-wrap"},P={class:"right-file-preview-title"},L={class:"right-file-preview-path"},B=["href"],C={class:"right-file-preview-body"},E={key:0,class:"right-file-preview-empty"},I={key:1,class:"right-file-preview-empty is-error"},R=["src","alt"],U={key:3,class:"right-file-preview-code"},N={key:4,class:"right-file-preview-empty"},O=["href"],S={key:0,class:"right-file-preview-footer"},T=u({__name:"RightFilePreview",props:{filePath:{},name:{}},setup(c){const f=c,{t:l}=m(),e=p(null),h=p(!1),v=p(""),d=y(()=>{const s=f.filePath.replace(/\\/g,"/"),o=s.startsWith("/")?s:`/${s}`;return`/codex-local-browse${encodeURI(o)}`});return _(()=>f.filePath,async s=>{if(e.value=null,v.value="",!!s){h.value=!0;try{e.value=await g(s)}catch(o){v.value=o instanceof Error?o.message:"Failed to preview file"}finally{h.value=!1}}},{immediate:!0}),(s,o)=>(a(),r("div",b,[i("div",x,[i("div",F,[i("span",P,t(c.name),1),i("span",L,t(c.filePath),1)]),i("a",{class:"right-file-preview-open",href:d.value,target:"_blank",rel:"noopener noreferrer"},t(n(l)("Open in browser")),9,B)]),i("div",C,[h.value?(a(),r("div",E,t(n(l)("Loading file…")),1)):v.value?(a(),r("div",I,t(v.value),1)):e.value&&e.value.isImage?(a(),r("img",{key:2,class:"right-file-preview-image",src:d.value,alt:c.name},null,8,R)):e.value&&e.value.isText&&e.value.content!==void 0?(a(),r("pre",U,t(e.value.content),1)):(a(),r("div",N,[i("p",null,t(n(l)("This file type cannot be previewed.")),1),i("a",{class:"right-file-preview-open",href:d.value,target:"_blank",rel:"noopener noreferrer"},t(n(l)("Open in browser")),9,O)]))]),e.value&&e.value.truncated?(a(),r("div",S,t(n(l)("File is large; showing the first part.")),1)):w("",!0)]))}}),$=k(T,[["__scopeId","data-v-11e988a2"]]);export{$ as default};
1
+ import{e as u,x as _,aC as g,f as a,i as r,j as i,t,u as n,k as w,v as m,r as p,c as y,_ as k}from"./index-Cu_hRJGY.js";const b={class:"right-file-preview"},x={class:"right-file-preview-header"},F={class:"right-file-preview-title-wrap"},P={class:"right-file-preview-title"},L={class:"right-file-preview-path"},B=["href"],C={class:"right-file-preview-body"},E={key:0,class:"right-file-preview-empty"},I={key:1,class:"right-file-preview-empty is-error"},R=["src","alt"],U={key:3,class:"right-file-preview-code"},N={key:4,class:"right-file-preview-empty"},O=["href"],S={key:0,class:"right-file-preview-footer"},T=u({__name:"RightFilePreview",props:{filePath:{},name:{}},setup(c){const f=c,{t:l}=m(),e=p(null),h=p(!1),v=p(""),d=y(()=>{const s=f.filePath.replace(/\\/g,"/"),o=s.startsWith("/")?s:`/${s}`;return`/codex-local-browse${encodeURI(o)}`});return _(()=>f.filePath,async s=>{if(e.value=null,v.value="",!!s){h.value=!0;try{e.value=await g(s)}catch(o){v.value=o instanceof Error?o.message:"Failed to preview file"}finally{h.value=!1}}},{immediate:!0}),(s,o)=>(a(),r("div",b,[i("div",x,[i("div",F,[i("span",P,t(c.name),1),i("span",L,t(c.filePath),1)]),i("a",{class:"right-file-preview-open",href:d.value,target:"_blank",rel:"noopener noreferrer"},t(n(l)("Open in browser")),9,B)]),i("div",C,[h.value?(a(),r("div",E,t(n(l)("Loading file…")),1)):v.value?(a(),r("div",I,t(v.value),1)):e.value&&e.value.isImage?(a(),r("img",{key:2,class:"right-file-preview-image",src:d.value,alt:c.name},null,8,R)):e.value&&e.value.isText&&e.value.content!==void 0?(a(),r("pre",U,t(e.value.content),1)):(a(),r("div",N,[i("p",null,t(n(l)("This file type cannot be previewed.")),1),i("a",{class:"right-file-preview-open",href:d.value,target:"_blank",rel:"noopener noreferrer"},t(n(l)("Open in browser")),9,O)]))]),e.value&&e.value.truncated?(a(),r("div",S,t(n(l)("File is large; showing the first part.")),1)):w("",!0)]))}}),$=k(T,[["__scopeId","data-v-11e988a2"]]);export{$ as default};
@@ -1 +1 @@
1
- import{e as E,O as T,x as O,f as o,i as r,j as d,a2 as U,a3 as V,u as P,t as u,F as j,l as q,y as z,v as I,r as m,c as C,aB as Q,_ as W}from"./index-kOwa0g4Z.js";const A={class:"right-files-panel"},G={class:"rfp-toolbar"},H=["placeholder"],J={key:0,class:"rfp-empty"},K={key:1,class:"rfp-empty is-error"},X={key:2,class:"rfp-empty"},Y={key:3,class:"rfp-groups"},Z=["aria-expanded","onClick"],ee={class:"rfp-dir-chevron","aria-hidden":"true"},te={class:"rfp-dir-icon","aria-hidden":"true"},ne={class:"rfp-dir-name"},ae=["title","onClick"],se={class:"rfp-file-label"},ie=E({__name:"RightFilesPanel",props:{cwd:{}},emits:["open-preview"],setup(D,{emit:L}){const x=D,S=L,{t:y}=I(),_=m([]),k=m(!1),f=m(""),h=m(""),v=m(new Set);function b(n){return n.sort((e,t)=>e.kind!==t.kind?e.kind==="dir"?-1:1:e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:"base"}))}function B(n){const e=[],t=new Map;function l(s){let a="",i=e;for(const c of s){a=a?`${a}/${c}`:c;let p=t.get(a);p||(p={name:c,path:"",relativePath:a,kind:"dir",children:[]},t.set(a,p),i.push(p)),i=p.children}return t.get(a)}for(const s of n){const a=s.relativePath.split("/").filter(Boolean);if(a.length===0)continue;if(s.isDirectory){const R=l(a);R.path=s.path;continue}const i=a[a.length-1],c=a.slice(0,-1);(c.length>0?l(c).children:e).push({name:i,path:s.path,relativePath:s.relativePath,kind:"file",children:[]})}b(e);for(const s of t.values())b(s.children);return e}const N=C(()=>B(_.value)),w=C(()=>{const n=h.value.trim().toLowerCase(),e=[];function t(s){return!n||s.relativePath.toLowerCase().includes(n)?!0:s.children.some(t)}function l(s,a){for(const i of s){if(n&&!t(i)||(e.push({node:i,depth:a}),i.kind==="file"))continue;(n?!0:!v.value.has(i.relativePath))&&l(i.children,a+1)}}return l(N.value,0),e});function g(n){return h.value.trim()?!0:!v.value.has(n)}function $(n){const e=new Set(v.value);e.has(n)?e.delete(n):e.add(n),v.value=e}function M(n){S("open-preview",{path:n.path,label:n.name})}async function F(){const n=x.cwd.trim();if(!n){_.value=[],f.value="";return}k.value=!0,f.value="";try{_.value=await Q(n)}catch(e){_.value=[],f.value=e instanceof Error?e.message:"Failed to load workspace files"}finally{k.value=!1}}return T(()=>{F()}),O(()=>x.cwd,()=>{v.value=new Set,h.value="",F()}),(n,e)=>(o(),r("div",A,[d("div",G,[U(d("input",{"onUpdate:modelValue":e[0]||(e[0]=t=>h.value=t),class:"rfp-search",type:"text",placeholder:P(y)("Filter files...")},null,8,H),[[V,h.value]])]),k.value?(o(),r("div",J,u(P(y)("Loading files...")),1)):f.value?(o(),r("div",K,u(f.value),1)):w.value.length===0?(o(),r("div",X,u(P(y)("No files in workspace.")),1)):(o(),r("div",Y,[(o(!0),r(j,null,q(w.value,t=>(o(),r("div",{key:t.node.relativePath,class:"rfp-row",style:z({paddingLeft:`${t.depth*12+6}px`})},[t.node.kind==="dir"?(o(),r("button",{key:0,class:"rfp-dir",type:"button","aria-expanded":g(t.node.relativePath),onClick:l=>$(t.node.relativePath)},[d("span",ee,u(g(t.node.relativePath)?"▾":"▸"),1),d("span",te,u(g(t.node.relativePath)?"📂":"📁"),1),d("span",ne,u(t.node.name),1)],8,Z)):(o(),r("button",{key:1,class:"rfp-file",type:"button",title:t.node.relativePath,onClick:l=>M(t.node)},[e[1]||(e[1]=d("span",{class:"rfp-file-icon","aria-hidden":"true"},"📄",-1)),d("span",se,u(t.node.name),1)],8,ae))],4))),128))]))]))}}),re=W(ie,[["__scopeId","data-v-686d6084"]]);export{re as default};
1
+ import{e as E,O as T,x as O,f as o,i as r,j as d,a2 as U,a3 as V,u as P,t as u,F as j,l as q,y as z,v as I,r as m,c as C,aB as Q,_ as W}from"./index-Cu_hRJGY.js";const A={class:"right-files-panel"},G={class:"rfp-toolbar"},H=["placeholder"],J={key:0,class:"rfp-empty"},K={key:1,class:"rfp-empty is-error"},X={key:2,class:"rfp-empty"},Y={key:3,class:"rfp-groups"},Z=["aria-expanded","onClick"],ee={class:"rfp-dir-chevron","aria-hidden":"true"},te={class:"rfp-dir-icon","aria-hidden":"true"},ne={class:"rfp-dir-name"},ae=["title","onClick"],se={class:"rfp-file-label"},ie=E({__name:"RightFilesPanel",props:{cwd:{}},emits:["open-preview"],setup(D,{emit:L}){const x=D,S=L,{t:y}=I(),_=m([]),k=m(!1),f=m(""),h=m(""),v=m(new Set);function b(n){return n.sort((e,t)=>e.kind!==t.kind?e.kind==="dir"?-1:1:e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:"base"}))}function B(n){const e=[],t=new Map;function l(s){let a="",i=e;for(const c of s){a=a?`${a}/${c}`:c;let p=t.get(a);p||(p={name:c,path:"",relativePath:a,kind:"dir",children:[]},t.set(a,p),i.push(p)),i=p.children}return t.get(a)}for(const s of n){const a=s.relativePath.split("/").filter(Boolean);if(a.length===0)continue;if(s.isDirectory){const R=l(a);R.path=s.path;continue}const i=a[a.length-1],c=a.slice(0,-1);(c.length>0?l(c).children:e).push({name:i,path:s.path,relativePath:s.relativePath,kind:"file",children:[]})}b(e);for(const s of t.values())b(s.children);return e}const N=C(()=>B(_.value)),w=C(()=>{const n=h.value.trim().toLowerCase(),e=[];function t(s){return!n||s.relativePath.toLowerCase().includes(n)?!0:s.children.some(t)}function l(s,a){for(const i of s){if(n&&!t(i)||(e.push({node:i,depth:a}),i.kind==="file"))continue;(n?!0:!v.value.has(i.relativePath))&&l(i.children,a+1)}}return l(N.value,0),e});function g(n){return h.value.trim()?!0:!v.value.has(n)}function $(n){const e=new Set(v.value);e.has(n)?e.delete(n):e.add(n),v.value=e}function M(n){S("open-preview",{path:n.path,label:n.name})}async function F(){const n=x.cwd.trim();if(!n){_.value=[],f.value="";return}k.value=!0,f.value="";try{_.value=await Q(n)}catch(e){_.value=[],f.value=e instanceof Error?e.message:"Failed to load workspace files"}finally{k.value=!1}}return T(()=>{F()}),O(()=>x.cwd,()=>{v.value=new Set,h.value="",F()}),(n,e)=>(o(),r("div",A,[d("div",G,[U(d("input",{"onUpdate:modelValue":e[0]||(e[0]=t=>h.value=t),class:"rfp-search",type:"text",placeholder:P(y)("Filter files...")},null,8,H),[[V,h.value]])]),k.value?(o(),r("div",J,u(P(y)("Loading files...")),1)):f.value?(o(),r("div",K,u(f.value),1)):w.value.length===0?(o(),r("div",X,u(P(y)("No files in workspace.")),1)):(o(),r("div",Y,[(o(!0),r(j,null,q(w.value,t=>(o(),r("div",{key:t.node.relativePath,class:"rfp-row",style:z({paddingLeft:`${t.depth*12+6}px`})},[t.node.kind==="dir"?(o(),r("button",{key:0,class:"rfp-dir",type:"button","aria-expanded":g(t.node.relativePath),onClick:l=>$(t.node.relativePath)},[d("span",ee,u(g(t.node.relativePath)?"▾":"▸"),1),d("span",te,u(g(t.node.relativePath)?"📂":"📁"),1),d("span",ne,u(t.node.name),1)],8,Z)):(o(),r("button",{key:1,class:"rfp-file",type:"button",title:t.node.relativePath,onClick:l=>M(t.node)},[e[1]||(e[1]=d("span",{class:"rfp-file-icon","aria-hidden":"true"},"📄",-1)),d("span",se,u(t.node.name),1)],8,ae))],4))),128))]))]))}}),re=W(ie,[["__scopeId","data-v-686d6084"]]);export{re as default};
@@ -1,2 +1,2 @@
1
- import{e as de,O as he,J as pe,x as W,f as i,i as l,p as ve,az as me,j as s,t as o,u as c,k as p,n as P,F as b,l as S,a2 as T,a3 as z,aA as ge,a0 as D,w as k,r as _,c as v,v as _e,a as ye,z as Ce,_ as be}from"./index-kOwa0g4Z.js";const fe={class:"right-git-panel"},ke={class:"rgp-review-label"},we={class:"rgp-review-delta"},Be={class:"rgp-added"},Se={class:"rgp-removed"},$e={class:"rgp-state"},Fe={class:"rgp-state-label"},Re={class:"rgp-state-value"},Le={key:0,class:"rgp-state-meta"},xe=["href"],je={key:2,class:"rgp-section"},Pe={class:"rgp-section-title"},Te={class:"rgp-file-list"},De=["title","onClick"],Ee={class:"rgp-file-status"},He={class:"rgp-file-path"},Me={key:0,class:"rgp-file-previous-path"},Ne={class:"rgp-section"},Ve={class:"rgp-section-title"},Ke={class:"rgp-search-wrap"},Ae=["placeholder"],Ie={class:"rgp-branches",role:"listbox"},Oe={class:"rgp-branch-row"},Ue=["disabled","onClick"],We={class:"rgp-branch-name"},ze={key:0,class:"rgp-branch-meta"},Ge={key:1,class:"rgp-branch-meta"},qe=["disabled","onClick"],Qe={key:0,class:"rgp-empty"},Je={class:"rgp-section"},Xe={class:"rgp-section-title"},Ye={class:"rgp-search-wrap"},Ze=["placeholder"],et={class:"rgp-toggle-row"},tt={class:"rgp-commit-list"},st={key:0,class:"rgp-empty"},at={key:1,class:"rgp-empty"},ot={key:2,class:"rgp-empty is-error"},rt=["disabled","title","onClick"],nt={class:"rgp-commit-top"},it=["title","onClick","onKeydown"],lt={class:"rgp-commit-meta"},ct={key:0,class:"rgp-branch-meta"},ut={class:"rgp-commit-subject"},dt={key:0,class:"rgp-empty"},ht={key:3,class:"rgp-section"},pt={class:"rgp-section-title"},vt=["title"],mt=["disabled"],gt={class:"rgp-commit-detail-subject"},_t={class:"rgp-file-list"},yt={key:0,class:"rgp-empty"},Ct={key:1,class:"rgp-empty is-error"},bt=["title","onClick"],ft={class:"rgp-file-meta-row"},kt={class:"rgp-file-status"},wt={class:"rgp-file-delta"},Bt={class:"rgp-added"},St={class:"rgp-removed"},$t={class:"rgp-file-path"},Ft={key:0,class:"rgp-file-previous-path"},Rt={key:0,class:"rgp-empty"},Lt=de({__name:"RightGitPanel",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},worktreeChangeSummary:{},worktreeChanges:{},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},commitFilesBySha:{},commitFilesLoadingFor:{},commitFilesError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits","loadCommitFiles","openCommitFile"],setup(d,{emit:G}){const r=d,g=G,E=_(null),$=_(""),F=_(""),u=_(""),y=_(""),w=_(""),R=_(""),C=_(!0),q=v(()=>r.showReview!==!1),{buildFeedbackMailto:Q,feedbackMailtoBase:J,recordVisibleFailure:X}=Ce(),{t:n}=_e(),Y=J();function Z(t,a){X(a);const e=t.currentTarget;e instanceof HTMLAnchorElement&&(e.href=Q())}const ee=v(()=>r.currentBranch?r.currentBranch:r.headSubject?r.headSubject:r.headSha?`${n("Detached")} ${r.headSha}`:r.loading?n("Loading branch..."):n("Detached HEAD")),H=v(()=>{var e;const t=[r.headSha,r.headDate].filter(Boolean).join(" · "),a=((e=r.headSubject)==null?void 0:e.trim())??"";return a&&t?`${a} (${t})`:a||t}),B=v(()=>r.busy||r.loading),L=v(()=>r.error||(r.dirty?n("Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them."):"")),M=v(()=>r.error?"error":"info"),N=v(()=>{const t=$.value.trim().toLowerCase(),a=[...r.branches].sort((e,m)=>e.isRemote===!0&&m.isRemote!==!0?1:e.isRemote!==!0&&m.isRemote===!0?-1:0);return t?a.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):a}),te=v(()=>r.branches.find(t=>t.value===u.value)??null),V=v(()=>{var t;return((t=te.value)==null?void 0:t.isRemote)===!0}),x=v(()=>u.value?`${u.value}\0${C.value?"with-reset-history":"without-reset-history"}`:""),j=v(()=>x.value?r.commitsByBranch[x.value]||[]:[]),h=v(()=>j.value.find(t=>t.sha===y.value)??null),K=v(()=>h.value?r.commitFilesBySha[h.value.sha]||[]:[]),A=v(()=>{const t=F.value.trim().toLowerCase(),a=j.value;return t?a.filter(e=>e.sha.toLowerCase().includes(t)||e.shortSha.toLowerCase().includes(t)||e.subject.toLowerCase().includes(t)||e.date.toLowerCase().includes(t)):a});function se(t){u.value=t,y.value="",g("loadCommits",{branch:t,includeResetHistory:C.value})}function ae(){u.value&&g("loadCommits",{branch:u.value,includeResetHistory:C.value})}function I(t){var e;const a=((e=r.headSha)==null?void 0:e.trim())??"";return a?t.sha===a||t.shortSha===a||t.sha.startsWith(a):!1}function oe(t){return`${n("Show")} ${t.shortSha} ${n("files")}`}function re(t){y.value=t.sha,g("loadCommitFiles",t.sha)}function f(t){const a=t.sha.trim()||t.shortSha.trim();a&&(w.value=t.sha,ye(a).catch(()=>{w.value=""}))}function ne(){!u.value||!h.value||V.value||g("resetBranchToCommit",{branch:u.value,sha:h.value.sha})}function O(t){return typeof t=="number"&&Number.isFinite(t)?String(t):"-"}function ie(t){h.value&&g("openCommitFile",{sha:h.value.sha,path:t})}function le(t){r.headSha&&g("openCommitFile",{sha:r.headSha,path:t})}function U(){var a,e;const t=(a=r.currentBranch)==null?void 0:a.trim();return t||(((e=r.branches[0])==null?void 0:e.value)??"")}function ce(){const t=u.value||U();t&&(u.value=t,g("loadCommits",{branch:t,includeResetHistory:C.value}))}return he(()=>{ce(),pe(()=>{var t;return(t=E.value)==null?void 0:t.focus()})}),W(()=>[r.currentBranch,r.branches.map(t=>t.value).join(`
1
+ import{e as de,O as he,J as pe,x as W,f as i,i as l,p as ve,az as me,j as s,t as o,u as c,k as p,n as P,F as b,l as S,a2 as T,a3 as z,aA as ge,a0 as D,w as k,r as _,c as v,v as _e,a as ye,z as Ce,_ as be}from"./index-Cu_hRJGY.js";const fe={class:"right-git-panel"},ke={class:"rgp-review-label"},we={class:"rgp-review-delta"},Be={class:"rgp-added"},Se={class:"rgp-removed"},$e={class:"rgp-state"},Fe={class:"rgp-state-label"},Re={class:"rgp-state-value"},Le={key:0,class:"rgp-state-meta"},xe=["href"],je={key:2,class:"rgp-section"},Pe={class:"rgp-section-title"},Te={class:"rgp-file-list"},De=["title","onClick"],Ee={class:"rgp-file-status"},He={class:"rgp-file-path"},Me={key:0,class:"rgp-file-previous-path"},Ne={class:"rgp-section"},Ve={class:"rgp-section-title"},Ke={class:"rgp-search-wrap"},Ae=["placeholder"],Ie={class:"rgp-branches",role:"listbox"},Oe={class:"rgp-branch-row"},Ue=["disabled","onClick"],We={class:"rgp-branch-name"},ze={key:0,class:"rgp-branch-meta"},Ge={key:1,class:"rgp-branch-meta"},qe=["disabled","onClick"],Qe={key:0,class:"rgp-empty"},Je={class:"rgp-section"},Xe={class:"rgp-section-title"},Ye={class:"rgp-search-wrap"},Ze=["placeholder"],et={class:"rgp-toggle-row"},tt={class:"rgp-commit-list"},st={key:0,class:"rgp-empty"},at={key:1,class:"rgp-empty"},ot={key:2,class:"rgp-empty is-error"},rt=["disabled","title","onClick"],nt={class:"rgp-commit-top"},it=["title","onClick","onKeydown"],lt={class:"rgp-commit-meta"},ct={key:0,class:"rgp-branch-meta"},ut={class:"rgp-commit-subject"},dt={key:0,class:"rgp-empty"},ht={key:3,class:"rgp-section"},pt={class:"rgp-section-title"},vt=["title"],mt=["disabled"],gt={class:"rgp-commit-detail-subject"},_t={class:"rgp-file-list"},yt={key:0,class:"rgp-empty"},Ct={key:1,class:"rgp-empty is-error"},bt=["title","onClick"],ft={class:"rgp-file-meta-row"},kt={class:"rgp-file-status"},wt={class:"rgp-file-delta"},Bt={class:"rgp-added"},St={class:"rgp-removed"},$t={class:"rgp-file-path"},Ft={key:0,class:"rgp-file-previous-path"},Rt={key:0,class:"rgp-empty"},Lt=de({__name:"RightGitPanel",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},worktreeChangeSummary:{},worktreeChanges:{},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},commitFilesBySha:{},commitFilesLoadingFor:{},commitFilesError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits","loadCommitFiles","openCommitFile"],setup(d,{emit:G}){const r=d,g=G,E=_(null),$=_(""),F=_(""),u=_(""),y=_(""),w=_(""),R=_(""),C=_(!0),q=v(()=>r.showReview!==!1),{buildFeedbackMailto:Q,feedbackMailtoBase:J,recordVisibleFailure:X}=Ce(),{t:n}=_e(),Y=J();function Z(t,a){X(a);const e=t.currentTarget;e instanceof HTMLAnchorElement&&(e.href=Q())}const ee=v(()=>r.currentBranch?r.currentBranch:r.headSubject?r.headSubject:r.headSha?`${n("Detached")} ${r.headSha}`:r.loading?n("Loading branch..."):n("Detached HEAD")),H=v(()=>{var e;const t=[r.headSha,r.headDate].filter(Boolean).join(" · "),a=((e=r.headSubject)==null?void 0:e.trim())??"";return a&&t?`${a} (${t})`:a||t}),B=v(()=>r.busy||r.loading),L=v(()=>r.error||(r.dirty?n("Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them."):"")),M=v(()=>r.error?"error":"info"),N=v(()=>{const t=$.value.trim().toLowerCase(),a=[...r.branches].sort((e,m)=>e.isRemote===!0&&m.isRemote!==!0?1:e.isRemote!==!0&&m.isRemote===!0?-1:0);return t?a.filter(e=>e.label.toLowerCase().includes(t)||e.value.toLowerCase().includes(t)):a}),te=v(()=>r.branches.find(t=>t.value===u.value)??null),V=v(()=>{var t;return((t=te.value)==null?void 0:t.isRemote)===!0}),x=v(()=>u.value?`${u.value}\0${C.value?"with-reset-history":"without-reset-history"}`:""),j=v(()=>x.value?r.commitsByBranch[x.value]||[]:[]),h=v(()=>j.value.find(t=>t.sha===y.value)??null),K=v(()=>h.value?r.commitFilesBySha[h.value.sha]||[]:[]),A=v(()=>{const t=F.value.trim().toLowerCase(),a=j.value;return t?a.filter(e=>e.sha.toLowerCase().includes(t)||e.shortSha.toLowerCase().includes(t)||e.subject.toLowerCase().includes(t)||e.date.toLowerCase().includes(t)):a});function se(t){u.value=t,y.value="",g("loadCommits",{branch:t,includeResetHistory:C.value})}function ae(){u.value&&g("loadCommits",{branch:u.value,includeResetHistory:C.value})}function I(t){var e;const a=((e=r.headSha)==null?void 0:e.trim())??"";return a?t.sha===a||t.shortSha===a||t.sha.startsWith(a):!1}function oe(t){return`${n("Show")} ${t.shortSha} ${n("files")}`}function re(t){y.value=t.sha,g("loadCommitFiles",t.sha)}function f(t){const a=t.sha.trim()||t.shortSha.trim();a&&(w.value=t.sha,ye(a).catch(()=>{w.value=""}))}function ne(){!u.value||!h.value||V.value||g("resetBranchToCommit",{branch:u.value,sha:h.value.sha})}function O(t){return typeof t=="number"&&Number.isFinite(t)?String(t):"-"}function ie(t){h.value&&g("openCommitFile",{sha:h.value.sha,path:t})}function le(t){r.headSha&&g("openCommitFile",{sha:r.headSha,path:t})}function U(){var a,e;const t=(a=r.currentBranch)==null?void 0:a.trim();return t||(((e=r.branches[0])==null?void 0:e.value)??"")}function ce(){const t=u.value||U();t&&(u.value=t,g("loadCommits",{branch:t,includeResetHistory:C.value}))}return he(()=>{ce(),pe(()=>{var t;return(t=E.value)==null?void 0:t.focus()})}),W(()=>[r.currentBranch,r.branches.map(t=>t.value).join(`
2
2
  `)],()=>{var m;const t=U();if(!t){u.value="",R.value="";return}const a=((m=r.currentBranch)==null?void 0:m.trim())??"",e=a!==R.value;R.value=a,(e||!u.value||!r.branches.some(ue=>ue.value===u.value))&&(u.value=t),u.value&&g("loadCommits",{branch:u.value,includeResetHistory:C.value})},{immediate:!0}),W(j,t=>{y.value&&(t.some(a=>a.sha===y.value)||(y.value=""))}),(t,a)=>(i(),l("div",fe,[q.value?(i(),l("button",{key:0,class:"rgp-review",type:"button",onClick:a[0]||(a[0]=e=>g("toggleReview"))},[ve(me,{class:"rgp-review-icon"}),s("span",ke,o(d.reviewOpen?c(n)("Review Worktree Changes (Open)"):c(n)("Review Worktree Changes")),1),s("span",we,[s("span",Be,"+"+o(d.worktreeChangeSummary.addedLineCount),1),s("span",Se,"-"+o(d.worktreeChangeSummary.removedLineCount),1)])])):p("",!0),s("div",$e,[s("span",Fe,o(d.detached?c(n)("Detached HEAD"):c(n)("Current branch")),1),s("span",Re,o(ee.value),1),H.value?(i(),l("span",Le,o(H.value),1)):p("",!0)]),L.value?(i(),l("div",{key:1,class:P(["rgp-status",{"is-error":M.value==="error"}])},[s("span",null,o(L.value),1),M.value==="error"?(i(),l("a",{key:0,class:"rgp-feedback",href:c(Y),onClick:a[1]||(a[1]=e=>Z(e,L.value))},o(c(n)("Send feedback")),9,xe)):p("",!0)],2)):p("",!0),r.worktreeChanges.length>0?(i(),l("div",je,[s("div",Pe,o(r.worktreeChanges.length)+" "+o(r.worktreeChanges.length===1?c(n)("file changed"):c(n)("files changed")),1),s("div",Te,[(i(!0),l(b,null,S(r.worktreeChanges,e=>(i(),l("button",{key:`${e.status}:${e.previousPath??""}:${e.path}`,class:"rgp-file",type:"button",title:e.previousPath?`${e.previousPath} → ${e.path}`:e.path,onClick:m=>le(e.path)},[s("span",Ee,o(e.label),1),s("span",He,o(e.path),1),e.previousPath?(i(),l("span",Me,"← "+o(e.previousPath),1)):p("",!0)],8,De))),128))])])):p("",!0),s("div",Ne,[s("div",Ve,o(c(n)("Branches")),1),s("div",Ke,[T(s("input",{ref_key:"searchInputRef",ref:E,"onUpdate:modelValue":a[2]||(a[2]=e=>$.value=e),class:"rgp-search",type:"text",placeholder:c(n)("Search branches...")},null,8,Ae),[[z,$.value]])]),s("ul",Ie,[(i(!0),l(b,null,S(N.value,e=>(i(),l("li",{key:e.value,class:"rgp-branch-item"},[s("div",Oe,[s("button",{class:P(["rgp-branch-button",{"is-current":e.value===d.currentBranch,"is-selected":e.value===u.value}]),type:"button",disabled:B.value,onClick:m=>se(e.value)},[s("span",We,o(e.label),1),e.value===d.currentBranch?(i(),l("span",ze,o(c(n)("current")),1)):e.isRemote?(i(),l("span",Ge,o(c(n)("remote")),1)):p("",!0)],10,Ue),e.value===u.value&&e.value!==d.currentBranch&&!e.isRemote?(i(),l("button",{key:0,class:"rgp-branch-checkout",type:"button",disabled:B.value,onClick:m=>g("checkoutBranch",e.value)},o(c(n)("Checkout")),9,qe)):p("",!0)])]))),128)),N.value.length===0?(i(),l("li",Qe,o(c(n)("No branches found.")),1)):p("",!0)])]),s("div",Je,[s("div",Xe,o(c(n)("Commits")),1),s("div",Ye,[T(s("input",{"onUpdate:modelValue":a[3]||(a[3]=e=>F.value=e),class:"rgp-search",type:"text",placeholder:c(n)("Search commits...")},null,8,Ze),[[z,F.value]])]),s("label",et,[T(s("input",{"onUpdate:modelValue":a[4]||(a[4]=e=>C.value=e),type:"checkbox",onChange:ae},null,544),[[ge,C.value]]),s("span",null,o(c(n)("Reset-history refs")),1)]),s("div",tt,[u.value?d.commitsLoadingFor===x.value?(i(),l("div",at,o(c(n)("Loading commits...")),1)):d.commitsError?(i(),l("div",ot,o(d.commitsError),1)):(i(),l(b,{key:3},[(i(!0),l(b,null,S(A.value,e=>(i(),l("button",{key:e.sha,class:P(["rgp-commit",{"is-current":I(e),"is-selected":e.sha===y.value}]),type:"button",disabled:B.value,title:oe(e),onClick:m=>re(e)},[s("span",nt,[s("span",{class:"rgp-ref",role:"button",tabindex:"0",title:w.value===e.sha?c(n)("Copied commit ref"):`${c(n)("Copy")} ${e.sha}`,onClick:k(m=>f(e),["stop"]),onKeydown:[D(k(m=>f(e),["prevent","stop"]),["enter"]),D(k(m=>f(e),["prevent","stop"]),["space"])]},o(e.shortSha),41,it),s("span",lt,[I(e)?(i(),l("span",ct,o(c(n)("current")),1)):p("",!0),s("span",null,o(e.date),1)])]),s("span",ut,o(e.subject),1)],10,rt))),128)),A.value.length===0?(i(),l("div",dt,o(c(n)("No commits found.")),1)):p("",!0)],64)):(i(),l("div",st,o(c(n)("Select a branch.")),1))])]),h.value?(i(),l("div",ht,[s("div",pt,[s("span",{class:"rgp-ref",role:"button",tabindex:"0",title:w.value===h.value.sha?c(n)("Copied commit ref"):`${c(n)("Copy")} ${h.value.sha}`,onClick:a[5]||(a[5]=k(e=>f(h.value),["stop"])),onKeydown:a[6]||(a[6]=D(k(e=>f(h.value),["prevent","stop"]),["enter"]))},o(h.value.shortSha),41,vt),s("button",{class:"rgp-reset-commit",type:"button",disabled:B.value||V.value||!u.value,onClick:ne},o(c(n)("Reset")),9,mt)]),s("p",gt,o(h.value.subject),1),s("div",_t,[d.commitFilesLoadingFor===h.value.sha?(i(),l("div",yt,o(c(n)("Loading files...")),1)):d.commitFilesError?(i(),l("div",Ct,o(d.commitFilesError),1)):(i(),l(b,{key:2},[(i(!0),l(b,null,S(K.value,e=>(i(),l("button",{key:`${e.status}:${e.previousPath??""}:${e.path}`,class:"rgp-file",type:"button",title:e.previousPath?`${e.previousPath} → ${e.path}`:e.path,onClick:m=>ie(e.path)},[s("span",ft,[s("span",kt,o(e.label),1),s("span",wt,[s("span",Bt,"+"+o(O(e.addedLineCount)),1),s("span",St,"-"+o(O(e.removedLineCount)),1)])]),s("span",$t,o(e.path),1),e.previousPath?(i(),l("span",Ft,"← "+o(e.previousPath),1)):p("",!0)],8,bt))),128)),K.value.length===0?(i(),l("div",Rt,o(c(n)("No file changes.")),1)):p("",!0)],64))])])):p("",!0)]))}}),jt=be(Lt,[["__scopeId","data-v-76cdff49"]]);export{jt as default};
@@ -1,3 +1,3 @@
1
- import{e as P,f as d,i as r,F as C,l as w,j as t,t as s,k as m,v as D,_ as K,u as n,n as f,h as H,w as B,p as F,I as Z,a2 as M,ay as E,W as $,a0 as T,T as q,r as Q}from"./index-kOwa0g4Z.js";const X={key:0,class:"rate-limit-status","aria-live":"polite"},j=["title"],z={class:"rate-limit-card-header"},J={class:"rate-limit-card-title"},Y={key:0,class:"rate-limit-card-plan"},_={class:"rate-limit-card-metrics"},ee={key:0,class:"rate-limit-card-footer"},te=P({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){const{t:b}=D();function o(l){var c,g;return((c=l.limitId)==null?void 0:c.trim())||((g=l.limitName)==null?void 0:g.trim())||"__default__"}function h(l){var c,g;return((c=l.limitName)==null?void 0:c.trim())||((g=l.limitId)==null?void 0:g.trim())||b("Rate limits")}function u(l){const c=l.trim();return c?c.replace(/[_-]+/g," ").replace(/\b\w/g,g=>g.toUpperCase()):""}function v(l){return!l||l<=0?b("Window"):l%1440===0?`${l/1440}d`:l%60===0?`${l/60}h`:l<60?`${l}m`:`${Math.round(l/60*10)/10}h`}function I(l){const c=Math.max(0,Math.min(100,100-l));return`${Math.round(c)}% ${b("left")}`}function p(l){return`${Math.round(l)}%`}function a(l,c){return{key:c,label:`${v(l.windowDurationMins)} ${I(l.usedPercent)}`}}function R(l){const c=[];return l.primary&&c.push(a(l.primary,"primary")),l.secondary&&c.push(a(l.secondary,"secondary")),c}function i(l){if(!l)return"";const c=new Date(l*1e3),g=c.getMonth()+1,y=String(c.getDate()).padStart(2,"0"),A=String(c.getHours()).padStart(2,"0"),S=String(c.getMinutes()).padStart(2,"0");return`${g}.${y} ${A}:${S}`}function k(l){if(!(l!=null&&l.resetsAt))return"";const c=l.resetsAt*1e3-Date.now();if(c<=0)return b("Resetting now");const g=Math.round(c/6e4);if(g<60)return`${b("Resets in")} ${g}m`;const y=Math.round(g/60);if(y<24)return`${b("Resets in")} ${y}h`;const A=Math.round(y/24);return`${b("Resets in")} ${A}d`}function L(l){return[l.primary,l.secondary].filter(c=>c!==null)}function O(l){const c=L(l);return c.length===0?null:[...c].sort((g,y)=>{const A=g.windowDurationMins??Number.MAX_SAFE_INTEGER,S=y.windowDurationMins??Number.MAX_SAFE_INTEGER;return A!==S?A-S:(g.resetsAt??Number.MAX_SAFE_INTEGER)-(y.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function N(l){const c=L(l);if(c.length===0)return"";const g=[...c].sort((A,S)=>{const W=A.windowDurationMins??-1,U=S.windowDurationMins??-1;return W!==U?U-W:(S.resetsAt??-1)-(A.resetsAt??-1)})[0],y=i(g.resetsAt);return y||""}function G(l){const c=l.credits;return c?c.unlimited?b("Unlimited credits"):c.balance?`${b("Credits")} ${c.balance}`:c.hasCredits?b("Credits available"):"":""}function x(l){return[k(O(l)),N(l),G(l)].filter(c=>c.length>0)}function V(l){const c=[h(l)];for(const g of R(l))c.push(g.label);for(const g of L(l))c.push(`${v(g.windowDurationMins)} used ${p(g.usedPercent)}`);for(const g of x(l))c.push(g);return c.join(`
1
+ import{e as P,f as d,i as r,F as C,l as w,j as t,t as s,k as m,v as D,_ as K,u as n,n as f,h as H,w as B,p as F,I as Z,a2 as M,ay as E,W as $,a0 as T,T as q,r as Q}from"./index-Cu_hRJGY.js";const X={key:0,class:"rate-limit-status","aria-live":"polite"},j=["title"],z={class:"rate-limit-card-header"},J={class:"rate-limit-card-title"},Y={key:0,class:"rate-limit-card-plan"},_={class:"rate-limit-card-metrics"},ee={key:0,class:"rate-limit-card-footer"},te=P({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){const{t:b}=D();function o(l){var c,g;return((c=l.limitId)==null?void 0:c.trim())||((g=l.limitName)==null?void 0:g.trim())||"__default__"}function h(l){var c,g;return((c=l.limitName)==null?void 0:c.trim())||((g=l.limitId)==null?void 0:g.trim())||b("Rate limits")}function u(l){const c=l.trim();return c?c.replace(/[_-]+/g," ").replace(/\b\w/g,g=>g.toUpperCase()):""}function v(l){return!l||l<=0?b("Window"):l%1440===0?`${l/1440}d`:l%60===0?`${l/60}h`:l<60?`${l}m`:`${Math.round(l/60*10)/10}h`}function I(l){const c=Math.max(0,Math.min(100,100-l));return`${Math.round(c)}% ${b("left")}`}function p(l){return`${Math.round(l)}%`}function a(l,c){return{key:c,label:`${v(l.windowDurationMins)} ${I(l.usedPercent)}`}}function R(l){const c=[];return l.primary&&c.push(a(l.primary,"primary")),l.secondary&&c.push(a(l.secondary,"secondary")),c}function i(l){if(!l)return"";const c=new Date(l*1e3),g=c.getMonth()+1,y=String(c.getDate()).padStart(2,"0"),A=String(c.getHours()).padStart(2,"0"),S=String(c.getMinutes()).padStart(2,"0");return`${g}.${y} ${A}:${S}`}function k(l){if(!(l!=null&&l.resetsAt))return"";const c=l.resetsAt*1e3-Date.now();if(c<=0)return b("Resetting now");const g=Math.round(c/6e4);if(g<60)return`${b("Resets in")} ${g}m`;const y=Math.round(g/60);if(y<24)return`${b("Resets in")} ${y}h`;const A=Math.round(y/24);return`${b("Resets in")} ${A}d`}function L(l){return[l.primary,l.secondary].filter(c=>c!==null)}function O(l){const c=L(l);return c.length===0?null:[...c].sort((g,y)=>{const A=g.windowDurationMins??Number.MAX_SAFE_INTEGER,S=y.windowDurationMins??Number.MAX_SAFE_INTEGER;return A!==S?A-S:(g.resetsAt??Number.MAX_SAFE_INTEGER)-(y.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function N(l){const c=L(l);if(c.length===0)return"";const g=[...c].sort((A,S)=>{const W=A.windowDurationMins??-1,U=S.windowDurationMins??-1;return W!==U?U-W:(S.resetsAt??-1)-(A.resetsAt??-1)})[0],y=i(g.resetsAt);return y||""}function G(l){const c=l.credits;return c?c.unlimited?b("Unlimited credits"):c.balance?`${b("Credits")} ${c.balance}`:c.hasCredits?b("Credits available"):"":""}function x(l){return[k(O(l)),N(l),G(l)].filter(c=>c.length>0)}function V(l){const c=[h(l)];for(const g of R(l))c.push(g.label);for(const g of L(l))c.push(`${v(g.windowDurationMins)} used ${p(g.usedPercent)}`);for(const g of x(l))c.push(g);return c.join(`
2
2
  `)}return(l,c)=>e.snapshots.length>0?(d(),r("aside",X,[(d(!0),r(C,null,w(e.snapshots,g=>(d(),r("div",{key:o(g),class:"rate-limit-card",title:V(g)},[t("div",z,[t("span",J,s(h(g)),1),g.planType?(d(),r("span",Y,s(u(g.planType)),1)):m("",!0)]),t("div",_,[(d(!0),r(C,null,w(R(g),y=>(d(),r("span",{key:y.key,class:"rate-limit-card-metric"},s(y.label),1))),128))]),x(g).length>0?(d(),r("div",ee,s(x(g).join(" | ")),1)):m("",!0)],8,j))),128))])):m("",!0)}}),ne=K(te,[["__scopeId","data-v-1fd5e1ec"]]),oe={class:"sidebar-settings-account-section"},se={class:"sidebar-settings-account-header"},ie={class:"sidebar-settings-account-header-main"},ae=["aria-expanded","title"],le={class:"sidebar-settings-account-collapse-icon"},ce={class:"sidebar-settings-account-title"},de={class:"sidebar-settings-account-count"},re=["disabled"],ue={key:0,class:"sidebar-settings-account-error visible-error-with-feedback"},ge=["href"],be={class:"sidebar-settings-account-login"},me=["disabled"],he=["href"],ve={key:1,class:"sidebar-settings-account-empty"},ye={key:2,class:"sidebar-settings-account-list"},Ce=["title","onMouseenter","onMouseleave"],fe={class:"sidebar-settings-account-main"},ke={class:"sidebar-settings-account-email"},Ae={class:"sidebar-settings-account-meta"},Se={class:"sidebar-settings-account-quota"},Fe={class:"sidebar-settings-account-id"},we={class:"sidebar-settings-account-actions"},Re=["disabled","onClick"],Le=["disabled","onClick"],pe=P({__name:"SettingsAccountsPanel",props:{accounts:{},isAccountsSectionCollapsed:{type:Boolean},isRefreshingAccounts:{type:Boolean},isSwitchingAccounts:{type:Boolean},isStartingCodexLogin:{type:Boolean},isCompletingCodexLogin:{type:Boolean},accountActionError:{},codexLoginUrl:{},feedbackMailto:{},isAccountUnavailable:{type:Function},isRemoveConfirmationActive:{type:Function},isRemoveVisible:{type:Function},buildAccountTitle:{type:Function},formatAccountMeta:{type:Function},formatAccountQuota:{type:Function},shortAccountId:{type:Function},isAccountActionDisabled:{type:Function},getAccountSwitchLabel:{type:Function},getAccountRemoveLabel:{type:Function},onRefreshAccounts:{type:Function},onStartCodexLogin:{type:Function},onSwitchAccount:{type:Function},onRemoveAccount:{type:Function},onAccountCardPointerEnter:{type:Function},onAccountCardPointerLeave:{type:Function},toggleAccountsSectionCollapsed:{type:Function},prepareFeedbackLink:{type:Function}},setup(e){const{t:b}=D();return(o,h)=>(d(),r("div",oe,[t("div",se,[t("div",ie,[t("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!e.isAccountsSectionCollapsed,title:e.isAccountsSectionCollapsed?n(b)("Expand accounts"):n(b)("Collapse accounts"),onClick:h[0]||(h[0]=(...u)=>e.toggleAccountsSectionCollapsed&&e.toggleAccountsSectionCollapsed(...u))},[t("span",le,s(e.isAccountsSectionCollapsed?"▸":"▾"),1)],8,ae),t("span",ce,s(n(b)("Accounts")),1),t("span",de,s(e.accounts.length),1)]),t("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:e.isRefreshingAccounts||e.isSwitchingAccounts||e.isStartingCodexLogin||e.isCompletingCodexLogin,onClick:h[1]||(h[1]=(...u)=>e.onRefreshAccounts&&e.onRefreshAccounts(...u))},s(e.isRefreshingAccounts?n(b)("Reloading…"):n(b)("Reload")),9,re)]),e.isAccountsSectionCollapsed?m("",!0):(d(),r(C,{key:0},[e.accountActionError?(d(),r("div",ue,[t("span",null,s(e.accountActionError),1),t("a",{class:"visible-error-feedback",href:e.feedbackMailto,onClick:h[2]||(h[2]=u=>e.prepareFeedbackLink(u,e.accountActionError))},s(n(b)("Send feedback")),9,ge)])):m("",!0),t("div",be,[t("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:e.isRefreshingAccounts||e.isSwitchingAccounts||e.isStartingCodexLogin||e.isCompletingCodexLogin,onClick:h[3]||(h[3]=(...u)=>e.onStartCodexLogin&&e.onStartCodexLogin(...u))},s(e.isStartingCodexLogin?n(b)("Starting login…"):n(b)("Login")),9,me),e.codexLoginUrl?(d(),r("a",{key:0,class:"sidebar-settings-account-login-link",href:e.codexLoginUrl,target:"_blank",rel:"noreferrer"},s(n(b)("Open login URL")),9,he)):m("",!0)]),e.accounts.length===0?(d(),r("p",ve,s(n(b)("Click Login, or run `codex login`, then click reload.")),1)):(d(),r("div",ye,[(d(!0),r(C,null,w(e.accounts,u=>(d(),r("article",{key:u.storageId,class:f(["sidebar-settings-account-item",{"is-active":u.isActive,"is-unavailable":e.isAccountUnavailable(u),"is-confirming-remove":e.isRemoveConfirmationActive(u),"is-remove-visible":e.isRemoveVisible(u)}]),title:e.buildAccountTitle(u),onMouseenter:v=>e.onAccountCardPointerEnter(u.storageId),onMouseleave:v=>e.onAccountCardPointerLeave(u.storageId)},[t("div",fe,[t("p",ke,s(u.email||n(b)("Account")),1),t("p",Ae,s(e.formatAccountMeta(u)),1),t("p",Se,s(e.formatAccountQuota(u)),1),t("p",Fe," Workspace "+s(e.shortAccountId(u.accountId)),1)]),t("div",we,[t("button",{class:"sidebar-settings-account-switch",type:"button",disabled:e.isAccountActionDisabled(u)||u.isActive||e.isAccountUnavailable(u),onClick:v=>e.onSwitchAccount(u.storageId)},s(e.getAccountSwitchLabel(u)),9,Re),t("button",{class:f(["sidebar-settings-account-remove",{"is-visible":e.isRemoveVisible(u),"is-confirming":e.isRemoveConfirmationActive(u)}]),type:"button",disabled:e.isAccountActionDisabled(u),onClick:v=>e.onRemoveAccount(u.storageId)},s(e.getAccountRemoveLabel(u)),11,Le)])],42,Ce))),128))]))],64))]))}}),Me=K(pe,[["__scopeId","data-v-828a7adf"]]),Ee=["aria-label"],$e={class:"settings-dialog-header"},Te={class:"settings-dialog-title"},Ie=["aria-label","title"],xe={class:"settings-dialog-body"},Pe=["aria-label"],De=["aria-current","onClick"],Ke={class:"settings-group-content"},We=["title"],Ue={class:"sidebar-settings-label"},Be=["title"],Oe={class:"sidebar-settings-label"},Ne={class:"sidebar-settings-value"},Ge=["title"],Ve={class:"sidebar-settings-label"},He={class:"sidebar-settings-value"},Ze=["title"],qe={class:"sidebar-settings-label"},Qe=["title"],Xe={class:"sidebar-settings-label"},je={class:"sidebar-settings-value"},ze=["title"],Je={class:"sidebar-settings-label"},Ye=["title"],_e={class:"sidebar-settings-label"},et=["title"],tt={class:"sidebar-settings-label"},nt=["title"],ot={class:"sidebar-settings-label"},st=["href"],it={class:"sidebar-settings-label"},at={class:"sidebar-settings-value"},lt=["title"],ct={class:"sidebar-settings-label"},dt={key:0,class:"sidebar-settings-row sidebar-settings-error"},rt=["href"],ut={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},gt={class:"sidebar-settings-provider-info"},bt={class:"sidebar-settings-label"},mt={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},ht={class:"sidebar-settings-key-group"},vt={class:"sidebar-settings-key-masked"},yt=["disabled","title"],Ct=["model-value","placeholder"],ft=["disabled"],kt={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},At={class:"sidebar-settings-label"},St=["aria-label"],Ft=["disabled"],wt=["disabled"],Rt={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},Lt={class:"sidebar-settings-provider-info"},pt={class:"sidebar-settings-label"},Mt={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},Et={class:"sidebar-settings-key-group"},$t=["model-value","placeholder"],Tt=["disabled"],It={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},xt={class:"sidebar-settings-label"},Pt={class:"sidebar-settings-key-group"},Dt=["model-value","placeholder"],Kt={class:"sidebar-settings-label",style:{"margin-top":"4px"}},Wt={class:"sidebar-settings-key-group"},Ut=["model-value","placeholder"],Bt=["disabled"],Ot={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},Nt={class:"sidebar-settings-label"},Gt=["aria-label"],Vt={class:"sidebar-settings-label"},Ht={class:"sidebar-settings-value"},Zt={key:0,class:"sidebar-settings-telegram-panel"},qt={class:"sidebar-settings-field"},Qt={class:"sidebar-settings-field-label"},Xt=["value"],jt={class:"sidebar-settings-field"},zt={class:"sidebar-settings-field-label"},Jt=["value"],Yt={class:"sidebar-settings-field-help"},_t={key:0,class:"sidebar-settings-telegram-error"},en=["href"],tn={class:"sidebar-settings-telegram-actions"},nn=["disabled"],on={class:"sidebar-settings-hooks-section"},sn={class:"sidebar-settings-hooks-header"},an={class:"sidebar-settings-hooks-title"},ln=["disabled","title"],cn={key:0,class:"sidebar-settings-hooks-empty"},dn={key:0,class:"sidebar-settings-hooks-empty"},rn={key:1,class:"sidebar-settings-hooks-empty"},un={key:2,class:"sidebar-settings-hooks-list"},gn={class:"sidebar-settings-hooks-cwd"},bn={class:"sidebar-settings-hooks-event"},mn={class:"sidebar-settings-hooks-command"},hn={class:"sidebar-settings-remote-section"},vn={class:"sidebar-settings-remote-header"},yn={class:"sidebar-settings-remote-title"},Cn=["disabled","title"],fn={class:"sidebar-settings-remote-toggle-label"},kn={key:0,class:"sidebar-settings-remote-empty"},An={key:0,class:"sidebar-settings-remote-error"},Sn={key:1,class:"sidebar-settings-remote-notice"},Fn={key:2,class:"sidebar-settings-remote-empty"},wn=["disabled"],Rn={class:"sidebar-settings-remote-label"},Ln={class:"sidebar-settings-remote-value"},pn={class:"sidebar-settings-remote-clients"},Mn={class:"sidebar-settings-remote-clients-header"},En={class:"sidebar-settings-remote-label"},$n=["disabled"],Tn={key:0,class:"sidebar-settings-remote-empty"},In={class:"sidebar-settings-remote-client-name"},xn=["disabled","onClick"],Pn={class:"sidebar-settings-rate-limits"},Dn=["aria-label"],Kn=P({__name:"SettingsDialog",props:{activeSettingsGroup:{},accounts:{},isAccountsSectionCollapsed:{type:Boolean},isRefreshingAccounts:{type:Boolean},isSwitchingAccounts:{type:Boolean},isStartingCodexLogin:{type:Boolean},isCompletingCodexLogin:{type:Boolean},accountActionError:{},codexLoginUrl:{},feedbackMailto:{},isAccountUnavailable:{type:Function},isRemoveConfirmationActive:{type:Function},isRemoveVisible:{type:Function},buildAccountTitle:{type:Function},formatAccountMeta:{type:Function},formatAccountQuota:{type:Function},shortAccountId:{type:Function},isAccountActionDisabled:{type:Function},getAccountSwitchLabel:{type:Function},getAccountRemoveLabel:{type:Function},onRefreshAccounts:{type:Function},onStartCodexLogin:{type:Function},onSwitchAccount:{type:Function},onRemoveAccount:{type:Function},onAccountCardPointerEnter:{type:Function},onAccountCardPointerLeave:{type:Function},toggleAccountsSectionCollapsed:{type:Function},prepareFeedbackLink:{type:Function},sendWithEnter:{type:Boolean},inProgressSendMode:{},darkMode:{},uiLanguage:{},uiLanguageOptions:{},chatWidthLabel:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},dictationLanguageOptions:{},autoCompactThreshold:{},autoCompactThresholdOptions:{},hasVisibleFeedbackError:{type:Boolean},selectedProvider:{},providerDropdownOptions:{},freeModeLoading:{type:Boolean},providerError:{},freeModeHasCustomKey:{type:Boolean},freeModeCustomKey:{},freeModeCustomKeyMasked:{},freeModeCustomKeySaving:{type:Boolean},openRouterWireApi:{},opencodeZenKey:{},customEndpointUrl:{},customEndpointKey:{},customEndpointWireApi:{},isTelegramConfigOpen:{type:Boolean},telegramStatusText:{},telegramBotTokenDraft:{},telegramAllowedUserIdsDraft:{},telegramConfigError:{},isTelegramSaving:{type:Boolean},supportsHooks:{type:Boolean},isHooksLoading:{type:Boolean},hooksList:{},supportsRemoteControl:{type:Boolean},remoteControlStatus:{},isRemoteControlActionInFlight:{type:Boolean},remoteControlError:{},remoteControlNotice:{},isRemoteControlLoading:{type:Boolean},remoteControlActionName:{},pairingCode:{},accountRateLimitSnapshots:{},worktreeName:{},appVersion:{},onClose:{type:Function},onActiveSettingsGroupChange:{type:Function},toggleSendWithEnter:{type:Function},cycleInProgressSendMode:{type:Function},cycleDarkMode:{type:Function},onUiLanguageChange:{type:Function},cycleChatWidth:{type:Function},toggleDictationClickToToggle:{type:Function},toggleDictationAutoSend:{type:Function},onDictationLanguageChange:{type:Function},onAutoCompactThresholdChange:{type:Function},onProviderChange:{type:Function},onFreeModeCustomKeyChange:{type:Function},clearFreeModeCustomKey:{type:Function},saveFreeModeCustomKey:{type:Function},setOpenRouterWireApi:{type:Function},onOpencodeZenKeyChange:{type:Function},saveOpencodeZen:{type:Function},onCustomEndpointUrlChange:{type:Function},onCustomEndpointKeyChange:{type:Function},saveCustomEndpoint:{type:Function},onCustomEndpointWireApiChange:{type:Function},onTelegramConfigOpenChange:{type:Function},onTelegramBotTokenDraftChange:{type:Function},onTelegramAllowedUserIdsDraftChange:{type:Function},saveTelegramConfig:{type:Function},refreshHooks:{type:Function},toggleRemoteControl:{type:Function},startRemotePairing:{type:Function},refreshRemoteClients:{type:Function},revokeRemoteClient:{type:Function}},setup(e,{expose:b}){const{t:o}=D(),h=Q(null),u=[{id:"general",label:"General settings"},{id:"models",label:"Models & providers"},{id:"integrations",label:"Integrations"},{id:"usage",label:"Usage & about"}],v={sendWithEnter:o("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:o("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:o("Switch between system theme, light mode, and dark mode."),chatWidth:o("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:o("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:o("Automatically send transcribed dictation when recording stops."),dictationLanguage:o("Choose transcription language or keep auto-detect.")};function I(p){var a;return((a=h.value)==null?void 0:a.contains(p))??!1}return b({containsTarget:I}),(p,a)=>{var R;return d(),H(q,{to:"body"},[t("div",{class:"settings-dialog-backdrop",role:"presentation",onClick:a[36]||(a[36]=B((...i)=>e.onClose&&e.onClose(...i),["self"]))},[t("div",{ref_key:"settingsPanelRef",ref:h,class:"sidebar-settings-panel",role:"dialog","aria-modal":"true","aria-label":n(o)("Settings"),onClick:a[35]||(a[35]=B(()=>{},["stop"]))},[t("div",$e,[t("h2",Te,s(n(o)("Settings")),1),t("button",{class:"settings-dialog-close",type:"button","aria-label":n(o)("Close"),title:n(o)("Close"),onClick:a[0]||(a[0]=(...i)=>e.onClose&&e.onClose(...i))},[F(Z,{class:"settings-dialog-close-icon"})],8,Ie)]),t("div",xe,[t("nav",{class:"settings-group-nav","aria-label":n(o)("Settings groups")},[(d(),r(C,null,w(u,i=>t("button",{key:i.id,type:"button",class:f(["settings-group-nav-item",{"is-active":e.activeSettingsGroup===i.id}]),"aria-current":e.activeSettingsGroup===i.id?"true":void 0,onClick:k=>e.onActiveSettingsGroupChange(i.id)},s(n(o)(i.label)),11,De)),64))],8,Pe),t("div",Ke,[M(t("div",null,[F(Me,{accounts:e.accounts,"is-accounts-section-collapsed":e.isAccountsSectionCollapsed,"is-refreshing-accounts":e.isRefreshingAccounts,"is-switching-accounts":e.isSwitchingAccounts,"is-starting-codex-login":e.isStartingCodexLogin,"is-completing-codex-login":e.isCompletingCodexLogin,"account-action-error":e.accountActionError,"codex-login-url":e.codexLoginUrl,"feedback-mailto":e.feedbackMailto,"is-account-unavailable":e.isAccountUnavailable,"is-remove-confirmation-active":e.isRemoveConfirmationActive,"is-remove-visible":e.isRemoveVisible,"build-account-title":e.buildAccountTitle,"format-account-meta":e.formatAccountMeta,"format-account-quota":e.formatAccountQuota,"short-account-id":e.shortAccountId,"is-account-action-disabled":e.isAccountActionDisabled,"get-account-switch-label":e.getAccountSwitchLabel,"get-account-remove-label":e.getAccountRemoveLabel,"on-refresh-accounts":e.onRefreshAccounts,"on-start-codex-login":e.onStartCodexLogin,"on-switch-account":e.onSwitchAccount,"on-remove-account":e.onRemoveAccount,"on-account-card-pointer-enter":e.onAccountCardPointerEnter,"on-account-card-pointer-leave":e.onAccountCardPointerLeave,"toggle-accounts-section-collapsed":e.toggleAccountsSectionCollapsed,"prepare-feedback-link":e.prepareFeedbackLink},null,8,["accounts","is-accounts-section-collapsed","is-refreshing-accounts","is-switching-accounts","is-starting-codex-login","is-completing-codex-login","account-action-error","codex-login-url","feedback-mailto","is-account-unavailable","is-remove-confirmation-active","is-remove-visible","build-account-title","format-account-meta","format-account-quota","short-account-id","is-account-action-disabled","get-account-switch-label","get-account-remove-label","on-refresh-accounts","on-start-codex-login","on-switch-account","on-remove-account","on-account-card-pointer-enter","on-account-card-pointer-leave","toggle-accounts-section-collapsed","prepare-feedback-link"]),t("button",{class:"sidebar-settings-row",type:"button",title:v.sendWithEnter,onClick:a[1]||(a[1]=(...i)=>e.toggleSendWithEnter&&e.toggleSendWithEnter(...i))},[t("span",Ue,s(n(o)("Require ⌘ + enter to send")),1),t("span",{class:f(["sidebar-settings-toggle",{"is-on":!e.sendWithEnter}])},null,2)],8,We),t("button",{class:"sidebar-settings-row",type:"button",title:v.inProgressSendMode,onClick:a[2]||(a[2]=(...i)=>e.cycleInProgressSendMode&&e.cycleInProgressSendMode(...i))},[t("span",Oe,s(n(o)("When busy, send as")),1),t("span",Ne,s(e.inProgressSendMode==="steer"?n(o)("Steer"):n(o)("Queue")),1)],8,Be),t("button",{class:"sidebar-settings-row",type:"button",title:v.appearance,onClick:a[3]||(a[3]=(...i)=>e.cycleDarkMode&&e.cycleDarkMode(...i))},[t("span",Ve,s(n(o)("Appearance")),1),t("span",He,s(e.darkMode==="system"?n(o)("System"):e.darkMode==="dark"?n(o)("Dark"):n(o)("Light")),1)],8,Ge),t("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:n(o)("Choose the interface language for the app.")},[t("span",qe,s(n(o)("UI language")),1),F($,{class:"sidebar-settings-provider-dropdown","model-value":e.uiLanguage,options:e.uiLanguageOptions,placeholder:n(o)("UI language"),"menu-align":"end","onUpdate:modelValue":a[4]||(a[4]=i=>e.onUiLanguageChange(i))},null,8,["model-value","options","placeholder"])],8,Ze),t("button",{class:"sidebar-settings-row",type:"button",title:v.chatWidth,onClick:a[5]||(a[5]=(...i)=>e.cycleChatWidth&&e.cycleChatWidth(...i))},[t("span",Xe,s(n(o)("Chat width")),1),t("span",je,s(e.chatWidthLabel),1)],8,Qe),t("button",{class:"sidebar-settings-row",type:"button",title:v.dictationClickToToggle,onClick:a[6]||(a[6]=(...i)=>e.toggleDictationClickToToggle&&e.toggleDictationClickToToggle(...i))},[t("span",Je,s(n(o)("Click to toggle dictation")),1),t("span",{class:f(["sidebar-settings-toggle",{"is-on":e.dictationClickToToggle}])},null,2)],8,ze),t("button",{class:"sidebar-settings-row",type:"button",title:v.dictationAutoSend,onClick:a[7]||(a[7]=(...i)=>e.toggleDictationAutoSend&&e.toggleDictationAutoSend(...i))},[t("span",_e,s(n(o)("Auto send dictation")),1),t("span",{class:f(["sidebar-settings-toggle",{"is-on":e.dictationAutoSend}])},null,2)],8,Ye),t("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v.dictationLanguage},[t("span",tt,s(n(o)("Dictation language")),1),F($,{class:"sidebar-settings-language-dropdown","model-value":e.dictationLanguage,options:e.dictationLanguageOptions,placeholder:n(o)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":n(o)("Search language..."),"onUpdate:modelValue":e.onDictationLanguageChange},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])],8,et),t("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:n(o)("Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.")},[t("span",ot,s(n(o)("Auto-compact before send")),1),F($,{class:"sidebar-settings-auto-compact-dropdown","model-value":String(e.autoCompactThreshold),options:e.autoCompactThresholdOptions,placeholder:n(o)("Off"),"menu-align":"end","onUpdate:modelValue":e.onAutoCompactThresholdChange},null,8,["model-value","options","placeholder","onUpdate:modelValue"])],8,nt),e.hasVisibleFeedbackError?(d(),r("a",{key:0,class:"sidebar-settings-row sidebar-settings-feedback-row",href:e.feedbackMailto,onClick:a[8]||(a[8]=(...i)=>e.prepareFeedbackLink&&e.prepareFeedbackLink(...i))},[t("span",it,s(n(o)("Send feedback")),1),t("span",at,s(n(o)("Issue detected")),1)],8,st)):m("",!0)],512),[[E,e.activeSettingsGroup==="general"]]),M(t("div",null,[t("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:n(o)("Choose the API provider for the Codex backend")},[t("span",ct,s(n(o)("Provider")),1),F($,{class:"sidebar-settings-provider-dropdown","model-value":e.selectedProvider,options:e.providerDropdownOptions,placeholder:n(o)("Provider"),disabled:e.freeModeLoading,"menu-align":"end","onUpdate:modelValue":e.onProviderChange},null,8,["model-value","options","placeholder","disabled","onUpdate:modelValue"])],8,lt),e.providerError?(d(),r("div",dt,[t("span",null,s(e.providerError),1),t("a",{class:"visible-error-feedback",href:e.feedbackMailto,onClick:a[9]||(a[9]=i=>e.prepareFeedbackLink(i,e.providerError))},s(n(o)("Send feedback")),9,rt)])):m("",!0),e.selectedProvider==="openrouter"?(d(),r("div",ut,[t("div",gt,[t("span",bt,s(n(o)("OpenRouter API key")),1),t("a",mt,s(n(o)("Get API key")),1)]),t("div",ht,[e.freeModeHasCustomKey&&!e.freeModeCustomKey?(d(),r(C,{key:0},[t("span",vt,s(e.freeModeCustomKeyMasked),1),t("button",{class:"sidebar-settings-key-clear",type:"button",disabled:e.freeModeCustomKeySaving,title:n(o)("Remove custom key, use community keys"),onClick:a[10]||(a[10]=(...i)=>e.clearFreeModeCustomKey&&e.clearFreeModeCustomKey(...i))},"✕",8,yt)],64)):(d(),r(C,{key:1},[t("input",{"model-value":e.freeModeCustomKey,onInput:a[11]||(a[11]=i=>e.onFreeModeCustomKeyChange(i.target.value)),class:"sidebar-settings-key-input",type:"password",placeholder:n(o)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:a[12]||(a[12]=T((...i)=>e.saveFreeModeCustomKey&&e.saveFreeModeCustomKey(...i),["enter"]))},null,40,Ct),t("button",{class:"sidebar-settings-key-save",type:"button",disabled:e.freeModeCustomKeySaving||!e.freeModeCustomKey.trim(),onClick:a[13]||(a[13]=(...i)=>e.saveFreeModeCustomKey&&e.saveFreeModeCustomKey(...i))},s(e.freeModeCustomKeySaving?"...":n(o)("Set")),9,ft)],64))]),t("div",kt,[t("span",At,s(n(o)("API format")),1),t("div",{class:"sidebar-settings-segmented",role:"group","aria-label":n(o)("OpenRouter API format")},[t("button",{type:"button",class:f(["sidebar-settings-segmented-option",{"is-active":e.openRouterWireApi==="responses"}]),disabled:e.freeModeCustomKeySaving||e.freeModeLoading,onClick:a[14]||(a[14]=i=>e.setOpenRouterWireApi("responses"))},s(n(o)("Responses")),11,Ft),t("button",{type:"button",class:f(["sidebar-settings-segmented-option",{"is-active":e.openRouterWireApi==="chat"}]),disabled:e.freeModeCustomKeySaving||e.freeModeLoading,onClick:a[15]||(a[15]=i=>e.setOpenRouterWireApi("chat"))},s(n(o)("Completions")),11,wt)],8,St)])])):m("",!0),e.selectedProvider==="opencode-zen"?(d(),r("div",Rt,[t("div",Lt,[t("span",pt,s(n(o)("OpenCode Zen API key")),1),t("a",Mt,s(n(o)("Get API key")),1)]),t("div",Et,[t("input",{"model-value":e.opencodeZenKey,onInput:a[16]||(a[16]=i=>e.onOpencodeZenKeyChange(i.target.value)),class:"sidebar-settings-key-input",type:"password",placeholder:n(o)("sk-..."),onKeydown:a[17]||(a[17]=T((...i)=>e.saveOpencodeZen&&e.saveOpencodeZen(...i),["enter"]))},null,40,$t),t("button",{class:"sidebar-settings-key-save",type:"button",disabled:e.freeModeCustomKeySaving||!e.opencodeZenKey.trim(),onClick:a[18]||(a[18]=(...i)=>e.saveOpencodeZen&&e.saveOpencodeZen(...i))},s(e.freeModeCustomKeySaving?"...":n(o)("Save")),9,Tt)])])):m("",!0),e.selectedProvider==="custom"?(d(),r("div",It,[t("span",xt,s(n(o)("Custom endpoint URL")),1),t("div",Pt,[t("input",{"model-value":e.customEndpointUrl,onInput:a[19]||(a[19]=i=>e.onCustomEndpointUrlChange(i.target.value)),class:"sidebar-settings-key-input",type:"url",placeholder:n(o)("https://api.example.com/v1"),onKeydown:a[20]||(a[20]=T((...i)=>e.saveCustomEndpoint&&e.saveCustomEndpoint(...i),["enter"]))},null,40,Dt)]),t("span",Kt,s(n(o)("API key")),1),t("div",Wt,[t("input",{"model-value":e.customEndpointKey,onInput:a[21]||(a[21]=i=>e.onCustomEndpointKeyChange(i.target.value)),class:"sidebar-settings-key-input",type:"password",placeholder:n(o)("Bearer token (optional)"),onKeydown:a[22]||(a[22]=T((...i)=>e.saveCustomEndpoint&&e.saveCustomEndpoint(...i),["enter"]))},null,40,Ut),t("button",{class:"sidebar-settings-key-save",type:"button",disabled:e.freeModeCustomKeySaving||!e.customEndpointUrl.trim(),onClick:a[23]||(a[23]=(...i)=>e.saveCustomEndpoint&&e.saveCustomEndpoint(...i))},s(e.freeModeCustomKeySaving?"...":n(o)("Save")),9,Bt)]),t("div",Ot,[t("span",Nt,s(n(o)("API format")),1),t("div",{class:"sidebar-settings-segmented",role:"group","aria-label":n(o)("Custom endpoint API format")},[t("button",{type:"button",class:f(["sidebar-settings-segmented-option",{"is-active":e.customEndpointWireApi==="responses"}]),onClick:a[24]||(a[24]=i=>e.onCustomEndpointWireApiChange("responses"))},s(n(o)("Responses")),3),t("button",{type:"button",class:f(["sidebar-settings-segmented-option",{"is-active":e.customEndpointWireApi==="chat"}]),onClick:a[25]||(a[25]=i=>e.onCustomEndpointWireApiChange("chat"))},s(n(o)("Completions")),3)],8,Gt)])])):m("",!0)],512),[[E,e.activeSettingsGroup==="models"]]),M(t("div",null,[t("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:a[26]||(a[26]=i=>e.onTelegramConfigOpenChange(!e.isTelegramConfigOpen))},[t("span",Vt,s(n(o)("Telegram")),1),t("span",Ht,s(e.telegramStatusText),1)]),e.isTelegramConfigOpen?(d(),r("div",Zt,[t("label",qt,[t("span",Qt,s(n(o)("Bot token")),1),t("input",{value:e.telegramBotTokenDraft,onInput:a[27]||(a[27]=i=>e.onTelegramBotTokenDraftChange(i.target.value)),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,40,Xt)]),t("label",jt,[t("span",zt,s(n(o)("Allowed Telegram user IDs")),1),t("textarea",{value:e.telegramAllowedUserIdsDraft,onInput:a[28]||(a[28]=i=>e.onTelegramAllowedUserIdsDraftChange(i.target.value)),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
3
3
  987654321`,spellcheck:"false"},null,40,Jt)]),t("div",Yt,s(n(o)("Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.")),1),e.telegramConfigError?(d(),r("div",_t,[t("span",null,s(e.telegramConfigError),1),t("a",{class:"visible-error-feedback",href:e.feedbackMailto,onClick:a[29]||(a[29]=i=>e.prepareFeedbackLink(i,e.telegramConfigError))},s(n(o)("Send feedback")),9,en)])):m("",!0),t("div",tn,[t("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:e.isTelegramSaving,onClick:a[30]||(a[30]=(...i)=>e.saveTelegramConfig&&e.saveTelegramConfig(...i))},s(e.isTelegramSaving?n(o)("Saving…"):n(o)("Save Telegram config")),9,nn)])])):m("",!0),t("div",on,[t("div",sn,[t("span",an,s(n(o)("Hooks")),1),t("button",{class:"sidebar-settings-hooks-reload",type:"button",disabled:e.isHooksLoading,title:n(o)("Reload lifecycle hooks"),onClick:a[31]||(a[31]=i=>e.refreshHooks({force:!0}))},s(e.isHooksLoading?n(o)("Reloading…"):n(o)("Reload")),9,ln)]),e.supportsHooks?(d(),r(C,{key:1},[e.isHooksLoading?(d(),r("p",dn,s(n(o)("Loading hooks…")),1)):e.hooksList.length===0?(d(),r("p",rn,s(n(o)("No hooks registered.")),1)):(d(),r("div",un,[(d(!0),r(C,null,w(e.hooksList,i=>(d(),r("div",{key:i.cwd||"__global__",class:"sidebar-settings-hooks-entry"},[t("p",gn,s(i.cwd||n(o)("Global")),1),(d(!0),r(C,null,w(i.hooks,(k,L)=>(d(),r("div",{key:`${i.cwd}:${k.event}:${L}`,class:"sidebar-settings-hooks-item"},[t("span",{class:f(["sidebar-settings-hooks-state",{"is-on":k.enabled!==!1}])},s(k.enabled===!1?n(o)("Disabled"):n(o)("Enabled")),3),t("span",bn,s(k.event),1),t("code",mn,s(k.command),1)]))),128))]))),128))]))],64)):(d(),r("p",cn,s(n(o)("Hooks are not supported by this Codex version.")),1))]),t("div",hn,[t("div",vn,[t("span",yn,s(n(o)("Remote control")),1),t("button",{class:"sidebar-settings-remote-toggle",type:"button",disabled:e.isRemoteControlActionInFlight||e.isRemoteControlLoading,title:n(o)("Enable or disable remote control"),onClick:a[32]||(a[32]=(...i)=>e.toggleRemoteControl&&e.toggleRemoteControl(...i))},[t("span",{class:f(["sidebar-settings-remote-toggle-track",{"is-on":e.remoteControlStatus.enabled}])},[...a[37]||(a[37]=[t("span",{class:"sidebar-settings-remote-toggle-thumb"},null,-1)])],2),t("span",fn,s(e.remoteControlStatus.enabled?n(o)("Enabled"):n(o)("Disabled")),1)],8,Cn)]),e.supportsRemoteControl?(d(),r(C,{key:1},[e.remoteControlError?(d(),r("p",An,s(e.remoteControlError),1)):m("",!0),e.remoteControlNotice?(d(),r("p",Sn,s(e.remoteControlNotice),1)):m("",!0),e.isRemoteControlLoading?(d(),r("p",Fn,s(n(o)("Loading…")),1)):(d(),r(C,{key:3},[t("button",{class:"sidebar-settings-remote-row",type:"button",disabled:!e.remoteControlStatus.enabled||e.isRemoteControlActionInFlight,onClick:a[33]||(a[33]=(...i)=>e.startRemotePairing&&e.startRemotePairing(...i))},[t("span",Rn,s(n(o)("Pair a new device")),1),t("span",Ln,s(e.remoteControlActionName==="pairing"?n(o)("Starting…"):(R=e.pairingCode)!=null&&R.pairingCode?e.pairingCode.pairingCode:n(o)("Generate code")),1)],8,wn),t("div",pn,[t("div",Mn,[t("span",En,s(n(o)("Paired devices")),1),t("button",{class:"sidebar-settings-remote-reload",type:"button",disabled:e.isRemoteControlActionInFlight,onClick:a[34]||(a[34]=(...i)=>e.refreshRemoteClients&&e.refreshRemoteClients(...i))},s(e.remoteControlActionName==="clients"?n(o)("Reloading…"):n(o)("Reload")),9,$n)]),e.remoteControlStatus.clients.length===0?(d(),r("p",Tn,s(n(o)("No paired devices.")),1)):m("",!0),(d(!0),r(C,null,w(e.remoteControlStatus.clients,i=>(d(),r("div",{key:i.clientId,class:"sidebar-settings-remote-client"},[t("span",In,s(i.deviceName||i.clientId),1),t("button",{class:"sidebar-settings-remote-client-revoke",type:"button",disabled:e.isRemoteControlActionInFlight,onClick:k=>e.revokeRemoteClient(i.clientId)},s(e.remoteControlActionName===`revoke:${i.clientId}`?n(o)("Removing…"):n(o)("Revoke")),9,xn)]))),128))])],64))],64)):(d(),r("p",kn,s(n(o)("Remote control is not supported by this Codex version.")),1))])],512),[[E,e.activeSettingsGroup==="integrations"]]),M(t("div",null,[t("div",Pn,[F(ne,{snapshots:e.accountRateLimitSnapshots},null,8,["snapshots"])]),t("div",{class:"sidebar-settings-build-label","aria-label":n(o)("Worktree name and version")}," WT "+s(e.worktreeName)+" · v"+s(e.appVersion),9,Dn)],512),[[E,e.activeSettingsGroup==="usage"]])])])],8,Ee)])])}}}),Un=K(Kn,[["__scopeId","data-v-e1fcd625"]]);export{Un as default};
@@ -1,4 +1,4 @@
1
- import{c as P,r as U,g as po,o as pt,a as Rt,b as _n,d as Ze,e as le,f as c,h as se,i as f,w as Ue,j as m,t as w,n as te,k as S,T as Un,_ as oe,u,F as W,l as K,m as ke,p as Q,I as Nn,q as vo,s as We,v as me,x as $e,y as Je,z as Vn,A as ko,B as Pe,C as yo,D as zn,E as Ot,G as wo,H as bo,J as ct,K as Co,L as $o,M as xo,N as To}from"./index-kOwa0g4Z.js";import{s as St}from"./sanitizeHtml-Bd3No2dT.js";function _o(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const t=e.startsWith("/"),n=/^[A-Za-z]:[\\/]/u.test(e),o=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return t||n||o||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function ft(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function Ne(e){return e.replace(/\\/gu,"/")}function Kn(e){if(!e.startsWith("file://"))return e;let t=e.replace(/^file:\/\//u,"");try{t=decodeURIComponent(t)}catch{}return/^\/[A-Za-z]:\//u.test(t)&&(t=t.slice(1)),t}function Io(e){const t=Ne(e),n=t.match(/^\/Users\/([^/]+)/u);if(n)return`/Users/${n[1]}`;const o=t.match(/^\/home\/([^/]+)/u);return o?`/home/${o[1]}`:""}function je(e){const t=Ne(e);if(!t)return t;let n="",o=t;const s=o.match(/^([A-Za-z]:)(\/.*)?$/u);s?(n=`${s[1]}/`,o=(s[2]??"").replace(/^\/+/u,"")):o.startsWith("/")&&(n="/",o=o.slice(1));const a=o.split("/").filter(Boolean),i=[];for(const l of a)if(l!=="."){if(l===".."){i.length>0&&i.pop();continue}i.push(l)}const r=i.join("/");return n?`${n}${r}`.replace(/\/+$/u,"")||n:r||t}function Gn(e,t){const n=Ne(Kn(e.trim()));if(!n)return"";if(n.startsWith("/")||/^[A-Za-z]:\//u.test(n))return je(n);if(n.startsWith("~/")){const a=Io(t);if(a)return je(`${a}/${n.slice(2)}`)}const s=Ne(t.trim());return je(s?`${s.replace(/\/+$/u,"")}/${n}`:n)}function ht(e){let t=e,n="",o="";const s={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;t.length>0;){const a=t[0],i=Object.prototype.hasOwnProperty.call(s,a)?s[a]:"";if(!i||!t.endsWith(i))break;n+=a,o+=i,t=t.slice(1,-1)}return{core:t,leading:n,trailing:o}}function Xe(e){if(!e)return null;let t=e.trim();t=ht(t).core.trim();let o=null;const s=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(s)t=s[1],o=Number(s[2]);else{const a=t.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(t=a[1],o=Number(a[2]))}return t=Kn(t),_o(t)?{path:t,line:o}:null}function In(e,t,n){let o=0,s=t-1;for(;s>=n&&e[s]==="*";)o+=1,s-=1;return o}function Lo(e,t){let n=0,o=t;for(;o<e.length&&e[o]==="*";)n+=1,o+=1;return n}function Zn(e,t,n,o,s){const a=In(e,t,o);return a<2?null:Lo(e,n)>=a?{segmentStart:t-a,segmentEnd:n+a,tokenEndTrim:0}:In(s,s.length,0)>=a?{segmentStart:t-a,segmentEnd:n,tokenEndTrim:a}:null}function Dt(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith(")"))return null;const n=t.indexOf("]");if(n<=1||t[n+1]!=="(")return null;const o=t.slice(1,n).trim(),s=t.slice(n+2,-1).trim();if(o.includes(`
1
+ import{c as P,r as U,g as po,o as pt,a as Rt,b as _n,d as Ze,e as le,f as c,h as se,i as f,w as Ue,j as m,t as w,n as te,k as S,T as Un,_ as oe,u,F as W,l as K,m as ke,p as Q,I as Nn,q as vo,s as We,v as me,x as $e,y as Je,z as Vn,A as ko,B as Pe,C as yo,D as zn,E as Ot,G as wo,H as bo,J as ct,K as Co,L as $o,M as xo,N as To}from"./index-Cu_hRJGY.js";import{s as St}from"./sanitizeHtml-Bd3No2dT.js";function _o(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const t=e.startsWith("/"),n=/^[A-Za-z]:[\\/]/u.test(e),o=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return t||n||o||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function ft(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function Ne(e){return e.replace(/\\/gu,"/")}function Kn(e){if(!e.startsWith("file://"))return e;let t=e.replace(/^file:\/\//u,"");try{t=decodeURIComponent(t)}catch{}return/^\/[A-Za-z]:\//u.test(t)&&(t=t.slice(1)),t}function Io(e){const t=Ne(e),n=t.match(/^\/Users\/([^/]+)/u);if(n)return`/Users/${n[1]}`;const o=t.match(/^\/home\/([^/]+)/u);return o?`/home/${o[1]}`:""}function je(e){const t=Ne(e);if(!t)return t;let n="",o=t;const s=o.match(/^([A-Za-z]:)(\/.*)?$/u);s?(n=`${s[1]}/`,o=(s[2]??"").replace(/^\/+/u,"")):o.startsWith("/")&&(n="/",o=o.slice(1));const a=o.split("/").filter(Boolean),i=[];for(const l of a)if(l!=="."){if(l===".."){i.length>0&&i.pop();continue}i.push(l)}const r=i.join("/");return n?`${n}${r}`.replace(/\/+$/u,"")||n:r||t}function Gn(e,t){const n=Ne(Kn(e.trim()));if(!n)return"";if(n.startsWith("/")||/^[A-Za-z]:\//u.test(n))return je(n);if(n.startsWith("~/")){const a=Io(t);if(a)return je(`${a}/${n.slice(2)}`)}const s=Ne(t.trim());return je(s?`${s.replace(/\/+$/u,"")}/${n}`:n)}function ht(e){let t=e,n="",o="";const s={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;t.length>0;){const a=t[0],i=Object.prototype.hasOwnProperty.call(s,a)?s[a]:"";if(!i||!t.endsWith(i))break;n+=a,o+=i,t=t.slice(1,-1)}return{core:t,leading:n,trailing:o}}function Xe(e){if(!e)return null;let t=e.trim();t=ht(t).core.trim();let o=null;const s=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(s)t=s[1],o=Number(s[2]);else{const a=t.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(t=a[1],o=Number(a[2]))}return t=Kn(t),_o(t)?{path:t,line:o}:null}function In(e,t,n){let o=0,s=t-1;for(;s>=n&&e[s]==="*";)o+=1,s-=1;return o}function Lo(e,t){let n=0,o=t;for(;o<e.length&&e[o]==="*";)n+=1,o+=1;return n}function Zn(e,t,n,o,s){const a=In(e,t,o);return a<2?null:Lo(e,n)>=a?{segmentStart:t-a,segmentEnd:n+a,tokenEndTrim:0}:In(s,s.length,0)>=a?{segmentStart:t-a,segmentEnd:n,tokenEndTrim:a}:null}function Dt(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith(")"))return null;const n=t.indexOf("]");if(n<=1||t[n+1]!=="(")return null;const o=t.slice(1,n).trim(),s=t.slice(n+2,-1).trim();if(o.includes(`
2
2
  `)||s.includes(`
3
3
  `))return null;const a=ht(o).core.trim()||o,i=ht(s).core.trim();return i?{label:a,target:i}:null}function mt(e){const t=e.trim().match(/^codex:\/\/threads\/([A-Za-z0-9-]+)$/u);if(!t)return null;if(typeof window>"u")return`/#/thread/${t[1]}`;const n=window.location.pathname.replace(/\/?$/u,"/");return`${window.location.origin}${n}#/thread/${t[1]}`}function Jn(e){const t=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(t)}`}function Xn(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}const Yn={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",md:"markdown","c++":"cpp","c#":"csharp",ps1:"powershell"};function ce(e){return`${e.path}\0${e.movedToPath??""}`}function Mo(e,t){return e?!t||e===t?e:`${e}
4
4
  ${t}`.trim():t}function Ao(e,t){const n=e.operation==="add"||t.operation==="add"?"add":e.operation==="delete"||t.operation==="delete"?"delete":"update";return{path:t.path||e.path,operation:n,movedToPath:t.movedToPath??e.movedToPath??null,diff:Mo(e.diff,t.diff),addedLineCount:e.addedLineCount+t.addedLineCount,removedLineCount:e.removedLineCount+t.removedLineCount}}function So(e,t){const n=e.operation==="add"?0:e.operation==="update"?1:2,o=t.operation==="add"?0:t.operation==="update"?1:2;if(n!==o)return n-o;const s=`${e.path}\0${e.movedToPath??""}`,a=`${t.path}\0${t.movedToPath??""}`;return s.localeCompare(a)}function Ft(e){const t=new Map;for(const n of e){const o=`${n.path}\0${n.movedToPath??""}`,s=t.get(o);t.set(o,s?Ao(s,n):{...n})}return Array.from(t.values()).sort(So)}function Kt(e,t){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?t("Moved + edited"):t("Moved"):e.operation==="add"?t("Added"):e.operation==="delete"?t("Deleted"):t("Edited")}function Fo(e){return e.operation==="update"&&e.movedToPath?"→":e.operation==="add"?"+":e.operation==="delete"?"−":"M"}function Ht(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function Be(e){const t=[];return e.addedLineCount>0&&t.push(`+${e.addedLineCount}`),e.removedLineCount>0&&t.push(`-${e.removedLineCount}`),t.join(" ")}function Qn(e,t,n=""){const o=[];return e>0&&o.push({tone:"add",label:`+${e}`}),t>0&&o.push({tone:"remove",label:`-${t}`}),o.length>0?o:n?[{tone:"neutral",label:n}]:[]}function Po(e){return Qn(e.addedLineCount,e.removedLineCount)}function es(e,t){return e===1?`1 ${t("file changed")}`:`${e} ${t("files changed")}`}function Eo(e,t){if(!e||e.changes.length===0)return"";let n=0,o=0,s=0,a=0;for(const r of e.changes){if(r.operation==="add"){n+=1;continue}if(r.operation==="delete"){o+=1;continue}if(r.movedToPath){a+=1;continue}s+=1}const i=[];return s>0&&i.push(`${s} ${t("edited")}`),n>0&&i.push(`${n} ${t("added")}`),o>0&&i.push(`${o} ${t("deleted")}`),a>0&&i.push(`${a} ${t("moved")}`),i.join(", ")}function Bo(e,t){if(!e||e.changes.length===0)return t("Modified files");const n=es(e.changes.length,t),o=Eo(e,t);return o?`${n} · ${o}`:n}function Ro(e){if(!e||e.changes.length===0)return[];const t=e.changes.reduce((s,a)=>s+a.addedLineCount,0),n=e.changes.reduce((s,a)=>s+a.removedLineCount,0),o=e.changes.some(s=>s.movedToPath)?"Moved":"Ready";return Qn(t,n,o)}function Ve(e,t){const n=Gn(e,t),o=je(Ne(t.trim())),s=je(Ne(n));return o&&s.startsWith(`${o}/`)?s.slice(o.length+1):e}function Oo(e,t,n){if(!e||e.changes.length===0)return"";const o=e.changes.map(s=>{const a=Ve(s.path,t),i=s.movedToPath?` -> ${Ve(s.movedToPath,t)}`:"",r=Be(s);return`- ${Kt(s,n)}: ${a}${i}${r?` (${r})`:""}`});return`${n("Modified files")}:
@@ -36,4 +36,4 @@ ${a}`:a}const mi={class:"conversation-item conversation-item-overlay"},gi={class
36
36
  `).trim();I&&o.push({kind:"paragraph",value:I})}return o}function Vl(e){if(!e.includes("![")||!e.includes("]("))return dt(e);const t=[],n=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let o=0;for(const s of e.matchAll(n)){const[a,i,r]=s;if(typeof s.index!="number")continue;const l=s.index,h=l+a.length,g=Ol(r.trim());g&&(l>o&&t.push(...dt(e.slice(o,l))),t.push({kind:"image",url:g,alt:i.trim(),markdown:a}),o=h)}return o<e.length&&t.push(...dt(e.slice(o))),t}function Wn(e){const n=os(e).split(`
37
37
  `),o=[];let s=0,a=0;const i=r=>{if(r<=a)return;const l=n.slice(a,r).join(`
38
38
  `);o.push(...Vl(l))};for(;s<n.length;){const r=gt(n[s]);if(!r){s+=1;continue}i(s),s+=1;const l=[];for(;s<n.length;){if(n[s].trim()===r.marker){s+=1;break}l.push(n[s]),s+=1}o.push({kind:"codeBlock",language:r.language,value:l.join(`
39
- `)}),a=s}return i(n.length),o.length>0?o:[{kind:"paragraph",value:e}]}const zl=300,Kl=1200,Gl=300,Zl=250;function Jl(e){const{getCwd:t,isVideoMediaUrl:n}=e,o=U(null),s=U(0);let a=null;const i=new Map,r=new Map,l=new Map,h=new Map;function g($,M,D,G){for($.has(M)&&$.delete(M),$.set(M,D);$.size>G;){const ae=$.keys().next().value;if(ae===void 0)break;$.delete(ae)}return D}function b(){return o.value?Promise.resolve():(a||(a=wo(()=>import("./common-BeuopZEI.js"),[]).then($=>{o.value=$.default,h.clear(),l.clear(),s.value+=1}).finally(()=>{a=null})),a)}function L(){return!!o.value}function y($){const M=r.get($);return M?(r.delete($),r.set($,M),M):g(r,$,Hl($),Kl)}function I($){const M=$.trim();if(!M)return"#";const D=N=>N.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(N),G=Xe(M),ae=(G==null?void 0:G.path)??M,B=Gn(ae,t());if(D(B)){const N=B.startsWith("/")?B:`/${B}`;return`/codex-local-browse${encodeURI(N)}`}return"#"}function k($){const M=$.trim();if(!M)return"";try{const D=new URL(M,window.location.href);return D.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${D.pathname.slice(19)}`}${D.search}${D.hash}`:""}catch{return""}}function E($){const M=i.get($.id);if(M&&M.text===$.text&&M.cwd===t())return i.delete($.id),i.set($.id,M),M.blocks;const D=Wn($.text);return g(i,$.id,{text:$.text,cwd:t(),blocks:D},zl).blocks}function x($){return $.replace(/&/gu,"&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 A($,M){const D=C($);if(!D)return x(M);const G=o.value;if(!G)return x(M);try{if(G.getLanguage(D))return G.highlight(M,{language:D,ignoreIllegals:!0}).value}catch{}return x(M)}function _($,M){return St(R($,M))}function R($,M){const D=`${s.value}\0${C($)}\0${$}\0${M}`,G=h.get(D);return G!==void 0?(h.delete(D),h.set(D,G),G):g(h,D,A($,M),Zl)}function O($){return y($).map(M=>M.kind==="text"?x(M.value):M.kind==="bold"?`<strong class="message-bold-text">${x(M.value)}</strong>`:M.kind==="italic"?`<em class="message-italic-text">${x(M.value)}</em>`:M.kind==="strikethrough"?`<s class="message-strikethrough-text">${x(M.value)}</s>`:M.kind==="file"?`<a class="message-file-link" href="${x(I(M.path))}" target="_blank" rel="noopener noreferrer" title="${x(M.path)}">${x(M.displayPath)}</a>`:M.kind==="url"?`<a class="message-file-link" href="${x(M.href)}" target="_blank" rel="noopener noreferrer" title="${x(M.href)}">${x(M.value)}</a>`:`<code class="message-inline-code">${x(M.value)}</code>`).join("")}function q($){return $.paragraphs.map(M=>`<div class="message-list-item-text message-list-item-paragraph">${O(M)}</div>`).join("")}function ee($){var G;const M=q($),D=((G=$.children)==null?void 0:G.map(ae=>fe(ae)).join(""))??"";return St(M+D)}function V($){return $?` style="text-align:${$}"`:""}function fe($){if($.kind==="paragraph")return`<p class="message-text">${O($.value)}</p>`;if($.kind==="heading"){const M=Math.min(6,Math.max(1,Math.trunc($.level))),D=Jn(M),G=`message-heading ${Xn(M)}`;return`<${D} class="${G}">${O($.value)}</${D}>`}if($.kind==="blockquote")return`<blockquote class="message-blockquote">${O($.value)}</blockquote>`;if($.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${$.items.map(D=>`<li class="message-list-item"><div class="message-list-item-content">${ee(D)}</div></li>`).join("")}</ul>`;if($.kind==="taskList")return`<ul class="message-list message-task-list">${$.items.map(D=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${D.checked?"true":"false"}">${D.checked?"☑":"☐"}</span><div class="message-list-item-text">${O(D.text)}</div></li>`).join("")}</ul>`;if($.kind==="orderedList"){const M=$.items.map(D=>`<li class="message-list-item"><div class="message-list-item-content">${ee(D)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${$.start}">${M}</ol>`}if($.kind==="table"){const M=$.headers.map((ae,B)=>`<th class="message-table-head-cell"${V($.alignments[B]??null)}>${O(ae)}</th>`).join(""),D=$.rows.map(ae=>'<tr class="message-table-body-row">'+ae.map((B,N)=>`<td class="message-table-cell"${V($.alignments[N]??null)}>${O(B)}</td>`).join("")+"</tr>").join(""),G=D?`<tbody>${D}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${M}</tr></thead>${G}</table></div>`}return $.kind==="codeBlock"?`<div class="message-code-block">${$.language?`<div class="message-code-language">${x($.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${_($.language,$.value)}</code></pre></div>`:$.kind==="thematicBreak"?'<hr class="message-divider">':n($.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${x($.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${x($.url)}" alt="${x($.alt||"Embedded message image")}" loading="lazy">`}function Re($){const M=`${t()}\0${s.value}\0${$}`,D=l.get(M);if(D&&D.text===$&&D.cwd===t()&&D.highlightVersion===s.value)return l.delete(M),l.set(M,D),D.html;const G=Wn($).map(B=>fe(B)).join(""),ae=St(G);return g(l,M,{text:$,cwd:t(),highlightVersion:s.value,html:ae},Gl).html}function ze(){i.clear(),r.clear(),l.clear(),h.clear()}return{highlightCacheVersion:s,hasHighlightLoaded:L,ensureHighlightJsLoaded:b,getInlineSegments:y,toBrowseUrl:I,toEditUrlFromBrowseHref:k,getMessageBlocks:E,renderListItemContentAsHtml:ee,renderCachedHighlightedCodeAsHtml:_,renderMarkdownBlocksAsHtml:Re,clearRenderCaches:ze}}const Xl={key:0,class:"conversation-loading"},Yl={key:1,class:"conversation-empty"},Ql={key:0,class:"conversation-load-more"},ec=["disabled"],tc={key:1,class:"conversation-load-more conversation-warm-collapse"},nc=["disabled"],sc=["id"],oc={class:"message-row","data-role":"system"},ac={class:"message-stack","data-role":"system"},ic={class:"message-row","data-role":"system","data-message-type":"fileChange"},rc={class:"message-stack","data-role":"system"},lc={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},cc={class:"message-row","data-role":"system"},uc={class:"message-stack","data-role":"system"},dc={key:0,class:"work-block-list"},fc=["id","data-role","data-message-type"],hc={key:0,class:"message-row thread-compaction-row","data-role":"system"},mc={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},gc={key:1,class:"message-row thread-compaction-row","data-role":"system"},pc={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},vc={key:2,class:"message-row","data-role":"system"},kc={class:"message-stack","data-role":"system"},yc={class:"work-block-list"},wc=["data-role","data-message-type"],bc=["data-role"],Cc=["data-role"],$c={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},xc={class:"message-stack","data-role":"system"},Tc={class:"thread-plan-record"},_c={class:"thread-plan-record-header"},Ic={key:0,class:"thread-plan-record-explanation"},Lc={key:1,class:"thread-plan-record-steps"},Mc=["data-status"],Ac={class:"thread-plan-record-marker","aria-hidden":"true"},Sc=["data-role","data-message-type"],Fc=["data-role"],Pc=["data-role"],Ec=["data-role"],Bc=["onClick"],Rc=["src"],Oc=["src","alt"],Dc={key:1,class:"message-file-attachments"},Hc=["href","title"],Wc={key:2,class:"message-skill-attachments"},jc=["href","title"],qc={class:"message-skill-chip-prefix"},Uc={class:"message-skill-chip-name"},Nc=["data-role"],Vc={key:0,class:"automation-message-label"},zc={key:0},Kc={key:1,class:"work-summary-wrap","aria-live":"polite"},Gc={class:"work-summary-text"},Zc={key:0,class:"message-text"},Jc={key:2,class:"message-blockquote"},Xc={key:3,class:"message-list message-list-unordered"},Yc=["innerHTML"],Qc={key:4,class:"message-list message-task-list"},eu=["data-checked"],tu={class:"message-list-item-text"},nu=["start"],su=["innerHTML"],ou={key:6,class:"message-table-wrap"},au={class:"message-table"},iu={key:0},ru={key:7,class:"message-code-block"},lu={key:0,class:"message-code-language"},cu={class:"message-code-pre"},uu=["innerHTML"],du={key:8,class:"message-divider"},fu={key:9,class:"message-text"},hu=["onClick"],mu=["src"],gu=["src","alt","onError"],pu=["href","onClick"],vu=["title","aria-label"],ku=["aria-label"],yu=["src"],wu=["src","alt"],bu=16,jn=30,qn=20,Cu=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 Oo(d,a.cwd,X)}function s(d){return Ve(d,a.cwd)}const a=e,i=Jl({getCwd:()=>a.cwd,isVideoMediaUrl:lt}),{highlightCacheVersion:r,hasHighlightLoaded:l,ensureHighlightJsLoaded:h,getInlineSegments:g,toBrowseUrl:b,toEditUrlFromBrowseHref:L,getMessageBlocks:y,renderListItemContentAsHtml:I,renderCachedHighlightedCodeAsHtml:k,renderMarkdownBlocksAsHtml:E,clearRenderCaches:x}=i,C=Go({getMessages:()=>a.messages,getLiveOverlay:()=>a.liveOverlay,isCommandMessage:tt}),{hiddenGroupedCommandIds:A,isCommandExpanded:_,isCommandCompact:R,isCommandOutputCondensed:O,toggleCommandExpand:q,getWorkBlockCommands:ee,pruneCommandIdSets:V}=C,fe=Jo({toEditUrlFromBrowseHref:L}),{isFileLinkContextMenuVisible:Re,fileLinkContextMenuX:ze,fileLinkContextMenuY:$,fileLinkContextBrowseUrl:M,fileLinkContextEditUrl:D,handleConversationContextMenu:G,closeFileLinkContextMenu:ae}=fe,{isMobile:B}=bo(),N=zo({getMessages:()=>a.messages,getLiveTurnId:()=>a.liveTurnId??"",isFileChangeMessage:Qt,isCopyableAssistantMessage:en,isReasoningMessage:yt,isPlanMessage:kt,isFoldMember:pn,getHiddenGroupedCommandIds:()=>A.value,isMobile:()=>B.value}),{anchoredFileChangeSummaryByAnchorId:ue,hiddenFileChangeMessageIds:ye,isDiffViewerFileListOpen:ie,diffViewerChanges:re,activeDiffViewerChange:ge,activeDiffViewerLines:j,toggleFileChangeSummary:pe,isFileChangeSummaryExpanded:_e,openDiffViewer:et,closeDiffViewer:Ie,toggleDiffViewerFileList:ls,closeDiffViewerFileList:cs,selectDiffViewerChange:us,readAnchoredFileChangeSummaryById:ve,isFileChangeSummaryExpandedById:ds,toggleFileChangeSummaryById:fs,readStandaloneFileChangeSummary:we,isFileChangeSummaryVisible:Gt,pruneFileChangeSummaryIds:hs}=N,ms=Ko({getMessages:()=>a.messages,isCopyableAssistantMessage:en,isPlanMessage:kt,planStepCopyMarker:vn,buildFileChangeCopyText:o,getAnchoredFileChangeSummaries:()=>ue.value}),{copiedResponseAnchorId:gs,forkableTurnIndexByAnchorId:ps,showCopyResponseButton:vs,isCopyableUserMessage:ks,copyUserMessage:ys,showForkResponseButton:ws,copyResponse:bs}=ms,{buildFeedbackMailto:Cs,feedbackMailtoBase:$s,recordVisibleFailure:xs}=Vn(),{t:X}=me(),Zt=$s();function Ts(d,p){xs(p);const F=d.currentTarget;F instanceof HTMLAnchorElement&&(F.href=Cs())}function tt(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function _s(d){return d.messageType==="compaction.pending"}function Is(d){return d.messageType==="compaction.done"}function kt(d){return d.messageType==="plan"||d.messageType==="plan.live"}function yt(d){return d.messageType==="reasoning"&&!!d.reasoning}const wt=U(new Set);function Jt(d){return wt.value.has(d.id)}function Xt(d){const p=new Set(wt.value);p.has(d.id)?p.delete(d.id):p.add(d.id),wt.value=p}function Yt(d){return d.messageType==="toolCall"&&!!d.toolCall}function Ls(d){return d.messageType==="turnError"}function Qt(d){return d.messageType==="fileChange"&&d.fileChangeStatus==="completed"&&Array.isArray(d.fileChanges)&&d.fileChanges.length>0}function en(d){return d.role==="assistant"&&!tt(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const bt=n,Le=U(null),tn=U(null),Ms=Xo({isVideo:lt}),{modalImageUrl:nt,modalIsVideo:As,markdownImageFailureVersion:Ss,isMarkdownImageFailed:Fs,onMarkdownImageError:Ps,openImageModal:nn,closeImageModal:st}=Ms,Es=Zo({getActiveThreadId:()=>a.activeThreadId,getCwd:()=>a.cwd,onFileChangesChanged:()=>bt("fileChangesChanged",a.activeThreadId),updateThreadFileChanges:To,t:X}),{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"?X("Rollback this turn?"):d.action==="undo"?X("Undo file changes?"):X("Redo file changes?"):""}),Ds=P(()=>{const d=Ce.value;return d?d.kind==="edit-message"?X("This rolls the thread back to this turn so you can edit the message. Later replies will be removed."):d.filePathLabel?d.action==="undo"?X("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:d.filePathLabel}):X("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:d.filePathLabel}):d.action==="undo"?X("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):X("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),Me=U(!0);let Ee=0,be=0,ot=0,Ke=null;const un=new WeakSet,Ae=U(qt(a.activeThreadId)),dn=P(()=>vt(Ae.value,a.activeThreadId)),Se=U(!1),Ct=P(()=>a.messages.filter(d=>!kt(d))),Oe=P(()=>Pl(Ct.value)),$t=P(()=>El({turnCount:Oe.value.length,hotTurns:jn,pageSize:qn,coldPage:dn.value.coldPage})),xt=P(()=>$t.value.warmStartTurn),De=P(()=>$t.value.warmEndTurn),fn=P(()=>$t.value.coldTurnCount),hn=P(()=>fn.value>0),Tt=P(()=>dn.value.expandedWarmTurns),Hs=P(()=>{const d=Ct.value,p=Oe.value,F=[],H=Tt.value;for(let ne=xt.value;ne<De.value;ne+=1){const de=p[ne];if(!de)continue;const T={turn:ne,userText:ns(de.userItem.text),assistantPreview:de.assistantPreview,toolCount:de.toolCount,expanded:H.has(ne)},z=H.has(ne)?d.slice(de.startIdx,de.endIdx).map(J=>({message:J})):[];F.push({key:`warm-${ne}`,warm:T,warmItems:z,processItems:[],fileChangeAnchorIds:[]})}const Y=En(d,p,De.value),v=Y[0];if(!v)return F;const he=a.messages.findIndex(ne=>ne.id===v.id),Fe=he>=0?a.messages.slice(he):Y;for(const ne of Il(Fe,{liveOverlayActive:a.liveOverlay!==null,liveTurnId:a.liveTurnId})){const de=ne.items.find(Z=>Z.kind==="user"),T=ne.items.find(Z=>Z.kind==="final-assistant"),z=ne.items.filter(Z=>Z!==de&&Z!==T&&Z.message.messageType!=="worked").map(Z=>({message:Z.message,presentation:Z.kind==="plan"?"plan":"process"})),J=ne.items.map(Z=>Z.message.id).filter(Z=>!!ve(Z));F.push({key:ne.key,warmItems:[],request:de?{message:de.message}:void 0,processItems:z,fileChangeAnchorIds:J,finalItem:T?{message:T.message,presentation:"final-assistant"}:void 0})}return F}),Ws=P(()=>Rl(a.messages));function js(d){var F,H;const p=((F=d.request)==null?void 0:F.message.turnId)??((H=d.finalItem)==null?void 0:H.message.turnId);return p?Ws.value[p]:void 0}function mn(){Ae.value=Ml(Ae.value,a.activeThreadId)}function qs(d){Ae.value=Pn(Ae.value,a.activeThreadId,d,!Tt.value.has(d))}const gn=P(()=>Oe.value.map((d,p)=>({turn:p,text:Ll(d.userItem.text)}))),Us=P(()=>Math.max(0,gn.value.length-1)),Ns=P(()=>{const d=new Map;return Oe.value.forEach((p,F)=>{d.set(p.userItem.id,F)}),d});function _t(d){return`question-anchor-${d}`}function Vs(d){const p=Ns.value.get(d.id);if(p!==void 0&&!(p<De.value))return _t(p)}function zs(d){if(d<De.value){let p=Ae.value;if(d<xt.value){const F=Bl({turn:d,turnCount:Oe.value.length,hotTurns:jn,pageSize:qn});p=Al(p,a.activeThreadId,F)}p=Pn(p,a.activeThreadId,d,!0),Ae.value=p}Me.value=!1,ct().then(()=>{const p=Le.value,F=document.getElementById(_t(d));if(!p||!F)return;const H=F.getBoundingClientRect(),Y=p.getBoundingClientRect(),v=p.scrollTop+H.top-Y.top-12;p.scrollTo({top:Math.max(0,v),behavior:"smooth"})})}const Ks=P(()=>{const d=Ct.value,p=Oe.value,F=[];for(let he=xt.value;he<De.value;he+=1){if(!Tt.value.has(he))continue;const Fe=p[he];Fe&&F.push(...d.slice(Fe.startIdx,Fe.endIdx))}const H=En(d,p,De.value),Y=H[0];if(!Y)return F;const v=a.messages.findIndex(he=>he.id===Y.id);return F.push(...v>=0?a.messages.slice(v):H),F}),It=P(()=>$l(Ks.value)),Ge=P(()=>{var p;const d=new Map;for(const F of It.value){const H=((p=F.messages[0])==null?void 0:p.id)??"";H&&d.set(H,F)}return d}),Gs=P(()=>{const d=new Set;for(const p of It.value)for(const F of p.messages)d.add(F.id);return d}),Zs=P(()=>{const d=new Set;for(const p of It.value)d.add(p.turnId);return d});function Js(d){return Ge.value.has(d.id)}function pn(d){return Gs.value.has(d.id)}function Xs(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.messages)??[]}function Ys(d){return $r(Xs(d))}function Qs(d){var p;return d.type==="batch"?`tool-batch-${d.kind}-${((p=d.messages[0])==null?void 0:p.id)??""}`:d.message.id}function eo(d){const p=Ge.value.get(d.id);return p?xl(p,{t:X,formatDuration:Ot}):""}function to(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.running)??!1}function no(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.hasOutsideContent)??!0}function so(d){return d.messageType==="worked"}const oo=P(()=>a.hasMorePersistedAbove===!0),ao=P(()=>!Me.value&&(a.messages.length>0||a.pendingRequests.length>0||!!a.liveOverlay));function vn(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function io(d){const p=ps.value[d];typeof p=="number"&&a.activeThreadId&&bt("forkThread",{threadId:a.activeThreadId,turnIndex:p})}const Lt=P(()=>{const d={};for(const p of a.messages){if(p.role!=="user"||typeof p.turnIndex!="number")continue;const F=typeof p.turnId=="string"&&p.turnId.length>0?p.turnId:"";!F||p.text.trim().length===0||(d[p.id]=F)}return d});function ro(d){return typeof Lt.value[d.id]=="string"}function lo(d){Lt.value[d]&&(Ce.value={kind:"edit-message",messageId:d})}function kn(d,p){sn(d)&&(Ce.value={kind:"file-change",summary:d,action:p})}function yn(d,p){!d||!sn(d)||!p.path||(Ce.value={kind:"file-change",summary:d,action:"undo",filePaths:[p.path],filePathLabel:s(p.path)})}function co(){const d=Ce.value;if(Ce.value=null,!!d){if(d.kind==="edit-message"){const p=Lt.value[d.messageId];p&&bt("rollback",{turnId:p});return}Bs(d.summary,d.action,d.filePaths)}}function uo(){const d=Le.value,p=tn.value;!d||!p||(d.scrollTop=d.scrollHeight,p.scrollIntoView({block:"end"}))}function fo(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=bu}function ho(){if(Le.value&&Me.value){at();return}}function at(){Le.value&&uo()}function Mt(){return Me.value}function wn(){if(!Mt()){ot=0,be=0;return}if(at(),ot-=1,ot<=0){be=0;return}be=requestAnimationFrame(wn)}function it(d=6){Mt()&&(be&&(cancelAnimationFrame(be),be=0),ot=Math.max(d,1),be=requestAnimationFrame(wn))}function bn(){it(3)}function Cn(){Me.value=!0,at(),it(4)}async function $n(){var Y;const d=Le.value;if(!d||!a.hasMorePersistedAbove||Se.value||a.isLoadingPersistedAbove===!0)return;Se.value=!0;const p=a.activeThreadId,F=d.scrollHeight,H=d.scrollTop;try{await((Y=a.loadEarlierMessages)==null?void 0:Y.call(a,p)),await ct(),a.activeThreadId===p&&(d.scrollTop=H+(d.scrollHeight-F))}finally{Se.value=!1}}t({jumpToLatest:Cn});function mo(){if(!Mt())return;const d=Le.value;if(!d)return;const p=d.querySelectorAll("img.message-image-preview");for(const F of p)F.complete||un.has(F)||(un.add(F),F.addEventListener("load",bn,{once:!0}),F.addEventListener("error",bn,{once:!0}))}async function rt(){return Ke||(Ke=ct().then(()=>new Promise(d=>{Ee&&cancelAnimationFrame(Ee),Ee=requestAnimationFrame(()=>{Ee=0,Ke=null,ho(),mo(),it(),d()})})),Ke)}$e(()=>a.messages,async d=>{if(a.isLoading)return;const p=new Set(d.filter(F=>F.messageType==="commandExecution"&&F.commandExecution).map(F=>F.id));V(p),hs(),await rt()}),$e(()=>a.messages.some(d=>d.text.includes("```")),d=>{!d||l()||h()},{immediate:!0}),$e(()=>a.pendingRequests,async()=>{a.isLoading||await rt()},{deep:!0}),$e(()=>a.liveOverlay,async d=>{d&&Me.value&&(await ct(),at(),it(8))},{deep:!0}),$e(()=>a.isLoading,async d=>{d||await rt()}),$e(()=>a.activeThreadId,async()=>{Me.value=!0,nt.value="",Se.value=!1,Rs(),Ae.value=qt(a.activeThreadId),await rt()},{flush:"post"});function go(){const d=Le.value;!d||a.isLoading||(Me.value=fo(d),d.scrollTop<Cu&&!Se.value&&(hn.value?mn():a.hasMorePersistedAbove===!0&&$n()))}const At=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function lt(d){const p=d.trim();if(!p)return!1;if(p.startsWith("data:video/"))return!0;try{const F=new URL(p,window.location.href);return At.test(F.pathname)?!0:F.pathname==="/codex-local-image"?At.test(F.searchParams.get("path")??""):!1}catch{return At.test(p)}}return pt(()=>{x(),Ee&&(cancelAnimationFrame(Ee),Ee=0),be&&(cancelAnimationFrame(be),be=0)}),(d,p)=>(c(),f(W,null,[m("section",{class:"conversation-root",onContextmenuCapture:p[4]||(p[4]=(...F)=>u(G)&&u(G)(...F))},[e.isLoading?(c(),f("p",Xl,w(u(X)("Loading messages...")),1)):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(c(),f("p",Yl,w(u(X)("No messages in this thread yet.")),1)):(c(),f("ul",{key:2,ref_key:"conversationListRef",ref:Le,class:"conversation-list",onScroll:go},[oo.value?(c(),f("li",Ql,[m("button",{type:"button",class:"load-more-button",disabled:Se.value||e.isLoadingPersistedAbove,onClick:$n},w(Se.value||e.isLoadingPersistedAbove?u(X)("Loading…"):u(X)("Load earlier messages")),9,ec)])):S("",!0),hn.value?(c(),f("li",tc,[m("button",{type:"button",class:"load-more-button",disabled:Se.value,onClick:mn},w(u(X)("Load earlier ({n} turns)",{n:fn.value})),9,nc)])):S("",!0),(c(!0),f(W,null,K(Hs.value,F=>(c(),se(tl,{key:F.key,"turn-key":F.key,warm:F.warm,"warm-items":F.warmItems,request:F.request,"process-items":F.processItems,"final-item":F.finalItem,"file-change-anchor-ids":F.fileChangeAnchorIds,"duration-ms":js(F)},{"warm-card":We(({warm:H})=>[m("li",{id:_t(H.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn"},[m("div",oc,[m("div",ac,[Q(ll,{"user-text":H.userText,"assistant-preview":H.assistantPreview,"tool-count":H.toolCount,expanded:H.expanded,onToggle:Y=>qs(H.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],8,sc)]),"file-change":We(({anchorMessageId:H})=>[m("div",ic,[m("div",rc,[u(Gt)(u(ve)(H))?(c(),se(Ln,{key:0,summary:u(ve)(H),expanded:u(ds)(H),cwd:a.cwd,actionable:u(on)(u(ve)(H)),"action-status":u(an)(u(ve)(H)),"action-error-text":u(rn)(u(ve)(H)),"next-action":u(ln)(u(ve)(H)),"action-label":u(cn)(u(ve)(H)),onToggle:Y=>u(fs)(H),onOpenDiff:Y=>u(et)(u(ve)(H),Y),onRequestAction:Y=>kn(u(ve)(H),Y),onRequestFileAction:Y=>yn(u(ve)(H),Y)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):S("",!0)])])]),default:We(({item:H,section:Y})=>[(c(!0),f(W,null,K([H.message],v=>{var he,Fe,ne,de;return c(),f(W,{key:v.id},[Js(v)?(c(),f("li",lc,[m("div",cc,[m("div",uc,[Q(sr,{label:eo(v),running:to(v),"has-outside-content":no(v)},{default:We(()=>[(c(!0),f(W,null,K(Ys(v),T=>(c(),f(W,{key:Qs(T)},[T.type==="batch"?(c(),se(jr,{key:0,kind:T.kind,messages:T.messages},null,8,["kind","messages"])):(c(!0),f(W,{key:1},K([T.message],z=>(c(),f(W,{key:z.id},[!u(A).has(z.id)&&!u(ye).has(z.id)?(c(),f(W,{key:0},[tt(z)?(c(),f("div",dc,[(c(!0),f(W,null,K(u(ee)(z),(J,Z)=>(c(),se(Sn,{key:`work-cmd-${J.id}`,command:J,"step-index":Z,expanded:u(_)(J),compact:u(R)(J),"output-condensed":u(O)(J),onToggle:xn=>u(q)(J)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):Yt(z)?(c(),se(jt,{key:1,message:z},null,8,["message"])):yt(z)?(c(),se(An,{key:2,message:z,expanded:Jt(z),"content-html":u(E)(z.text),onToggle:J=>Xt(z)},null,8,["message","expanded","content-html","onToggle"])):S("",!0)],64)):S("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!pn(v)&&!u(A).has(v.id)&&!u(ye).has(v.id)&&!(so(v)&&Zs.value.has(v.turnId??""))?(c(),f("li",{key:1,id:Vs(v),class:te(["conversation-item",{"conversation-item-request":Y==="request","conversation-item-process":Y==="process"||H.presentation==="process","conversation-item-final":Y==="final"||H.presentation==="final-assistant","conversation-item-plan":H.presentation==="plan"}]),"data-role":v.role,"data-message-type":v.messageType||""},[_s(v)?(c(),f("div",hc,[m("div",mc,[p[6]||(p[6]=m("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),m("span",null,w(u(X)("Compacting thread context…")),1)])])):Is(v)?(c(),f("div",gc,[m("div",pc,w(u(X)("Context compacted")),1)])):tt(v)?(c(),f("div",vc,[m("div",kc,[m("div",yc,[(c(!0),f(W,null,K(u(ee)(v),(T,z)=>(c(),se(Sn,{key:`work-cmd-${T.id}`,command:T,"step-index":z,expanded:u(_)(T),compact:u(R)(T),"output-condensed":u(O)(T),onToggle:J=>u(q)(T)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):Yt(v)?(c(),se(jt,{key:3,message:v},null,8,["message"])):Qt(v)?(c(),f("div",{key:4,class:"message-row","data-role":v.role,"data-message-type":v.messageType||""},[m("div",{class:"message-stack","data-role":v.role},[m("article",{class:"message-body","data-role":v.role},[u(Gt)(u(we)(v))?(c(),se(Ln,{key:0,summary:u(we)(v),expanded:u(_e)(v),cwd:a.cwd,actionable:u(on)(u(we)(v)),"action-status":u(an)(u(we)(v)),"action-error-text":u(rn)(u(we)(v)),"next-action":u(ln)(u(we)(v)),"action-label":u(cn)(u(we)(v)),onToggle:T=>u(pe)(v),onOpenDiff:T=>u(et)(u(we)(v),T),onRequestAction:T=>kn(u(we)(v),T),onRequestFileAction:T=>yn(u(we)(v),T)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):S("",!0)],8,Cc)],8,bc)],8,wc)):H.presentation==="plan"?(c(),f("div",$c,[m("div",xc,[m("article",Tc,[m("div",_c,w(u(X)("Plan")),1),(he=u(Ze)(v))!=null&&he.explanation?(c(),f("p",Ic,w((Fe=u(Ze)(v))==null?void 0:Fe.explanation),1)):S("",!0),(ne=u(Ze)(v))!=null&&ne.steps.length?(c(),f("ol",Lc,[(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",Ac,w(vn(T.status)),1),m("span",null,w(T.step),1)],8,Mc))),128))])):S("",!0)])])])):(c(),f("div",{key:6,class:te(["message-row",{"message-row-final":H.presentation==="final-assistant"}]),"data-role":v.role,"data-message-type":v.messageType||""},[m("div",{class:"message-stack","data-role":v.role},[m("article",{class:"message-body","data-role":v.role},[v.images&&v.images.length>0?(c(),f("ul",{key:0,class:te(["message-image-list",{"message-generated-image-list":v.messageType==="imageView"}]),"data-role":v.role},[(c(!0),f(W,null,K(v.images,T=>(c(),f("li",{key:T,class:"message-image-item"},[m("button",{class:"message-image-button",type:"button",onClick:z=>u(nn)(T)},[lt(T)?(c(),f("video",{key:0,class:te(["message-image-preview message-video-preview",{"message-generated-image-preview":v.messageType==="imageView"}]),src:T,controls:"",preload:"metadata"},null,10,Rc)):(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,Oc))],8,Bc)]))),128))],10,Ec)):S("",!0),v.fileAttachments&&v.fileAttachments.length>0?(c(),f("div",Dc,[(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,Hc)]))),128))])):S("",!0),v.skills&&v.skills.length>0?(c(),f("div",Wc,[(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",qc,w(u(X)("Skill")),1),m("span",Uc,w(T.name),1)],8,jc))),128))])):S("",!0),v.text.length>0?(c(),f("article",{key:3,class:"message-card","data-role":v.role},[v.isAutomationRun?(c(),f("div",Vc,[p[8]||(p[8]=m("span",null,"Sent via automation",-1)),v.automationDisplayName?(c(),f("code",zc,w(v.automationDisplayName),1)):S("",!0)])):S("",!0),v.messageType==="worked"?(c(),f("div",Kc,[m("p",Gc,w(v.text),1)])):yt(v)?(c(),se(An,{key:2,message:v,expanded:Jt(v),"content-html":u(E)(v.text),onToggle:T=>Xt(v)},null,8,["message","expanded","content-html","onToggle"])):Co([v.id,v.text,a.cwd,u(r),u(Ss)],()=>(c(),f("div",{key:3,class:"message-text-flow"},[(c(!0),f(W,null,K(u(y)(v),(T,z)=>(c(),f(W,{key:`block-${z}`},[T.kind==="paragraph"?(c(),f("p",Zc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="heading"?(c(),se($o(u(Jn)(T.level)),{key:1,class:te(["message-heading",u(Xn)(T.level)])},{default:We(()=>[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])]),_:2},1032,["class"])):T.kind==="blockquote"?(c(),f("blockquote",Jc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="unorderedList"?(c(),f("ul",Xc,[(c(!0),f(W,null,K(T.items,(J,Z)=>(c(),f("li",{key:`ul-${z}-${Z}`,class:"message-list-item"},[m("div",{class:"message-list-item-content",innerHTML:u(I)(J)},null,8,Yc)]))),128))])):T.kind==="taskList"?(c(),f("ul",Qc,[(c(!0),f(W,null,K(T.items,(J,Z)=>(c(),f("li",{key:`task-${z}-${Z}`,class:"message-task-item"},[m("span",{class:"message-task-checkbox","data-checked":J.checked},w(J.checked?"☑":"☐"),9,eu),m("div",tu,[Q(He,{segments:u(g)(J.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,(J,Z)=>(c(),f("li",{key:`ol-${z}-${Z}`,class:"message-list-item"},[m("div",{class:"message-list-item-content",innerHTML:u(I)(J)},null,8,su)]))),128))],8,nu)):T.kind==="table"?(c(),f("div",ou,[m("table",au,[m("thead",null,[m("tr",null,[(c(!0),f(W,null,K(T.headers,(J,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)(J),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])],4))),128))])]),T.rows.length>0?(c(),f("tbody",iu,[(c(!0),f(W,null,K(T.rows,(J,Z)=>(c(),f("tr",{key:`tr-${z}-${Z}`,class:"message-table-body-row"},[(c(!0),f(W,null,K(J,(xn,Tn)=>(c(),f("td",{key:`td-${z}-${Z}-${Tn}`,class:"message-table-cell",style:Je({textAlign:T.alignments[Tn]??"left"})},[Q(He,{segments:u(g)(xn),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])],4))),128))]))),128))])):S("",!0)])])):T.kind==="codeBlock"?(c(),f("div",ru,[T.language?(c(),f("div",lu,w(T.language),1)):S("",!0),m("pre",cu,[m("code",{class:"hljs",innerHTML:u(k)(T.language,T.value)},null,8,uu)])])):T.kind==="thematicBreak"?(c(),f("hr",du)):u(Fs)(v.id,z)?(c(),f("p",fu,w(T.markdown),1)):(c(),f("button",{key:10,class:"message-image-button",type:"button",onClick:J=>u(nn)(T.url)},[lt(T.url)?(c(),f("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:T.url,controls:"",preload:"metadata"},null,8,mu)):(c(),f("img",{key:1,class:"message-image-preview message-markdown-image",src:T.url,alt:T.alt||"Embedded message image",loading:"lazy",onError:J=>u(Ps)(v.id,z)},null,40,gu))],8,hu))],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(X)("Send feedback")),9,pu)):S("",!0)],8,Nc)):S("",!0),Y!=="process"?(c(),se(Zi,{key:4,role:v.role,"show-edit":ro(v),"show-fork":u(ws)(v),"show-copy":u(vs)(v)||u(ks)(v),copied:u(gs)===v.id,onEdit:T=>lo(v.id),onFork:T=>io(v.id),onCopy:T=>v.role==="user"?u(ys)(v.id):u(bs)(v.id)},null,8,["role","show-edit","show-fork","show-copy","copied","onEdit","onFork","onCopy"])):S("",!0)],8,Pc)],8,Fc)],10,Sc))],10,fc)):S("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids","duration-ms"]))),128)),e.liveOverlay?(c(),se(Li,{key:2,overlay:e.liveOverlay,"feedback-mailto":u(Zt)},null,8,["overlay","feedback-mailto"])):S("",!0),m("li",{ref_key:"bottomAnchorRef",ref:tn,class:"conversation-bottom-anchor"},null,512)],544)),Q(cr,{anchors:gn.value,"active-turn":Us.value,onJump:zs},null,8,["anchors","active-turn"]),ao.value?(c(),f("button",{key:3,type:"button",class:"jump-to-latest-button",title:u(X)("Jump to latest"),"aria-label":u(X)("Jump to latest output"),onClick:Cn},[Q(xo,{class:"icon-svg jump-to-latest-icon"})],8,vu)):S("",!0),u(nt).length>0?(c(),f("div",{key:4,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(X)("Close image preview"),onClick:p[1]||(p[1]=(...F)=>u(st)&&u(st)(...F))},[Q(Nn,{class:"icon-svg"})],8,ku),u(As)?(c(),f("video",{key:0,class:"image-modal-image",src:u(nt),controls:"",autoplay:""},null,8,yu)):(c(),f("img",{key:1,class:"image-modal-image",src:u(nt),alt:u(X)("Expanded message image")},null,8,wu))])])):S("",!0),Q(ui,{visible:u(Re),x:u(ze),y:u($),"browse-url":u(M),"edit-url":u(D),onClose:u(ae)},null,8,["visible","x","y","browse-url","edit-url","onClose"]),Q(qa,{change:u(ge),changes:u(re),lines:u(j),"is-mobile":u(B),"is-file-list-open":u(ie),cwd:a.cwd,onClose:u(Ie),onSelectChange:u(us),onToggleFileList:u(ls),onCloseFileList:u(cs)},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd","onClose","onSelectChange","onToggleFileList","onCloseFileList"])],32),Q(sa,{visible:Ce.value!==null,title:Os.value,message:Ds.value,"confirm-label":"Confirm",danger:"",onConfirm:co,onCancel:p[5]||(p[5]=F=>Ce.value=null)},null,8,["visible","title","message"])],64))}}),_u=oe($u,[["__scopeId","data-v-74074931"]]);export{_u as default};
39
+ `)}),a=s}return i(n.length),o.length>0?o:[{kind:"paragraph",value:e}]}const zl=300,Kl=1200,Gl=300,Zl=250;function Jl(e){const{getCwd:t,isVideoMediaUrl:n}=e,o=U(null),s=U(0);let a=null;const i=new Map,r=new Map,l=new Map,h=new Map;function g($,M,D,G){for($.has(M)&&$.delete(M),$.set(M,D);$.size>G;){const ae=$.keys().next().value;if(ae===void 0)break;$.delete(ae)}return D}function b(){return o.value?Promise.resolve():(a||(a=wo(()=>import("./common-BeuopZEI.js"),[]).then($=>{o.value=$.default,h.clear(),l.clear(),s.value+=1}).finally(()=>{a=null})),a)}function L(){return!!o.value}function y($){const M=r.get($);return M?(r.delete($),r.set($,M),M):g(r,$,Hl($),Kl)}function I($){const M=$.trim();if(!M)return"#";const D=N=>N.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(N),G=Xe(M),ae=(G==null?void 0:G.path)??M,B=Gn(ae,t());if(D(B)){const N=B.startsWith("/")?B:`/${B}`;return`/codex-local-browse${encodeURI(N)}`}return"#"}function k($){const M=$.trim();if(!M)return"";try{const D=new URL(M,window.location.href);return D.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${D.pathname.slice(19)}`}${D.search}${D.hash}`:""}catch{return""}}function E($){const M=i.get($.id);if(M&&M.text===$.text&&M.cwd===t())return i.delete($.id),i.set($.id,M),M.blocks;const D=Wn($.text);return g(i,$.id,{text:$.text,cwd:t(),blocks:D},zl).blocks}function x($){return $.replace(/&/gu,"&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 A($,M){const D=C($);if(!D)return x(M);const G=o.value;if(!G)return x(M);try{if(G.getLanguage(D))return G.highlight(M,{language:D,ignoreIllegals:!0}).value}catch{}return x(M)}function _($,M){return St(R($,M))}function R($,M){const D=`${s.value}\0${C($)}\0${$}\0${M}`,G=h.get(D);return G!==void 0?(h.delete(D),h.set(D,G),G):g(h,D,A($,M),Zl)}function O($){return y($).map(M=>M.kind==="text"?x(M.value):M.kind==="bold"?`<strong class="message-bold-text">${x(M.value)}</strong>`:M.kind==="italic"?`<em class="message-italic-text">${x(M.value)}</em>`:M.kind==="strikethrough"?`<s class="message-strikethrough-text">${x(M.value)}</s>`:M.kind==="file"?`<a class="message-file-link" href="${x(I(M.path))}" target="_blank" rel="noopener noreferrer" title="${x(M.path)}">${x(M.displayPath)}</a>`:M.kind==="url"?`<a class="message-file-link" href="${x(M.href)}" target="_blank" rel="noopener noreferrer" title="${x(M.href)}">${x(M.value)}</a>`:`<code class="message-inline-code">${x(M.value)}</code>`).join("")}function q($){return $.paragraphs.map(M=>`<div class="message-list-item-text message-list-item-paragraph">${O(M)}</div>`).join("")}function ee($){var G;const M=q($),D=((G=$.children)==null?void 0:G.map(ae=>fe(ae)).join(""))??"";return St(M+D)}function V($){return $?` style="text-align:${$}"`:""}function fe($){if($.kind==="paragraph")return`<p class="message-text">${O($.value)}</p>`;if($.kind==="heading"){const M=Math.min(6,Math.max(1,Math.trunc($.level))),D=Jn(M),G=`message-heading ${Xn(M)}`;return`<${D} class="${G}">${O($.value)}</${D}>`}if($.kind==="blockquote")return`<blockquote class="message-blockquote">${O($.value)}</blockquote>`;if($.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${$.items.map(D=>`<li class="message-list-item"><div class="message-list-item-content">${ee(D)}</div></li>`).join("")}</ul>`;if($.kind==="taskList")return`<ul class="message-list message-task-list">${$.items.map(D=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${D.checked?"true":"false"}">${D.checked?"☑":"☐"}</span><div class="message-list-item-text">${O(D.text)}</div></li>`).join("")}</ul>`;if($.kind==="orderedList"){const M=$.items.map(D=>`<li class="message-list-item"><div class="message-list-item-content">${ee(D)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${$.start}">${M}</ol>`}if($.kind==="table"){const M=$.headers.map((ae,B)=>`<th class="message-table-head-cell"${V($.alignments[B]??null)}>${O(ae)}</th>`).join(""),D=$.rows.map(ae=>'<tr class="message-table-body-row">'+ae.map((B,N)=>`<td class="message-table-cell"${V($.alignments[N]??null)}>${O(B)}</td>`).join("")+"</tr>").join(""),G=D?`<tbody>${D}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${M}</tr></thead>${G}</table></div>`}return $.kind==="codeBlock"?`<div class="message-code-block">${$.language?`<div class="message-code-language">${x($.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${_($.language,$.value)}</code></pre></div>`:$.kind==="thematicBreak"?'<hr class="message-divider">':n($.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${x($.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${x($.url)}" alt="${x($.alt||"Embedded message image")}" loading="lazy">`}function Re($){const M=`${t()}\0${s.value}\0${$}`,D=l.get(M);if(D&&D.text===$&&D.cwd===t()&&D.highlightVersion===s.value)return l.delete(M),l.set(M,D),D.html;const G=Wn($).map(B=>fe(B)).join(""),ae=St(G);return g(l,M,{text:$,cwd:t(),highlightVersion:s.value,html:ae},Gl).html}function ze(){i.clear(),r.clear(),l.clear(),h.clear()}return{highlightCacheVersion:s,hasHighlightLoaded:L,ensureHighlightJsLoaded:b,getInlineSegments:y,toBrowseUrl:I,toEditUrlFromBrowseHref:k,getMessageBlocks:E,renderListItemContentAsHtml:ee,renderCachedHighlightedCodeAsHtml:_,renderMarkdownBlocksAsHtml:Re,clearRenderCaches:ze}}const Xl={key:0,class:"conversation-switching-bar",role:"status"},Yl={key:1,class:"conversation-loading"},Ql={key:2,class:"conversation-empty"},ec={key:0,class:"conversation-load-more"},tc=["disabled"],nc={key:1,class:"conversation-load-more conversation-warm-collapse"},sc=["disabled"],oc=["id"],ac={class:"message-row","data-role":"system"},ic={class:"message-stack","data-role":"system"},rc={class:"message-row","data-role":"system","data-message-type":"fileChange"},lc={class:"message-stack","data-role":"system"},cc={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},uc={class:"message-row","data-role":"system"},dc={class:"message-stack","data-role":"system"},fc={key:0,class:"work-block-list"},hc=["id","data-role","data-message-type"],mc={key:0,class:"message-row thread-compaction-row","data-role":"system"},gc={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},pc={key:1,class:"message-row thread-compaction-row","data-role":"system"},vc={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},kc={key:2,class:"message-row","data-role":"system"},yc={class:"message-stack","data-role":"system"},wc={class:"work-block-list"},bc=["data-role","data-message-type"],Cc=["data-role"],$c=["data-role"],xc={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},Tc={class:"message-stack","data-role":"system"},_c={class:"thread-plan-record"},Ic={class:"thread-plan-record-header"},Lc={key:0,class:"thread-plan-record-explanation"},Mc={key:1,class:"thread-plan-record-steps"},Ac=["data-status"],Sc={class:"thread-plan-record-marker","aria-hidden":"true"},Fc=["data-role","data-message-type"],Pc=["data-role"],Ec=["data-role"],Bc=["data-role"],Rc=["onClick"],Oc=["src"],Dc=["src","alt"],Hc={key:1,class:"message-file-attachments"},Wc=["href","title"],jc={key:2,class:"message-skill-attachments"},qc=["href","title"],Uc={class:"message-skill-chip-prefix"},Nc={class:"message-skill-chip-name"},Vc=["data-role"],zc={key:0,class:"automation-message-label"},Kc={key:0},Gc={key:1,class:"work-summary-wrap","aria-live":"polite"},Zc={class:"work-summary-text"},Jc={key:0,class:"message-text"},Xc={key:2,class:"message-blockquote"},Yc={key:3,class:"message-list message-list-unordered"},Qc=["innerHTML"],eu={key:4,class:"message-list message-task-list"},tu=["data-checked"],nu={class:"message-list-item-text"},su=["start"],ou=["innerHTML"],au={key:6,class:"message-table-wrap"},iu={class:"message-table"},ru={key:0},lu={key:7,class:"message-code-block"},cu={key:0,class:"message-code-language"},uu={class:"message-code-pre"},du=["innerHTML"],fu={key:8,class:"message-divider"},hu={key:9,class:"message-text"},mu=["onClick"],gu=["src"],pu=["src","alt","onError"],vu=["href","onClick"],ku=["title","aria-label"],yu=["aria-label"],wu=["src"],bu=["src","alt"],Cu=16,jn=30,qn=20,$u=200,xu=le({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},liveTurnId:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},hasMorePersistedAbove:{type:Boolean},isLoadingPersistedAbove:{type:Boolean},loadEarlierMessages:{type:Function}},emits:["forkThread","rollback","respondServerRequest","fileChangesChanged"],setup(e,{expose:t,emit:n}){function o(d){return Oo(d,a.cwd,J)}function s(d){return Ve(d,a.cwd)}const a=e,i=Jl({getCwd:()=>a.cwd,isVideoMediaUrl:lt}),{highlightCacheVersion:r,hasHighlightLoaded:l,ensureHighlightJsLoaded:h,getInlineSegments:g,toBrowseUrl:b,toEditUrlFromBrowseHref:L,getMessageBlocks:y,renderListItemContentAsHtml:I,renderCachedHighlightedCodeAsHtml:k,renderMarkdownBlocksAsHtml:E,clearRenderCaches:x}=i,C=Go({getMessages:()=>a.messages,getLiveOverlay:()=>a.liveOverlay,isCommandMessage:tt}),{hiddenGroupedCommandIds:A,isCommandExpanded:_,isCommandCompact:R,isCommandOutputCondensed:O,toggleCommandExpand:q,getWorkBlockCommands:ee,pruneCommandIdSets:V}=C,fe=Jo({toEditUrlFromBrowseHref:L}),{isFileLinkContextMenuVisible:Re,fileLinkContextMenuX:ze,fileLinkContextMenuY:$,fileLinkContextBrowseUrl:M,fileLinkContextEditUrl:D,handleConversationContextMenu:G,closeFileLinkContextMenu:ae}=fe,{isMobile:B}=bo(),N=zo({getMessages:()=>a.messages,getLiveTurnId:()=>a.liveTurnId??"",isFileChangeMessage:Qt,isCopyableAssistantMessage:en,isReasoningMessage:yt,isPlanMessage:kt,isFoldMember:pn,getHiddenGroupedCommandIds:()=>A.value,isMobile:()=>B.value}),{anchoredFileChangeSummaryByAnchorId:ue,hiddenFileChangeMessageIds:ye,isDiffViewerFileListOpen:ie,diffViewerChanges:re,activeDiffViewerChange:ge,activeDiffViewerLines:j,toggleFileChangeSummary:pe,isFileChangeSummaryExpanded:_e,openDiffViewer:et,closeDiffViewer:Ie,toggleDiffViewerFileList:ls,closeDiffViewerFileList:cs,selectDiffViewerChange:us,readAnchoredFileChangeSummaryById:ve,isFileChangeSummaryExpandedById:ds,toggleFileChangeSummaryById:fs,readStandaloneFileChangeSummary:we,isFileChangeSummaryVisible:Gt,pruneFileChangeSummaryIds:hs}=N,ms=Ko({getMessages:()=>a.messages,isCopyableAssistantMessage:en,isPlanMessage:kt,planStepCopyMarker:vn,buildFileChangeCopyText:o,getAnchoredFileChangeSummaries:()=>ue.value}),{copiedResponseAnchorId:gs,forkableTurnIndexByAnchorId:ps,showCopyResponseButton:vs,isCopyableUserMessage:ks,copyUserMessage:ys,showForkResponseButton:ws,copyResponse:bs}=ms,{buildFeedbackMailto:Cs,feedbackMailtoBase:$s,recordVisibleFailure:xs}=Vn(),{t:J}=me(),Zt=$s();function Ts(d,p){xs(p);const F=d.currentTarget;F instanceof HTMLAnchorElement&&(F.href=Cs())}function tt(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function _s(d){return d.messageType==="compaction.pending"}function Is(d){return d.messageType==="compaction.done"}function kt(d){return d.messageType==="plan"||d.messageType==="plan.live"}function yt(d){return d.messageType==="reasoning"&&!!d.reasoning}const wt=U(new Set);function Jt(d){return wt.value.has(d.id)}function Xt(d){const p=new Set(wt.value);p.has(d.id)?p.delete(d.id):p.add(d.id),wt.value=p}function Yt(d){return d.messageType==="toolCall"&&!!d.toolCall}function Ls(d){return d.messageType==="turnError"}function Qt(d){return d.messageType==="fileChange"&&d.fileChangeStatus==="completed"&&Array.isArray(d.fileChanges)&&d.fileChanges.length>0}function en(d){return d.role==="assistant"&&!tt(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const bt=n,Le=U(null),tn=U(null),Ms=Xo({isVideo:lt}),{modalImageUrl:nt,modalIsVideo:As,markdownImageFailureVersion:Ss,isMarkdownImageFailed:Fs,onMarkdownImageError:Ps,openImageModal:nn,closeImageModal:st}=Ms,Es=Zo({getActiveThreadId:()=>a.activeThreadId,getCwd:()=>a.cwd,onFileChangesChanged:()=>bt("fileChangesChanged",a.activeThreadId),updateThreadFileChanges:To,t:J}),{fileChangeActionKey:sn,isFileChangeActionable:on,fileChangeActionStatus:an,fileChangeActionErrorText:rn,fileChangeNextAction:ln,fileChangeActionLabel:cn,runFileChangeAction:Bs,resetFileChangeActions:Rs}=Es,Ce=U(null),Os=P(()=>{const d=Ce.value;return d?d.kind==="edit-message"?J("Rollback this turn?"):d.action==="undo"?J("Undo file changes?"):J("Redo file changes?"):""}),Ds=P(()=>{const d=Ce.value;return d?d.kind==="edit-message"?J("This rolls the thread back to this turn so you can edit the message. Later replies will be removed."):d.filePathLabel?d.action==="undo"?J("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:d.filePathLabel}):J("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:d.filePathLabel}):d.action==="undo"?J("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):J("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),Me=U(!0);let Ee=0,be=0,ot=0,Ke=null;const un=new WeakSet,Ae=U(qt(a.activeThreadId)),dn=P(()=>vt(Ae.value,a.activeThreadId)),Se=U(!1),Ct=P(()=>a.messages.filter(d=>!kt(d))),Oe=P(()=>Pl(Ct.value)),$t=P(()=>El({turnCount:Oe.value.length,hotTurns:jn,pageSize:qn,coldPage:dn.value.coldPage})),xt=P(()=>$t.value.warmStartTurn),De=P(()=>$t.value.warmEndTurn),fn=P(()=>$t.value.coldTurnCount),hn=P(()=>fn.value>0),Tt=P(()=>dn.value.expandedWarmTurns),Hs=P(()=>{const d=Ct.value,p=Oe.value,F=[],H=Tt.value;for(let ne=xt.value;ne<De.value;ne+=1){const de=p[ne];if(!de)continue;const T={turn:ne,userText:ns(de.userItem.text),assistantPreview:de.assistantPreview,toolCount:de.toolCount,expanded:H.has(ne)},z=H.has(ne)?d.slice(de.startIdx,de.endIdx).map(X=>({message:X})):[];F.push({key:`warm-${ne}`,warm:T,warmItems:z,processItems:[],fileChangeAnchorIds:[]})}const Y=En(d,p,De.value),v=Y[0];if(!v)return F;const he=a.messages.findIndex(ne=>ne.id===v.id),Fe=he>=0?a.messages.slice(he):Y;for(const ne of Il(Fe,{liveOverlayActive:a.liveOverlay!==null,liveTurnId:a.liveTurnId})){const de=ne.items.find(Z=>Z.kind==="user"),T=ne.items.find(Z=>Z.kind==="final-assistant"),z=ne.items.filter(Z=>Z!==de&&Z!==T&&Z.message.messageType!=="worked").map(Z=>({message:Z.message,presentation:Z.kind==="plan"?"plan":"process"})),X=ne.items.map(Z=>Z.message.id).filter(Z=>!!ve(Z));F.push({key:ne.key,warmItems:[],request:de?{message:de.message}:void 0,processItems:z,fileChangeAnchorIds:X,finalItem:T?{message:T.message,presentation:"final-assistant"}:void 0})}return F}),Ws=P(()=>Rl(a.messages));function js(d){var F,H;const p=((F=d.request)==null?void 0:F.message.turnId)??((H=d.finalItem)==null?void 0:H.message.turnId);return p?Ws.value[p]:void 0}function mn(){Ae.value=Ml(Ae.value,a.activeThreadId)}function qs(d){Ae.value=Pn(Ae.value,a.activeThreadId,d,!Tt.value.has(d))}const gn=P(()=>Oe.value.map((d,p)=>({turn:p,text:Ll(d.userItem.text)}))),Us=P(()=>Math.max(0,gn.value.length-1)),Ns=P(()=>{const d=new Map;return Oe.value.forEach((p,F)=>{d.set(p.userItem.id,F)}),d});function _t(d){return`question-anchor-${d}`}function Vs(d){const p=Ns.value.get(d.id);if(p!==void 0&&!(p<De.value))return _t(p)}function zs(d){if(d<De.value){let p=Ae.value;if(d<xt.value){const F=Bl({turn:d,turnCount:Oe.value.length,hotTurns:jn,pageSize:qn});p=Al(p,a.activeThreadId,F)}p=Pn(p,a.activeThreadId,d,!0),Ae.value=p}Me.value=!1,ct().then(()=>{const p=Le.value,F=document.getElementById(_t(d));if(!p||!F)return;const H=F.getBoundingClientRect(),Y=p.getBoundingClientRect(),v=p.scrollTop+H.top-Y.top-12;p.scrollTo({top:Math.max(0,v),behavior:"smooth"})})}const Ks=P(()=>{const d=Ct.value,p=Oe.value,F=[];for(let he=xt.value;he<De.value;he+=1){if(!Tt.value.has(he))continue;const Fe=p[he];Fe&&F.push(...d.slice(Fe.startIdx,Fe.endIdx))}const H=En(d,p,De.value),Y=H[0];if(!Y)return F;const v=a.messages.findIndex(he=>he.id===Y.id);return F.push(...v>=0?a.messages.slice(v):H),F}),It=P(()=>$l(Ks.value)),Ge=P(()=>{var p;const d=new Map;for(const F of It.value){const H=((p=F.messages[0])==null?void 0:p.id)??"";H&&d.set(H,F)}return d}),Gs=P(()=>{const d=new Set;for(const p of It.value)for(const F of p.messages)d.add(F.id);return d}),Zs=P(()=>{const d=new Set;for(const p of It.value)d.add(p.turnId);return d});function Js(d){return Ge.value.has(d.id)}function pn(d){return Gs.value.has(d.id)}function Xs(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.messages)??[]}function Ys(d){return $r(Xs(d))}function Qs(d){var p;return d.type==="batch"?`tool-batch-${d.kind}-${((p=d.messages[0])==null?void 0:p.id)??""}`:d.message.id}function eo(d){const p=Ge.value.get(d.id);return p?xl(p,{t:J,formatDuration:Ot}):""}function to(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.running)??!1}function no(d){var p;return((p=Ge.value.get(d.id))==null?void 0:p.hasOutsideContent)??!0}function so(d){return d.messageType==="worked"}const oo=P(()=>a.hasMorePersistedAbove===!0),ao=P(()=>!Me.value&&(a.messages.length>0||a.pendingRequests.length>0||!!a.liveOverlay));function vn(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function io(d){const p=ps.value[d];typeof p=="number"&&a.activeThreadId&&bt("forkThread",{threadId:a.activeThreadId,turnIndex:p})}const Lt=P(()=>{const d={};for(const p of a.messages){if(p.role!=="user"||typeof p.turnIndex!="number")continue;const F=typeof p.turnId=="string"&&p.turnId.length>0?p.turnId:"";!F||p.text.trim().length===0||(d[p.id]=F)}return d});function ro(d){return typeof Lt.value[d.id]=="string"}function lo(d){Lt.value[d]&&(Ce.value={kind:"edit-message",messageId:d})}function kn(d,p){sn(d)&&(Ce.value={kind:"file-change",summary:d,action:p})}function yn(d,p){!d||!sn(d)||!p.path||(Ce.value={kind:"file-change",summary:d,action:"undo",filePaths:[p.path],filePathLabel:s(p.path)})}function co(){const d=Ce.value;if(Ce.value=null,!!d){if(d.kind==="edit-message"){const p=Lt.value[d.messageId];p&&bt("rollback",{turnId:p});return}Bs(d.summary,d.action,d.filePaths)}}function uo(){const d=Le.value,p=tn.value;!d||!p||(d.scrollTop=d.scrollHeight,p.scrollIntoView({block:"end"}))}function fo(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=Cu}function ho(){if(Le.value&&Me.value){at();return}}function at(){Le.value&&uo()}function Mt(){return Me.value}function wn(){if(!Mt()){ot=0,be=0;return}if(at(),ot-=1,ot<=0){be=0;return}be=requestAnimationFrame(wn)}function it(d=6){Mt()&&(be&&(cancelAnimationFrame(be),be=0),ot=Math.max(d,1),be=requestAnimationFrame(wn))}function bn(){it(3)}function Cn(){Me.value=!0,at(),it(4)}async function $n(){var Y;const d=Le.value;if(!d||!a.hasMorePersistedAbove||Se.value||a.isLoadingPersistedAbove===!0)return;Se.value=!0;const p=a.activeThreadId,F=d.scrollHeight,H=d.scrollTop;try{await((Y=a.loadEarlierMessages)==null?void 0:Y.call(a,p)),await ct(),a.activeThreadId===p&&(d.scrollTop=H+(d.scrollHeight-F))}finally{Se.value=!1}}t({jumpToLatest:Cn});function mo(){if(!Mt())return;const d=Le.value;if(!d)return;const p=d.querySelectorAll("img.message-image-preview");for(const F of p)F.complete||un.has(F)||(un.add(F),F.addEventListener("load",bn,{once:!0}),F.addEventListener("error",bn,{once:!0}))}async function rt(){return Ke||(Ke=ct().then(()=>new Promise(d=>{Ee&&cancelAnimationFrame(Ee),Ee=requestAnimationFrame(()=>{Ee=0,Ke=null,ho(),mo(),it(),d()})})),Ke)}$e(()=>a.messages,async d=>{if(a.isLoading)return;const p=new Set(d.filter(F=>F.messageType==="commandExecution"&&F.commandExecution).map(F=>F.id));V(p),hs(),await rt()}),$e(()=>a.messages.some(d=>d.text.includes("```")),d=>{!d||l()||h()},{immediate:!0}),$e(()=>a.pendingRequests,async()=>{a.isLoading||await rt()},{deep:!0}),$e(()=>a.liveOverlay,async d=>{d&&Me.value&&(await ct(),at(),it(8))},{deep:!0}),$e(()=>a.isLoading,async d=>{d||await rt()}),$e(()=>a.activeThreadId,async()=>{Me.value=!0,nt.value="",Se.value=!1,Rs(),Ae.value=qt(a.activeThreadId),await rt()},{flush:"post"});function go(){const d=Le.value;!d||a.isLoading||(Me.value=fo(d),d.scrollTop<$u&&!Se.value&&(hn.value?mn():a.hasMorePersistedAbove===!0&&$n()))}const At=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function lt(d){const p=d.trim();if(!p)return!1;if(p.startsWith("data:video/"))return!0;try{const F=new URL(p,window.location.href);return At.test(F.pathname)?!0:F.pathname==="/codex-local-image"?At.test(F.searchParams.get("path")??""):!1}catch{return At.test(p)}}return pt(()=>{x(),Ee&&(cancelAnimationFrame(Ee),Ee=0),be&&(cancelAnimationFrame(be),be=0)}),(d,p)=>(c(),f(W,null,[m("section",{class:"conversation-root",onContextmenuCapture:p[4]||(p[4]=(...F)=>u(G)&&u(G)(...F))},[e.isLoading&&e.messages.length>0?(c(),f("div",Xl,w(u(J)("Loading messages...")),1)):S("",!0),e.isLoading&&e.messages.length===0?(c(),f("p",Yl,w(u(J)("Loading messages...")),1)):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(c(),f("p",Ql,w(u(J)("No messages in this thread yet.")),1)):(c(),f("ul",{key:3,ref_key:"conversationListRef",ref:Le,class:"conversation-list",onScroll:go},[oo.value?(c(),f("li",ec,[m("button",{type:"button",class:"load-more-button",disabled:Se.value||e.isLoadingPersistedAbove,onClick:$n},w(Se.value||e.isLoadingPersistedAbove?u(J)("Loading…"):u(J)("Load earlier messages")),9,tc)])):S("",!0),hn.value?(c(),f("li",nc,[m("button",{type:"button",class:"load-more-button",disabled:Se.value,onClick:mn},w(u(J)("Load earlier ({n} turns)",{n:fn.value})),9,sc)])):S("",!0),(c(!0),f(W,null,K(Hs.value,F=>(c(),se(tl,{key:F.key,"turn-key":F.key,warm:F.warm,"warm-items":F.warmItems,request:F.request,"process-items":F.processItems,"final-item":F.finalItem,"file-change-anchor-ids":F.fileChangeAnchorIds,"duration-ms":js(F)},{"warm-card":We(({warm:H})=>[m("li",{id:_t(H.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn"},[m("div",ac,[m("div",ic,[Q(ll,{"user-text":H.userText,"assistant-preview":H.assistantPreview,"tool-count":H.toolCount,expanded:H.expanded,onToggle:Y=>qs(H.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],8,oc)]),"file-change":We(({anchorMessageId:H})=>[m("div",rc,[m("div",lc,[u(Gt)(u(ve)(H))?(c(),se(Ln,{key:0,summary:u(ve)(H),expanded:u(ds)(H),cwd:a.cwd,actionable:u(on)(u(ve)(H)),"action-status":u(an)(u(ve)(H)),"action-error-text":u(rn)(u(ve)(H)),"next-action":u(ln)(u(ve)(H)),"action-label":u(cn)(u(ve)(H)),onToggle:Y=>u(fs)(H),onOpenDiff:Y=>u(et)(u(ve)(H),Y),onRequestAction:Y=>kn(u(ve)(H),Y),onRequestFileAction:Y=>yn(u(ve)(H),Y)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):S("",!0)])])]),default:We(({item:H,section:Y})=>[(c(!0),f(W,null,K([H.message],v=>{var he,Fe,ne,de;return c(),f(W,{key:v.id},[Js(v)?(c(),f("li",cc,[m("div",uc,[m("div",dc,[Q(sr,{label:eo(v),running:to(v),"has-outside-content":no(v)},{default:We(()=>[(c(!0),f(W,null,K(Ys(v),T=>(c(),f(W,{key:Qs(T)},[T.type==="batch"?(c(),se(jr,{key:0,kind:T.kind,messages:T.messages},null,8,["kind","messages"])):(c(!0),f(W,{key:1},K([T.message],z=>(c(),f(W,{key:z.id},[!u(A).has(z.id)&&!u(ye).has(z.id)?(c(),f(W,{key:0},[tt(z)?(c(),f("div",fc,[(c(!0),f(W,null,K(u(ee)(z),(X,Z)=>(c(),se(Sn,{key:`work-cmd-${X.id}`,command:X,"step-index":Z,expanded:u(_)(X),compact:u(R)(X),"output-condensed":u(O)(X),onToggle:xn=>u(q)(X)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):Yt(z)?(c(),se(jt,{key:1,message:z},null,8,["message"])):yt(z)?(c(),se(An,{key:2,message:z,expanded:Jt(z),"content-html":u(E)(z.text),onToggle:X=>Xt(z)},null,8,["message","expanded","content-html","onToggle"])):S("",!0)],64)):S("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!pn(v)&&!u(A).has(v.id)&&!u(ye).has(v.id)&&!(so(v)&&Zs.value.has(v.turnId??""))?(c(),f("li",{key:1,id:Vs(v),class:te(["conversation-item",{"conversation-item-request":Y==="request","conversation-item-process":Y==="process"||H.presentation==="process","conversation-item-final":Y==="final"||H.presentation==="final-assistant","conversation-item-plan":H.presentation==="plan"}]),"data-role":v.role,"data-message-type":v.messageType||""},[_s(v)?(c(),f("div",mc,[m("div",gc,[p[6]||(p[6]=m("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),m("span",null,w(u(J)("Compacting thread context…")),1)])])):Is(v)?(c(),f("div",pc,[m("div",vc,w(u(J)("Context compacted")),1)])):tt(v)?(c(),f("div",kc,[m("div",yc,[m("div",wc,[(c(!0),f(W,null,K(u(ee)(v),(T,z)=>(c(),se(Sn,{key:`work-cmd-${T.id}`,command:T,"step-index":z,expanded:u(_)(T),compact:u(R)(T),"output-condensed":u(O)(T),onToggle:X=>u(q)(T)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):Yt(v)?(c(),se(jt,{key:3,message:v},null,8,["message"])):Qt(v)?(c(),f("div",{key:4,class:"message-row","data-role":v.role,"data-message-type":v.messageType||""},[m("div",{class:"message-stack","data-role":v.role},[m("article",{class:"message-body","data-role":v.role},[u(Gt)(u(we)(v))?(c(),se(Ln,{key:0,summary:u(we)(v),expanded:u(_e)(v),cwd:a.cwd,actionable:u(on)(u(we)(v)),"action-status":u(an)(u(we)(v)),"action-error-text":u(rn)(u(we)(v)),"next-action":u(ln)(u(we)(v)),"action-label":u(cn)(u(we)(v)),onToggle:T=>u(pe)(v),onOpenDiff:T=>u(et)(u(we)(v),T),onRequestAction:T=>kn(u(we)(v),T),onRequestFileAction:T=>yn(u(we)(v),T)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):S("",!0)],8,$c)],8,Cc)],8,bc)):H.presentation==="plan"?(c(),f("div",xc,[m("div",Tc,[m("article",_c,[m("div",Ic,w(u(J)("Plan")),1),(he=u(Ze)(v))!=null&&he.explanation?(c(),f("p",Lc,w((Fe=u(Ze)(v))==null?void 0:Fe.explanation),1)):S("",!0),(ne=u(Ze)(v))!=null&&ne.steps.length?(c(),f("ol",Mc,[(c(!0),f(W,null,K((de=u(Ze)(v))==null?void 0:de.steps,(T,z)=>(c(),f("li",{key:`${v.id}-plan-${z}`,"data-status":T.status},[m("span",Sc,w(vn(T.status)),1),m("span",null,w(T.step),1)],8,Ac))),128))])):S("",!0)])])])):(c(),f("div",{key:6,class:te(["message-row",{"message-row-final":H.presentation==="final-assistant"}]),"data-role":v.role,"data-message-type":v.messageType||""},[m("div",{class:"message-stack","data-role":v.role},[m("article",{class:"message-body","data-role":v.role},[v.images&&v.images.length>0?(c(),f("ul",{key:0,class:te(["message-image-list",{"message-generated-image-list":v.messageType==="imageView"}]),"data-role":v.role},[(c(!0),f(W,null,K(v.images,T=>(c(),f("li",{key:T,class:"message-image-item"},[m("button",{class:"message-image-button",type:"button",onClick:z=>u(nn)(T)},[lt(T)?(c(),f("video",{key:0,class:te(["message-image-preview message-video-preview",{"message-generated-image-preview":v.messageType==="imageView"}]),src:T,controls:"",preload:"metadata"},null,10,Oc)):(c(),f("img",{key:1,class:te(["message-image-preview",{"message-generated-image-preview":v.messageType==="imageView"}]),src:T,alt:v.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,Dc))],8,Rc)]))),128))],10,Bc)):S("",!0),v.fileAttachments&&v.fileAttachments.length>0?(c(),f("div",Hc,[(c(!0),f(W,null,K(v.fileAttachments,T=>(c(),f("span",{key:`${v.id}:${T.path}`,class:"message-file-chip"},[p[7]||(p[7]=m("span",{class:"message-file-chip-icon"},"📄",-1)),m("a",{class:"message-file-link message-file-chip-name",href:u(b)(T.path),target:"_blank",rel:"noopener noreferrer",title:T.path},w(T.label),9,Wc)]))),128))])):S("",!0),v.skills&&v.skills.length>0?(c(),f("div",jc,[(c(!0),f(W,null,K(v.skills,T=>(c(),f("a",{key:`${v.id}:${T.path}`,class:"message-skill-chip",href:u(b)(T.path),title:T.path},[m("span",Uc,w(u(J)("Skill")),1),m("span",Nc,w(T.name),1)],8,qc))),128))])):S("",!0),v.text.length>0?(c(),f("article",{key:3,class:"message-card","data-role":v.role},[v.isAutomationRun?(c(),f("div",zc,[p[8]||(p[8]=m("span",null,"Sent via automation",-1)),v.automationDisplayName?(c(),f("code",Kc,w(v.automationDisplayName),1)):S("",!0)])):S("",!0),v.messageType==="worked"?(c(),f("div",Gc,[m("p",Zc,w(v.text),1)])):yt(v)?(c(),se(An,{key:2,message:v,expanded:Jt(v),"content-html":u(E)(v.text),onToggle:T=>Xt(v)},null,8,["message","expanded","content-html","onToggle"])):Co([v.id,v.text,a.cwd,u(r),u(Ss)],()=>(c(),f("div",{key:3,class:"message-text-flow"},[(c(!0),f(W,null,K(u(y)(v),(T,z)=>(c(),f(W,{key:`block-${z}`},[T.kind==="paragraph"?(c(),f("p",Jc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="heading"?(c(),se($o(u(Jn)(T.level)),{key:1,class:te(["message-heading",u(Xn)(T.level)])},{default:We(()=>[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])]),_:2},1032,["class"])):T.kind==="blockquote"?(c(),f("blockquote",Xc,[Q(He,{segments:u(g)(T.value),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])):T.kind==="unorderedList"?(c(),f("ul",Yc,[(c(!0),f(W,null,K(T.items,(X,Z)=>(c(),f("li",{key:`ul-${z}-${Z}`,class:"message-list-item"},[m("div",{class:"message-list-item-content",innerHTML:u(I)(X)},null,8,Qc)]))),128))])):T.kind==="taskList"?(c(),f("ul",eu,[(c(!0),f(W,null,K(T.items,(X,Z)=>(c(),f("li",{key:`task-${z}-${Z}`,class:"message-task-item"},[m("span",{class:"message-task-checkbox","data-checked":X.checked},w(X.checked?"☑":"☐"),9,tu),m("div",nu,[Q(He,{segments:u(g)(X.text),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])])]))),128))])):T.kind==="orderedList"?(c(),f("ol",{key:5,class:"message-list message-list-ordered",start:T.start},[(c(!0),f(W,null,K(T.items,(X,Z)=>(c(),f("li",{key:`ol-${z}-${Z}`,class:"message-list-item"},[m("div",{class:"message-list-item-content",innerHTML:u(I)(X)},null,8,ou)]))),128))],8,su)):T.kind==="table"?(c(),f("div",au,[m("table",iu,[m("thead",null,[m("tr",null,[(c(!0),f(W,null,K(T.headers,(X,Z)=>(c(),f("th",{key:`th-${z}-${Z}`,class:"message-table-head-cell",style:Je({textAlign:T.alignments[Z]??"left"})},[Q(He,{segments:u(g)(X),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])],4))),128))])]),T.rows.length>0?(c(),f("tbody",ru,[(c(!0),f(W,null,K(T.rows,(X,Z)=>(c(),f("tr",{key:`tr-${z}-${Z}`,class:"message-table-body-row"},[(c(!0),f(W,null,K(X,(xn,Tn)=>(c(),f("td",{key:`td-${z}-${Z}-${Tn}`,class:"message-table-cell",style:Je({textAlign:T.alignments[Tn]??"left"})},[Q(He,{segments:u(g)(xn),"to-browse-url":u(b)},null,8,["segments","to-browse-url"])],4))),128))]))),128))])):S("",!0)])])):T.kind==="codeBlock"?(c(),f("div",lu,[T.language?(c(),f("div",cu,w(T.language),1)):S("",!0),m("pre",uu,[m("code",{class:"hljs",innerHTML:u(k)(T.language,T.value)},null,8,du)])])):T.kind==="thematicBreak"?(c(),f("hr",fu)):u(Fs)(v.id,z)?(c(),f("p",hu,w(T.markdown),1)):(c(),f("button",{key:10,class:"message-image-button",type:"button",onClick:X=>u(nn)(T.url)},[lt(T.url)?(c(),f("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:T.url,controls:"",preload:"metadata"},null,8,gu)):(c(),f("img",{key:1,class:"message-image-preview message-markdown-image",src:T.url,alt:T.alt||"Embedded message image",loading:"lazy",onError:X=>u(Ps)(v.id,z)},null,40,pu))],8,mu))],64))),128))])),p,0),Ls(v)?(c(),f("a",{key:4,class:"turn-error-feedback",href:u(Zt),onClick:T=>Ts(T,v.text)},w(u(J)("Send feedback")),9,vu)):S("",!0)],8,Vc)):S("",!0),Y!=="process"?(c(),se(Zi,{key:4,role:v.role,"show-edit":ro(v),"show-fork":u(ws)(v),"show-copy":u(vs)(v)||u(ks)(v),copied:u(gs)===v.id,onEdit:T=>lo(v.id),onFork:T=>io(v.id),onCopy:T=>v.role==="user"?u(ys)(v.id):u(bs)(v.id)},null,8,["role","show-edit","show-fork","show-copy","copied","onEdit","onFork","onCopy"])):S("",!0)],8,Ec)],8,Pc)],10,Fc))],10,hc)):S("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids","duration-ms"]))),128)),e.liveOverlay?(c(),se(Li,{key:2,overlay:e.liveOverlay,"feedback-mailto":u(Zt)},null,8,["overlay","feedback-mailto"])):S("",!0),m("li",{ref_key:"bottomAnchorRef",ref:tn,class:"conversation-bottom-anchor"},null,512)],544)),Q(cr,{anchors:gn.value,"active-turn":Us.value,onJump:zs},null,8,["anchors","active-turn"]),ao.value?(c(),f("button",{key:4,type:"button",class:"jump-to-latest-button",title:u(J)("Jump to latest"),"aria-label":u(J)("Jump to latest output"),onClick:Cn},[Q(xo,{class:"icon-svg jump-to-latest-icon"})],8,ku)):S("",!0),u(nt).length>0?(c(),f("div",{key:5,class:"image-modal-backdrop",onClick:p[3]||(p[3]=(...F)=>u(st)&&u(st)(...F))},[m("div",{class:"image-modal-content",onClick:p[2]||(p[2]=Ue(()=>{},["stop"]))},[m("button",{class:"image-modal-close",type:"button","aria-label":u(J)("Close image preview"),onClick:p[1]||(p[1]=(...F)=>u(st)&&u(st)(...F))},[Q(Nn,{class:"icon-svg"})],8,yu),u(As)?(c(),f("video",{key:0,class:"image-modal-image",src:u(nt),controls:"",autoplay:""},null,8,wu)):(c(),f("img",{key:1,class:"image-modal-image",src:u(nt),alt:u(J)("Expanded message image")},null,8,bu))])])):S("",!0),Q(ui,{visible:u(Re),x:u(ze),y:u($),"browse-url":u(M),"edit-url":u(D),onClose:u(ae)},null,8,["visible","x","y","browse-url","edit-url","onClose"]),Q(qa,{change:u(ge),changes:u(re),lines:u(j),"is-mobile":u(B),"is-file-list-open":u(ie),cwd:a.cwd,onClose:u(Ie),onSelectChange:u(us),onToggleFileList:u(ls),onCloseFileList:u(cs)},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd","onClose","onSelectChange","onToggleFileList","onCloseFileList"])],32),Q(sa,{visible:Ce.value!==null,title:Os.value,message:Ds.value,"confirm-label":"Confirm",danger:"",onConfirm:co,onCancel:p[5]||(p[5]=F=>Ce.value=null)},null,8,["visible","title","message"])],64))}}),Iu=oe(xu,[["__scopeId","data-v-75e349ec"]]);export{Iu as default};