@muyichengshayu/promptx 0.1.21 → 0.1.23

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.
@@ -7,8 +7,8 @@
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com" />
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
9
  <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-CPEYh7Do.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-Dd5oL2Cq.css">
10
+ <script type="module" crossorigin src="/assets/index-w7ugR3S2.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-SlXaI2eN.css">
12
12
  </head>
13
13
  <body class="h-full">
14
14
  <div id="app" class="h-full"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muyichengshayu/promptx",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "PromptX 本机 AI 协作工作台",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{w as he,o as Oe,a as p,c as ge,b as f,d as e,e as k,u as a,t as r,y as Qe,z as Xe,n as T,F as xe,r as $e,f as M,q as Je,g as Te,T as Ue,s as $,j as ye,i as j,B as Fe,I as He,C as Ye,D as Ze,R as et,v as tt}from"./index-CPEYh7Do.js";import{A as nt,n as Le,k as Ce,r as st,f as ve,X as qe,S as Ie,L as Pe,m as at,d as it,s as lt,o as Be,_ as ot,P as rt,b as dt,p as ct,B as ut,q as pt,e as Ae,T as mt,t as ft}from"./WorkbenchView-C2MWZt4p.js";import{I as vt}from"./info-DUErgVjs.js";function ht(i=[]){return(Array.isArray(i)&&i.length?i:nt).filter(d=>d&&typeof d=="object").map(d=>{const S=Le(d.value);return{...d,value:S,label:String(d.label||Ce(S)).trim()||Ce(S),enabled:d.enabled!==!1,available:d.available!==!1}})}function Re(i=[]){return ht(i).filter(P=>P.enabled&&P.available)}async function gt(){const i=await st("/api/meta",{cache:"no-store"});return Re(i==null?void 0:i.agentEngineOptions)}const xt={class:"panel flex h-full w-full max-w-4xl flex-col overflow-hidden sm:h-auto sm:max-h-[86vh]"},yt={class:"theme-divider flex items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},bt={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},wt={class:"theme-muted-text mt-1 text-xs leading-5"},St=["disabled"],kt={class:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5"},_t={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},$t={class:"flex items-start gap-2 text-xs leading-5"},Ct={class:"theme-muted-text shrink-0"},jt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Mt={class:"theme-muted-text mt-4 block text-xs"},Pt={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},Tt=["placeholder"],Lt={class:"mt-4 flex items-center gap-1.5"},Rt={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},Dt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Et={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ft={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},It={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Bt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},At={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Nt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},zt={key:7,class:"space-y-1"},Ot=["onClick"],Ut={class:"min-w-0 flex-1"},Ht=["innerHTML"],qt=["innerHTML"],Vt={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},Wt={key:8,class:"space-y-1"},Kt={class:"flex items-start gap-1.5"},Gt=["onClick"],Qt=["onClick"],Xt={class:"min-w-0 flex-1"},Jt={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},Yt={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},Zt={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},en=["disabled"],tn=["disabled"],nn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""}},emits:["close","select"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye(),u=$(""),h=$(null),w=$(!1),l=$(""),x=$(!1),y=$(""),A=$([]),I=$(!1),L=$(""),C=$("tree"),E=$(""),V=$("");let D=null,O=0;const Z=j(()=>ce(h.value?[h.value]:[])),_=j(()=>C.value==="search"&&!L.value.trim()),ie=j(()=>C.value==="search"&&!!L.value.trim()&&!x.value&&!y.value&&!A.value.length),je=j(()=>C.value==="tree"&&!w.value&&!l.value&&!Z.value.length);function le(n=""){const c=String(n||"").trim();return/^[a-z]:[\\/]/i.test(c)||c.includes("\\")}function F(n=""){const c=String(n||"").trim();if(!c)return"";const s=le(c);let m=c.replace(/\\/g,"/");return m.length>1&&!/^[a-z]:\/?$/i.test(m)&&m!=="/"&&(m=m.replace(/\/+$/,"")),s?m.toLowerCase():m}function Q(n="",c=""){const s=F(n),m=F(c);return!s||!m?!1:s===m||s.startsWith(`${m}/`)}function R(n="",c=""){const s=String(n||"").trim(),m=String(c||"").trim();return s?m?le(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${m}`:`${s.replace(/[\\/]+$/,"")}\\${m}`:s==="/"?`/${m}`:`${s.replace(/\/+$/,"")}/${m}`:s:m}function oe(n="",c=""){const s=F(n),m=F(c);if(!s||!m||!Q(m,s))return[];const N=m===s?"":m.slice(s.length).replace(/^\//,"");return N?N.split("/").filter(Boolean):[]}function ee(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||v("directoryPicker.unnamedDirectory")}function re(n=""){const c=String(n||"").trim();return c?c.split(/[\\/]/).filter(Boolean).at(-1)||c:"Home"}function X(n=""){return String(n||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function be(n="",c=""){const s=String(n||""),m=String(c||"").trim().toLowerCase();if(!s||!m)return null;const N=s.toLowerCase(),H=N.indexOf(m);if(H>=0)return{start:H,end:H+m.length};const _e=m.split(/[\\/\s_.-]+/).filter(Boolean).sort((q,Y)=>Y.length-q.length);for(const q of _e){if(q.length<2)continue;const Y=N.indexOf(q);if(Y>=0)return{start:Y,end:Y+q.length}}return null}function de(n="",c=""){const s=String(n||""),m=be(s,c);return m?`${X(s.slice(0,m.start))}<mark class="theme-search-highlight">${X(s.slice(m.start,m.end))}</mark>${X(s.slice(m.end))}`:X(s)}function we(n){return de(ee(n),L.value)}function Me(n){return de((n==null?void 0:n.path)||"",L.value)}function te(n,c=0){return{...n,depth:c,expanded:!1,loaded:!1,loading:!1,children:[]}}function ce(n=[],c=[]){return n.forEach(s=>{c.push(s),s.expanded&&s.children.length&&ce(s.children,c)}),c}function B(){h.value&&(h.value={...h.value})}function W(n,c=h.value?[h.value]:[]){const s=F(n);if(!s)return null;for(const m of c){if(F(m.path)===s)return m;if(m.children.length){const N=W(n,m.children);if(N)return N}}return null}function K(n){E.value=String((n==null?void 0:n.path)||"").trim(),V.value=ee(n)}async function ne(n,c={}){if(!(!n||n.loading)&&!(n.loaded&&!c.force)){n.loading=!0,l.value="",B();try{const s=await Be({path:n.path,limit:240});n.children=(s.items||[]).map(m=>te(m,n.depth+1)),n.loaded=!0}catch(s){l.value=s.message||v("directoryPicker.loadFailed")}finally{n.loading=!1,B()}}}async function ue(){w.value=!0,l.value="";try{const n=await Be({limit:240});u.value=String(n.path||""),h.value=te({name:re(n.path||""),path:String(n.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),h.value.children=(n.items||[]).map(c=>te(c,1)),h.value.loaded=!0,h.value.expanded=!0,K(h.value)}catch(n){l.value=n.message||v("directoryPicker.treeLoadFailed"),h.value=null,u.value=""}finally{w.value=!1}}async function se(n=""){const c=String(n||"").trim();if(!c||!u.value||!Q(c,u.value))return;let s=h.value;if(!s)return;K(s);const m=oe(u.value,c);for(const N of m){await ne(s),s.expanded=!0,B();const H=W(R(s.path,N),s.children);if(!H)break;s=H,K(s)}}async function pe(){L.value="",C.value="tree",A.value=[],y.value="",I.value=!1,E.value="",V.value="",await ue();const n=String(d.initialPath||"").trim();n&&Q(n,u.value)&&await se(n)}async function me(n){if(n!=null&&n.path&&(K(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,B(),await ne(n);return}n.expanded=!n.expanded,B()}}function Se(n){n!=null&&n.path&&(K(n),C.value="tree")}async function ae(){const n=String(L.value||"").trim();O+=1;const c=O;if(!d.open||!n||!u.value){x.value=!1,y.value="",A.value=[],I.value=!1;return}x.value=!0,y.value="";try{const s=await lt(n,{path:u.value,limit:80});if(c!==O)return;A.value=Array.isArray(s.items)?s.items:[],I.value=!!s.truncated}catch(s){if(c!==O)return;y.value=s.message||v("directoryPicker.searchFailed"),A.value=[],I.value=!1}finally{c===O&&(x.value=!1)}}function U(){if(D&&(window.clearTimeout(D),D=null),!String(L.value||"").trim()){x.value=!1,y.value="",A.value=[],I.value=!1;return}x.value=!0,y.value="",D=window.setTimeout(()=>{ae()},120)}async function fe(n){n!=null&&n.path&&(C.value="tree",await se(n.path))}function ke(){E.value&&(S("select",E.value),S("close"))}function J(n){d.open&&n.key==="Escape"&&S("close")}return he(L,()=>{C.value=L.value.trim()?"search":"tree",U()}),he(()=>d.open,n=>{if(document.body.classList.toggle("overflow-hidden",n),n){window.addEventListener("keydown",J),pe().catch(()=>{});return}window.removeEventListener("keydown",J),D&&(window.clearTimeout(D),D=null)}),Oe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",J),D&&window.clearTimeout(D)}),(n,c)=>(p(),ge(Ue,{to:"body"},[i.open?(p(),f("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-[60] flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:c[5]||(c[5]=Te(s=>!(w.value||x.value)&&S("close"),["self"]))},[e("section",xt,[e("div",yt,[e("div",null,[e("div",bt,[k(a(ve),{class:"h-4 w-4"}),e("span",null,r(a(v)("directoryPicker.title")),1)]),e("p",wt,r(a(v)("directoryPicker.intro")),1)]),e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:w.value||x.value,onClick:c[0]||(c[0]=s=>S("close"))},[k(a(qe),{class:"h-4 w-4"})],8,St)]),e("div",kt,[e("div",_t,[e("div",$t,[e("span",Ct,r(a(v)("directoryPicker.currentSelection")),1),e("span",jt,r(E.value||a(v)("directoryPicker.selectionPlaceholder")),1)])]),e("label",Mt,[e("span",null,r(a(v)("directoryPicker.searchLabel")),1),e("div",Pt,[k(a(Ie),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Qe(e("input",{"onUpdate:modelValue":c[1]||(c[1]=s=>L.value=s),type:"text",placeholder:a(v)("directoryPicker.searchPlaceholder"),class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,8,Tt),[[Xe,L.value]])])]),e("div",Lt,[e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",C.value==="search"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:c[2]||(c[2]=s=>C.value="search")},[k(a(Ie),{class:"h-3.5 w-3.5"}),e("span",null,r(a(v)("directoryPicker.searchTab")),1)],2),e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",C.value==="tree"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:c[3]||(c[3]=s=>C.value="tree")},[k(a(ve),{class:"h-3.5 w-3.5"}),e("span",null,r(a(v)("directoryPicker.treeTab")),1)],2)]),e("div",Rt,[C.value==="search"&&y.value?(p(),f("div",Dt,r(y.value),1)):C.value==="tree"&&l.value?(p(),f("div",Et,r(l.value),1)):C.value==="search"&&x.value?(p(),f("div",Ft,[k(a(Pe),{class:"h-4 w-4 animate-spin"}),e("span",null,r(a(v)("directoryPicker.searching")),1)])):C.value==="tree"&&w.value?(p(),f("div",It,[k(a(Pe),{class:"h-4 w-4 animate-spin"}),e("span",null,r(a(v)("directoryPicker.treeLoading")),1)])):_.value?(p(),f("div",Bt,r(a(v)("directoryPicker.searchPrompt")),1)):ie.value?(p(),f("div",At,r(a(v)("directoryPicker.noSearchResults")),1)):je.value?(p(),f("div",Nt,r(a(v)("directoryPicker.emptyTree")),1)):C.value==="search"?(p(),f("div",zt,[(p(!0),f(xe,null,$e(A.value,s=>(p(),f("button",{key:s.path,type:"button",class:T(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",F(E.value)===F(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:m=>fe(s)},[k(a(ve),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),e("div",Ut,[e("div",null,[e("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:we(s)},null,8,Ht)]),e("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:Me(s)},null,8,qt)])],10,Ot))),128)),I.value?(p(),f("p",Vt,r(a(v)("directoryPicker.truncatedHint")),1)):M("",!0)])):(p(),f("div",Wt,[(p(!0),f(xe,null,$e(Z.value,s=>(p(),f("div",{key:s.path,class:T(["rounded-sm border border-transparent px-1.5 py-1 transition",F(E.value)===F(s.path)?"theme-list-item-active":s.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:Je({paddingLeft:`${s.depth*16+6}px`})},[e("div",Kt,[e("button",{type:"button",class:T(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:Te(m=>me(s),["stop"])},[s.loading?(p(),ge(a(Pe),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),ge(a(at),{key:1,class:T(["h-3.5 w-3.5 transition",s.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,Gt),e("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:m=>Se(s)},[k(a(ve),{class:T(["h-4 w-4 shrink-0",F(E.value)===F(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),e("div",Xt,[e("div",{class:T(["truncate text-[13px]",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},r(ee(s)),3),s.isHomeRoot?(p(),f("div",Jt,r(s.path),1)):M("",!0)])],8,Qt)])],6))),128))]))])]),e("div",Yt,[e("div",Zt,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:w.value||x.value,onClick:c[4]||(c[4]=s=>S("close"))},r(a(v)("directoryPicker.cancel")),9,en),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:w.value||x.value||!E.value,onClick:ke},[k(a(it),{class:"h-4 w-4"}),e("span",null,r(a(v)("directoryPicker.useCurrentDirectory")),1)],8,tn)])])])])):M("",!0)]))}},sn={class:"grid gap-4"},an={class:"theme-muted-text block text-xs"},ln=["value","disabled"],on={class:"theme-muted-text block text-xs"},rn={class:"mt-1 flex gap-2"},dn=["value","disabled"],cn=["disabled"],un={id:"codex-manager-workspace-suggestions"},pn=["value"],mn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},fn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},vn={class:"theme-muted-text block text-xs"},hn={class:"mt-1"},gn={class:"flex items-center gap-2 text-sm"},xn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},yn=["disabled","onClick"],bn={class:"flex items-center justify-between gap-3"},wn={class:"min-w-0 flex-1 truncate"},Sn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},kn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Ne={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["open-directory-picker","update:cwd","update:engine","update:title"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye(),u=j(()=>{const h=String(d.engine||"").trim();return d.engineOptions.find(w=>String((w==null?void 0:w.value)||"").trim()===h)||null});return(h,w)=>(p(),f("div",sn,[e("label",an,[e("span",null,r(a(v)("projectManager.projectTitleOptional")),1),e("input",{value:i.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:i.busy,onInput:w[0]||(w[0]=l=>S("update:title",l.target.value))},null,40,ln)]),e("label",on,[e("span",null,r(a(v)("projectManager.workingDirectoryField")),1),e("div",rn,[e("input",{value:i.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:T(["tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",i.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:i.busy||!i.canEditCwd,onInput:w[1]||(w[1]=l=>S("update:cwd",l.target.value))},null,42,dn),e("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:i.busy||!i.canEditCwd,onClick:w[2]||(w[2]=l=>S("open-directory-picker"))},[k(a(ve),{class:"h-4 w-4"}),e("span",null,r(i.mobile?a(v)("projectManager.choose"):a(v)("projectManager.chooseDirectory")),1)],8,cn)]),e("datalist",un,[(p(!0),f(xe,null,$e(i.workspaceSuggestions,l=>(p(),f("option",{key:l,value:l},null,8,pn))),128))]),i.duplicateCwdMessage?(p(),f("p",mn,r(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(p(),f("p",fn,r(i.cwdReadonlyMessage),1)):M("",!0)]),e("label",vn,[e("span",null,r(a(v)("projectManager.engineField")),1),e("div",hn,[k(ot,{"model-value":i.engine,options:i.engineOptions,disabled:i.busy||!i.canEditEngine,placeholder:a(v)("projectManager.selectEngine"),"empty-text":a(v)("projectManager.noEngines"),"get-option-value":l=>(l==null?void 0:l.value)||"","onUpdate:modelValue":w[3]||(w[3]=l=>S("update:engine",l))},{trigger:Fe(({disabled:l})=>{var x;return[e("div",gn,[e("span",{class:T(["min-w-0 flex-1 truncate",l?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},r(((x=u.value)==null?void 0:x.label)||a(v)("projectManager.selectEngine")),3),u.value&&u.value.enabled===!1?(p(),f("span",xn,r(a(v)("projectManager.comingSoon")),1)):M("",!0)])]}),option:Fe(({option:l,selected:x,select:y})=>[e("button",{type:"button",class:T(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",x?"theme-filter-active":"theme-filter-idle"]),disabled:(l==null?void 0:l.enabled)===!1,onClick:y},[e("div",bn,[e("span",wn,r(l.label),1),(l==null?void 0:l.enabled)===!1?(p(),f("span",Sn,r(a(v)("projectManager.comingSoon")),1)):M("",!0)])],10,yn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),i.engineReadonlyMessage?(p(),f("p",kn,r(i.engineReadonlyMessage),1)):M("",!0)])]))}},_n={class:"flex items-center justify-between gap-3"},$n={class:"theme-heading text-sm font-medium"},Cn={key:0,class:"theme-muted-text mt-1 text-xs"},jn=["disabled"],Mn=["onClick"],Pn={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Tn={class:"flex w-full flex-col gap-2 text-left"},Ln={class:"theme-heading min-w-0 text-sm font-medium"},Rn=["title"],Dn=["title"],En={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Fn={key:0,"aria-hidden":"true"},In={key:1},Bn={class:"flex flex-wrap items-center gap-2 pt-1"},An={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},ze={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye();function u(l){return d.mode==="edit"&&d.editingSessionId===l.id?"theme-card-selected":d.isSessionRunning(l.id)?"theme-card-warning":"theme-card-idle-strong"}function h(l){return d.isCurrentSession(l.id)?v("projectManager.current"):v("projectManager.regular")}function w(l){return d.isCurrentSession(l.id)?"theme-status-info":"theme-status-neutral"}return(l,x)=>(p(),f(xe,null,[e("div",_n,[e("div",null,[e("div",$n,r(a(v)("projectManager.projectList")),1),i.hasSessions?M("",!0):(p(),f("p",Cn,r(a(v)("projectManager.noProjects")),1))]),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:i.busy,onClick:x[0]||(x[0]=y=>S("create"))},[k(a(rt),{class:"h-4 w-4"}),e("span",null,r(a(v)("projectManager.create")),1)],8,jn)]),e("div",{class:T(["mt-4 space-y-2",i.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(p(!0),f(xe,null,$e(i.sessions,y=>(p(),f("article",{key:y.id,class:T(["relative cursor-pointer rounded-sm border p-3 transition",u(y)]),onClick:A=>S("select",y.id)},[i.mode==="edit"&&i.editingSessionId===y.id?(p(),f("span",Pn)):M("",!0),e("div",Tn,[e("div",Ln,[e("span",{class:"block truncate",title:y.title||a(v)("projectManager.untitledProject")},r(y.title||a(v)("projectManager.untitledProject")),9,Rn)]),e("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:y.cwd},r(y.cwd),9,Dn),e("div",En,[e("span",null,r(a(Ce)(y.engine)),1),i.mobile?M("",!0):(p(),f("span",Fn,"·")),i.mobile?M("",!0):(p(),f("span",In,r(i.formatUpdatedAt(y.updatedAt)),1))]),e("div",Bn,[e("span",{class:T(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",w(y)])},r(h(y)),3),e("span",{class:T(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getRuntimeStatusClass(y.id)])},[i.isSessionRunning(y.id)?(p(),f("span",An)):M("",!0),He(" "+r(i.getRuntimeStatusLabel(y.id)),1)],2),e("span",{class:T(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getThreadStatusClass(y)])},r(i.getThreadStatusLabel(y)),3)])])],10,Mn))),128))],2)],64))}},Nn={class:"space-y-3"},zn={class:"dashed-panel px-3 py-3"},On={class:"theme-muted-text text-[11px]"},Un={class:"mt-2 flex flex-wrap gap-2"},Hn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},qn={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},Vn={class:"dashed-panel px-3 py-3"},Wn={class:"theme-muted-text text-[11px]"},Kn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Gn={class:"dashed-panel px-3 py-3"},Qn={class:"theme-muted-text text-[11px]"},Xn={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},Jn={class:"dashed-panel px-3 py-3"},Yn={class:"theme-muted-text text-[11px]"},Zn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},es={class:"dashed-panel px-3 py-3"},ts={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},ns={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},ss={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(i){const{t:P}=ye();return(d,S)=>{var v,u,h,w,l,x,y;return p(),f("div",Nn,[e("div",zn,[e("div",On,r(a(P)("projectManager.runtimeStatus")),1),e("div",Un,[e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getRuntimeStatusClass((v=i.activeSession)==null?void 0:v.id)])},[i.isSessionRunning((u=i.activeSession)==null?void 0:u.id)?(p(),f("span",Hn)):M("",!0),He(" "+r(i.getRuntimeStatusLabel((h=i.activeSession)==null?void 0:h.id)),1)],2),e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getThreadStatusClass(i.activeSession)])},r(i.getThreadStatusLabel(i.activeSession)),3),(w=i.activeSession)!=null&&w.id&&i.isCurrentSession(i.activeSession.id)?(p(),f("span",qn,r(a(P)("projectManager.currentProject")),1)):M("",!0)])]),e("div",Vn,[e("div",Wn,r(a(P)("projectManager.engine")),1),e("div",Kn,r(a(Ce)((l=i.activeSession)==null?void 0:l.engine)),1)]),e("div",Gn,[e("div",Qn,r(a(P)("projectManager.workingDirectory")),1),e("div",Xn,r(((x=i.activeSession)==null?void 0:x.cwd)||a(P)("projectManager.notSet")),1)]),e("div",Jn,[e("div",Yn,r(a(P)("projectManager.updatedAt")),1),e("div",Zn,r(i.formatUpdatedAt((y=i.activeSession)==null?void 0:y.updatedAt)),1)]),e("div",es,[e("div",ts,[k(a(vt),{class:"h-3.5 w-3.5"}),e("span",null,r(a(P)("projectManager.note")),1)]),e("p",ns,r(a(P)("projectManager.noteDescription")),1)])])}}},as={class:"panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-auto sm:max-h-[88vh]"},is={class:"theme-divider flex flex-wrap items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},ls={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},os={class:"flex items-center gap-2"},rs=["disabled"],ds={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},cs={class:"theme-divider theme-muted-panel border-b px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},us={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},ps={class:"flex flex-wrap items-start justify-between gap-3"},ms={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},fs={class:"mt-5"},vs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},hs={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},gs={class:"flex flex-wrap items-center gap-2"},xs=["disabled"],ys={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},bs=["disabled"],ws=["disabled"],Ss=["disabled"],ks={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},_s={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},$s={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Cs={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},js={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Ms=["disabled"],Ps={class:"min-w-0 flex-1"},Ts={class:"theme-heading truncate text-sm font-medium"},Ls={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Rs={class:"theme-divider border-b px-4 py-3"},Ds={class:"grid grid-cols-2 gap-2"},Es=["disabled"],Fs={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Is={key:0},Bs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},As={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ns=["disabled"],zs=["disabled"],qs={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null}},emits:["close","project-created","select-session"],setup(i,{emit:P}){const d=i,S=P,{locale:v,t:u}=ye(),h=$("edit"),w=$(""),l=Ye({title:"",engine:"codex",cwd:""}),x=$(""),y=$(!1),A=$(!1),I=$(!1),L=$(!1),C=$(!1),{matches:E}=dt("(max-width: 767px)"),V=$("list"),D=$("basic"),O=$(Re()),Z=j(()=>K(d.sessions)),_=j(()=>d.sessions.find(t=>t.id===w.value)||null),ie=j(()=>d.sessions.length>0),je=j(()=>d.sessions.find(t=>t.id===d.selectedSessionId)||null),le=j(()=>!!(_.value&&B(_.value.id))),F=j(()=>{var t;return!((t=_.value)!=null&&t.started)}),Q=j(()=>{var t;return!((t=_.value)!=null&&t.started)}),R=j(()=>d.loading||y.value||A.value||I.value),oe=j(()=>{var b,g;const t=new Set,o=[];return[l.cwd,(b=_.value)==null?void 0:b.cwd,(g=je.value)==null?void 0:g.cwd,...d.workspaces,...d.sessions.map(G=>G.cwd)].forEach(G=>{const z=String(G||"").trim();!z||t.has(z)||(t.add(z),o.push(z))}),o.slice(0,12)}),ee=j(()=>O.value),re=j(()=>{const t=ce(l.cwd);return t?d.sessions.filter(o=>{var b;return o.id===((b=_.value)==null?void 0:b.id)?!1:ce(o.cwd)===t}):[]}),X=j(()=>{if(!re.value.length)return"";const t=re.value.slice(0,3).map(o=>{const b=o.title||u("projectManager.untitledProject");return v.value==="en-US"?`"${b}"`:`「${b}」`}).join(v.value==="en-US"?", ":"、");return u("projectManager.duplicateDirectory",{labels:t,count:re.value.length})}),be=j(()=>h.value!=="edit"||F.value?"":u("projectManager.cwdReadonly")),de=j(()=>h.value!=="edit"||!_.value||Q.value?"":u("projectManager.engineReadonly")),we=j(()=>h.value==="create"?y.value?u("projectManager.creatingProject"):u("projectManager.createProject"):A.value?u("projectManager.savingChanges"):u("projectManager.saveChanges")),Me=j(()=>{var t;return h.value==="create"?u("projectManager.newProject"):((t=_.value)==null?void 0:t.title)||u("projectManager.untitledProject")});function te(t=""){const o=Date.parse(String(t||""));return Number.isFinite(o)?o:0}function ce(t=""){const o=String(t||"").trim();if(!o)return"";const b=/^[a-z]:[\\/]/i.test(o)||o.includes("\\");let g=o.replace(/\\/g,"/");return g.length>1&&!/^[a-z]:\/$/i.test(g)&&(g=g.replace(/\/+$/,"")),b?g.toLowerCase():g}function B(t){var o;return!!((o=d.sessions.find(b=>b.id===t))!=null&&o.running)}function W(t){return!!t&&t===d.selectedSessionId}function K(t=[]){return[...t].sort((o,b)=>{const g=Number(B(b.id))-Number(B(o.id));if(g)return g;const G=Number(W(b.id))-Number(W(o.id));if(G)return G;const z=te(b.updatedAt)-te(o.updatedAt);return z||et(String(o.title||o.cwd||o.id),String(b.title||b.cwd||b.id))})}function ne(t){return B(t)?u("projectManager.running"):u("projectManager.idle")}function ue(t){return B(t)?"theme-status-warning":"theme-status-success"}function se(t){return t!=null&&t.started?u("projectManager.threadBound"):u("projectManager.notStarted")}function pe(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function me(t=""){if(!t)return u("projectManager.unknown");const o=new Date(t);return Number.isNaN(o.getTime())?t:Ze(o.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Se(t){l.title=String((t==null?void 0:t.title)||""),l.engine=Le(t==null?void 0:t.engine),l.cwd=String((t==null?void 0:t.cwd)||"")}function ae(){h.value="create",w.value="",x.value="",l.title="",l.engine="codex",l.cwd=""}function U(t){const o=d.sessions.find(b=>b.id===t);o&&(h.value="edit",w.value=o.id,x.value="",Se(o))}function fe(){var t;return d.selectedSessionId&&d.sessions.some(o=>o.id===d.selectedSessionId)?d.selectedSessionId:((t=Z.value[0])==null?void 0:t.id)||""}function ke(t="basic"){V.value="detail",D.value=t}function J(){V.value="list",D.value="basic"}function n(){ae(),E.value&&ke("basic")}function c(t){R.value||(U(t),E.value&&ke("basic"))}function s(t){l.cwd=String(t||"").trim()}function m(t){l.title=String(t||"")}function N(t){l.engine=Le(t)}function H(t){l.cwd=String(t||"")}function _e(){x.value="",L.value=!1,D.value="basic",V.value=E.value?"list":"detail";const t=fe();if(t){U(t);return}ae()}function q(t){!d.open||R.value||t.key==="Escape"&&S("close")}async function Y(){if(!(R.value||typeof d.onRefresh!="function")){x.value="";try{await Promise.all([d.onRefresh(),De()])}catch(t){x.value=t.message}}}async function De(){try{O.value=await gt()}catch{O.value=Re()}}async function Ee(){if(!R.value){x.value="";try{const t=Ve();if(!t)return;await We(t)}catch(t){x.value=t.message}}}function Ve(){if(h.value==="create"){const o=String(l.cwd||"").trim();return o?{type:"create",cwd:o,payload:{title:l.title,engine:l.engine,cwd:o}}:(x.value=u("projectManager.directoryRequired"),null)}if(!_.value)return x.value=u("projectManager.projectMissing"),null;const t={title:l.title,engine:l.engine};return F.value&&(t.cwd=l.cwd),{type:"update",sessionId:_.value.id,payload:t}}async function We(t){var o,b;if(t.type==="create"){y.value=!0;try{const g=await((o=d.onCreate)==null?void 0:o.call(d,t.payload));g!=null&&g.id&&(U(g.id),S("select-session",g.id),await tt(),S("project-created",g),S("close"));return}finally{y.value=!1}}A.value=!0;try{const g=await((b=d.onUpdate)==null?void 0:b.call(d,t.sessionId,t.payload));g!=null&&g.id&&U(g.id)}finally{A.value=!1}}async function Ke(){var o,b;if(!_.value||I.value)return;const t=_.value.id;x.value="",I.value=!0;try{const g=await((o=d.onDelete)==null?void 0:o.call(d,t));L.value=!1;const G=d.sessions.filter(Ge=>Ge.id!==t),z=(g==null?void 0:g.selectedSessionId)||((b=K(G)[0])==null?void 0:b.id)||"";S("select-session",z),z?(U(z),E.value&&J()):(ae(),E.value&&J())}catch(g){x.value=g.message}finally{I.value=!1}}return he(()=>d.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",q),_e(),typeof d.onRefresh=="function"?Y().catch(()=>{}):De().catch(()=>{});return}window.removeEventListener("keydown",q),C.value=!1,L.value=!1,x.value=""},{immediate:!0}),he(E,t=>{t||(V.value="detail")},{immediate:!0}),he(()=>d.sessions,()=>{if(!d.open)return;if(h.value==="create"){if(!!(String(l.title||"").trim()||String(l.cwd||"").trim()))return;const b=fe();b&&U(b);return}if(_.value){Se(_.value);return}const t=fe();if(t){U(t);return}ae()}),Oe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",q)}),(t,o)=>{var b;return p(),ge(Ue,{to:"body"},[i.open?(p(),f("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-50 flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:o[10]||(o[10]=Te(g=>!R.value&&S("close"),["self"]))},[e("section",as,[k(ct,{open:L.value,title:a(u)("projectManager.confirmDeleteTitle"),description:_.value?a(u)("projectManager.confirmDeleteDescription",{title:_.value.title||a(u)("projectManager.untitledProject")}):"","confirm-text":a(u)("projectManager.confirmDelete"),"cancel-text":a(u)("projectManager.keep"),loading:I.value,danger:"",onCancel:o[0]||(o[0]=g=>L.value=!1),onConfirm:Ke},null,8,["open","title","description","confirm-text","cancel-text","loading"]),k(nn,{open:C.value,"initial-path":l.cwd,suggestions:oe.value,onClose:o[1]||(o[1]=g=>C.value=!1),onSelect:s},null,8,["open","initial-path","suggestions"]),e("div",is,[e("div",null,[e("div",ls,[k(a(ut),{class:"h-4 w-4"}),e("span",null,r(a(u)("projectManager.managingTitle")),1)])]),e("div",os,[e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:R.value,onClick:o[2]||(o[2]=g=>S("close"))},[k(a(qe),{class:"h-4 w-4"})],8,rs)])]),a(E)?(p(),f("div",ks,[V.value==="list"?(p(),f("div",_s,[e("div",$s,[k(ze,{mobile:"",busy:R.value,"editing-session-id":w.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"has-sessions":ie.value,"is-current-session":W,"is-session-running":B,mode:h.value,sessions:Z.value,onCreate:n,onSelect:c},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),f("div",Cs,[e("div",js,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:R.value,onClick:J},[k(a(ft),{class:"h-4 w-4"}),e("span",null,r(a(u)("projectManager.projectList")),1)],8,Ms),e("div",Ps,[e("div",Ts,r(Me.value),1),h.value==="edit"&&((b=_.value)!=null&&b.cwd)?(p(),f("p",Ls,r(_.value.cwd),1)):M("",!0)])]),e("div",Rs,[e("div",Ds,[e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",D.value==="basic"?"tool-button-accent-subtle":""]),onClick:o[6]||(o[6]=g=>D.value="basic")},r(a(u)("projectManager.basicInfo")),3),e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",D.value==="status"?"tool-button-accent-subtle":""]),disabled:h.value==="create",onClick:o[7]||(o[7]=g=>D.value="status")},r(a(u)("projectManager.status")),11,Es)])]),e("div",Fs,[D.value==="basic"?(p(),f("div",Is,[k(Ne,{mobile:"",busy:R.value,"can-edit-engine":h.value!=="edit"||Q.value,"can-edit-cwd":h.value!=="edit"||F.value,cwd:l.cwd,"cwd-readonly-message":be.value,"duplicate-cwd-message":X.value,engine:l.engine,"engine-options":ee.value,"engine-readonly-message":de.value,title:l.title,"workspace-suggestions":oe.value,onOpenDirectoryPicker:o[8]||(o[8]=g=>C.value=!0),"onUpdate:cwd":H,"onUpdate:engine":N,"onUpdate:title":m},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"]),x.value?(p(),f("p",Bs,[k(a(Ae),{class:"h-4 w-4"}),e("span",null,r(x.value),1)])):M("",!0),e("div",As,[e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:R.value,onClick:Ee},r(we.value),9,Ns),h.value==="edit"&&_.value?(p(),f("button",{key:0,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:R.value||le.value,onClick:o[9]||(o[9]=g=>L.value=!0)},r(I.value?a(u)("projectManager.deletingProject"):a(u)("projectManager.deleteProject")),9,zs)):M("",!0)])])):(p(),ge(ss,{key:1,"active-session":_.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"is-current-session":W,"is-session-running":B},null,8,["active-session"]))])]))])):(p(),f("div",ds,[e("aside",cs,[k(ze,{busy:R.value,"editing-session-id":w.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"has-sessions":ie.value,"is-current-session":W,"is-session-running":B,mode:h.value,sessions:Z.value,onCreate:n,onSelect:c},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),e("div",us,[e("div",ps,[e("div",null,[e("div",ms,[k(a(pt),{class:"h-4 w-4"}),e("span",null,r(h.value==="create"?a(u)("projectManager.createTitle"):a(u)("projectManager.editTitle")),1)])])]),e("div",fs,[k(Ne,{busy:R.value,"can-edit-engine":h.value!=="edit"||Q.value,"can-edit-cwd":h.value!=="edit"||F.value,cwd:l.cwd,"cwd-readonly-message":be.value,"duplicate-cwd-message":X.value,engine:l.engine,"engine-options":ee.value,"engine-readonly-message":de.value,title:l.title,"workspace-suggestions":oe.value,onOpenDirectoryPicker:o[3]||(o[3]=g=>C.value=!0),"onUpdate:cwd":H,"onUpdate:engine":N,"onUpdate:title":m},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"])]),x.value?(p(),f("p",vs,[k(a(Ae),{class:"h-4 w-4"}),e("span",null,r(x.value),1)])):M("",!0),e("div",hs,[e("div",gs,[h.value==="edit"&&_.value?(p(),f("button",{key:0,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:R.value||le.value,onClick:o[4]||(o[4]=g=>L.value=!0)},[k(a(mt),{class:"h-4 w-4"}),e("span",null,r(I.value?a(u)("projectManager.deletingProject"):a(u)("projectManager.deleteProject")),1)],8,xs)):M("",!0)]),e("div",ys,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:o[5]||(o[5]=g=>S("close"))},r(a(u)("projectManager.close")),9,bs),h.value==="create"&&ie.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:_e},r(a(u)("projectManager.backToList")),9,ws)):M("",!0),e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:Ee},r(we.value),9,Ss)])])])]))])])):M("",!0)])}}};export{qs as default};
@@ -1,12 +0,0 @@
1
- import{w as H,E as Je,i as M,s as P,x as S,D as Ue,v as Qe,a as c,b as v,d as a,F as Z,r as Se,n as F,t as r,e as k,u as t,y as Te,z as Xe,f as D,j as Re,c as je,B as $e,G as Ye,O as He,o as Ze,g as et,T as tt}from"./index-CPEYh7Do.js";import{c as qe,u as st,g as Le,l as at,S as nt,C as Ae,a as Ie,b as it,d as lt,_ as ot,e as rt,F as We,f as Ne,X as dt}from"./WorkbenchView-C2MWZt4p.js";/**
2
- * @license lucide-vue-next v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Be=qe("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);/**
7
- * @license lucide-vue-next v0.577.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Ve=qe("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function X(e,n,d=""){const u=n==="run"?"run":n==="task"?"task":"workspace";return[String(e||"").trim(),u,String(d||"").trim()].join("::")}function ut(e="",n=""){return`${String(e||"").trim()}::${String(n||"").trim()}`}function Ge(e){if(!e||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function ke(e,n){const d=e.get(n);return d?(e.delete(n),e.set(n,d),Ge(d)):null}function Pe(e,n,d,u=0){for(e.delete(n),e.set(n,Ge(d));u>0&&e.size>u;){const l=e.keys().next().value;if(typeof l>"u")break;e.delete(l)}}function Y(e=""){const n=String(e||"").trim().toUpperCase();return n==="A"||n==="D"?n:"M"}function ct(e=""){const n=String(e||"");if(!n)return[];const d=n.split(`
12
- `),u=[];let l=0,x=0;return d.forEach((g,o)=>{const b=g.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(b){l=Number(b[1]),x=Number(b[2]),u.push({id:`hunk-${o}`,kind:"hunk",oldNumber:"",newNumber:"",content:g});return}if(g.startsWith("+")&&!g.startsWith("+++")){u.push({id:`line-${o}`,kind:"add",oldNumber:"",newNumber:x,content:g}),x+=1;return}if(g.startsWith("-")&&!g.startsWith("---")){u.push({id:`line-${o}`,kind:"delete",oldNumber:l,newNumber:"",content:g}),l+=1;return}if(g.startsWith(" ")){u.push({id:`line-${o}`,kind:"context",oldNumber:l,newNumber:x,content:g}),l+=1,x+=1;return}u.push({id:`line-${o}`,kind:"meta",oldNumber:"",newNumber:"",content:g})}),u}function ft(e=""){const n=String(e||"").trim();if(!n)return"";const d=n.match(/^当前分支已从 (.+) 切换到 (.+)$/);return d?S("diffReview.warningBranchChanged",{from:d[1],to:d[2]}):n==="当前 HEAD 已不在基线 commit 的后续历史中,仓库可能经历了 reset、rebase 或切分支"?S("diffReview.warningHeadDetachedFromBaseline"):n}function ze(e=""){const n=String(e||"").trim();if(!n)return"";const u=new Map([["二进制文件暂不支持在线 diff 预览。","diffReview.binaryPreviewUnavailable"],["文件内容较大,暂不展示具体 diff。","diffReview.fileTooLarge"],["diff 内容较长,暂不在页面内完整展示。","diffReview.diffTooLong"],["当前工作目录不是 Git 仓库,暂不支持代码变更审查。","diffReview.notGitRepo"],["任务不存在。","diffReview.taskNotFound"],["请选择一轮执行后再查看本轮代码变更。","diffReview.runRequired"],["没有找到对应的执行记录。","diffReview.runNotFound"],["这轮执行还没有建立代码变更基线,暂时无法查看本轮 diff。","diffReview.runBaselineMissing"],["当前任务还没有建立代码变更基线,请先让 Codex 执行一轮。","diffReview.taskBaselineMissing"],["这轮执行缺少结束快照,暂时无法准确还原本轮代码变更。","diffReview.runSnapshotMissing"],["原工作目录已不是有效的 Git 仓库,暂时无法读取代码变更。","diffReview.originalRepoInvalid"],["基线对应的 commit 已不存在,仓库可能被 reset、rebase 或切换到无关历史,暂时无法准确读取该范围的代码变更。","diffReview.baselineCommitMissing"]]).get(n);return u?S(u):n}function _e(e=null){return!e||typeof e!="object"?e:{...e,reason:ze(e.reason),warnings:Array.isArray(e.warnings)?e.warnings.map(n=>ft(n)).filter(Boolean):[],files:Array.isArray(e.files)?e.files.map(n=>({...n,message:ze(n==null?void 0:n.message)})):[]}}function ht(e){const n=P("workspace"),d=P(""),u=P(""),l=P("all"),x=P(""),g=P([]),o=P(null),b=P(!1),_=P(!1),y=P(""),B=P(!1),ie=P(null),ee=P(0),V=new Map,O=st();let G=0,te=0,$="",j="",E="",A=-1;const U=new Map,se=new Map,le=new Map,ae=M(()=>g.value.filter(s=>s.completed)),de=M(()=>{var i;const s={all:0,A:0,M:0,D:0};return(((i=o.value)==null?void 0:i.files)||[]).forEach(h=>{const p=Y(h==null?void 0:h.status);s.all+=1,s[p]+=1}),s}),K=M(()=>{var h;const s=((h=o.value)==null?void 0:h.files)||[],i=String(x.value||"").trim().toLowerCase();return s.filter(p=>l.value!=="all"&&Y(p==null?void 0:p.status)!==l.value?!1:i?String((p==null?void 0:p.path)||"").toLowerCase().includes(i):!0)}),oe=M(()=>{const s=K.value;return s.find(i=>i.path===u.value)||s[0]||null}),re=M(()=>{var s;return ct(((s=oe.value)==null?void 0:s.patch)||"")}),I=M(()=>re.value.map((s,i)=>({...s,index:i})).filter(s=>s.kind==="hunk")),ue=M(()=>{var s,i;return _.value&&!((i=(s=o.value)==null?void 0:s.summary)!=null&&i.statsComplete)}),J=M(()=>{var h;const s=((h=o.value)==null?void 0:h.baseline)||null;if(!(s!=null&&s.createdAt)&&!(s!=null&&s.headShort))return"";const i=[];return s.createdAt&&i.push(S("diffReview.baselineTime",{value:Ue(s.createdAt)})),s.branch&&i.push(S("diffReview.baselineBranch",{value:s.branch})),s.headShort&&i.push(S("diffReview.baselineCommit",{value:s.headShort})),s.currentHeadShort&&i.push(S("diffReview.currentHead",{value:s.currentHeadShort})),i.join(" · ")});function T(s){return(s==null?void 0:s.status)==="completed"?S("diffReview.completed"):(s==null?void 0:s.status)==="error"?S("diffReview.failed"):(s==null?void 0:s.status)==="interrupted"?S("diffReview.interrupted"):S("diffReview.stopped")}function w(s,i){if(s){if(i){V.set(s,i);return}V.delete(s)}}function ce(s,i={}){const h=I.value;if(!h.length)return;const p=Math.min(Math.max(0,Number(s)||0),h.length-1),L=h[p],R=V.get(L.id);R&&(ee.value=p,R.scrollIntoView({block:i.block||"center",behavior:i.behavior||"smooth"}))}function fe(s=1){I.value.length&&ce(ee.value+s)}function N(s){return`${new Date((s==null?void 0:s.startedAt)||(s==null?void 0:s.createdAt)).toLocaleString(Je())} · ${T(s)}`}function f(){const s=ae.value;if(!s.length){d.value="";return}s.some(i=>i.id===d.value)||(d.value=s[0].id)}function Q(){const s=K.value;if(!s.length){u.value="";return}s.some(i=>i.path===u.value)||(u.value=s[0].path)}function he(s=""){return Y(s)==="A"?S("diffReview.added"):Y(s)==="D"?S("diffReview.deleted"):S("diffReview.modified")}function me(s=""){return Y(s)==="A"?"theme-status-success":Y(s)==="D"?"theme-status-danger":"theme-status-warning"}function ve(s="all"){return s==="A"?S("diffReview.added"):s==="D"?S("diffReview.deleted"):s==="M"?S("diffReview.modified"):S("diffReview.all")}function pe(s="all"){return l.value===s?"theme-filter-active":"theme-filter-idle"}function m(s="context"){return s==="add"?"theme-patch-add":s==="delete"?"theme-patch-delete":s==="hunk"?"theme-patch-hunk":s==="meta"?"theme-patch-meta":"theme-patch-context"}async function ge(){if(!e.taskSlug){g.value=[],d.value="",E="",A=-1;return}const s=O.getTaskRunSyncVersion(e.taskSlug);if(E===e.taskSlug&&A===s)return;const i=await at(e.taskSlug,{limit:20,events:"none"});g.value=i.items||[],E=e.taskSlug,A=s,f()}async function xe(){if(!e.taskSlug||!e.active)return;const s=++G;b.value=!0,_.value=!1,y.value="";try{const i=n.value==="run"?"run":n.value==="task"?"task":"workspace";i==="run"&&await ge();const h=X(e.taskSlug,i,i==="run"?d.value:"");if(i==="run"&&!d.value){o.value={supported:!1,reason:S("diffReview.noReviewRuns"),repoRoot:"",summary:{fileCount:0,additions:0,deletions:0,statsComplete:!0},files:[]},Q();return}const p=ke(U,h);if(p){o.value=p,$=h;const C=ke(se,h);C?(o.value={...p,baseline:C.baseline||p.baseline||null,warnings:C.warnings||p.warnings||[],summary:C.summary||p.summary},j=h):j="",Q(),ye().catch(()=>{}),C||Me().catch(()=>{});return}const L=await Le(e.taskSlug,{scope:i,runId:i==="run"?d.value:"",includeStats:!1});if(s!==G)return;const R=_e(L);o.value=R,Pe(U,h,R,36),$=h,j="",Q(),ye().catch(()=>{}),Me().catch(()=>{})}catch(i){if(s!==G)return;y.value=i.message,o.value=null}finally{s===G&&(b.value=!1)}}async function Me(){var L,R,C;if(!e.taskSlug||!e.active||!((L=o.value)!=null&&L.supported))return;const s=n.value==="run"?"run":n.value==="task"?"task":"workspace",i=s==="run"?d.value:"",h=X(e.taskSlug,s,i);if(j===h&&((C=(R=o.value)==null?void 0:R.summary)!=null&&C.statsComplete))return;const p=ke(se,h);if(p){o.value={...o.value,baseline:p.baseline||o.value.baseline||null,warnings:p.warnings||o.value.warnings||[],summary:p.summary||o.value.summary},j=h,_.value=!1;return}_.value=!0;try{const q=await Le(e.taskSlug,{scope:s,runId:i,includeFiles:!1,includeStats:!0}),ne=X(e.taskSlug,n.value,n.value==="run"?d.value:"");if(h!==ne||!o.value)return;const z=_e(q);o.value={...o.value,baseline:z.baseline||o.value.baseline||null,warnings:z.warnings||o.value.warnings||[],summary:z.summary||o.value.summary},Pe(se,h,{baseline:z.baseline||null,warnings:z.warnings||[],summary:z.summary||null},36),j=h}catch{}finally{const q=X(e.taskSlug,n.value,n.value==="run"?d.value:"");h===q&&(_.value=!1)}}async function ye(){var ne,z,De;const s=String(u.value||"").trim();if(!e.taskSlug||!e.active||!s||B.value)return;const i=n.value==="run"?"run":n.value==="task"?"task":"workspace",h=i==="run"?d.value:"",p=X(e.taskSlug,i,h),L=(((ne=o.value)==null?void 0:ne.files)||[]).find(W=>W.path===s);if(!L||L.patchLoaded||L.binary||L.tooLarge||L.message)return;const R=ut(p,s),C=ke(le,R);if(C&&((z=o.value)!=null&&z.files)){o.value={...o.value,files:o.value.files.map(W=>W.path===s?C:W)};return}const q=++te;B.value=!0;try{const W=await Le(e.taskSlug,{scope:i,runId:h,filePath:s});if(q!==te)return;const Ke=X(e.taskSlug,n.value,n.value==="run"?d.value:"");if(p!==Ke)return;const Ce=_e(W),Fe=(Ce.files||[]).find(we=>we.path===s);if(!Fe||!((De=o.value)!=null&&De.files))return;Pe(le,R,Fe,120),o.value={...o.value,baseline:Ce.baseline||o.value.baseline||null,warnings:Ce.warnings||o.value.warnings||[],files:o.value.files.map(we=>we.path===s?Fe:we)}}catch(W){y.value=W.message}finally{q===te&&(B.value=!1,String(u.value||"").trim()!==s&&ye().catch(()=>{}))}}function be({force:s=!1}={}){if(!e.taskSlug||!e.active)return;const i=X(e.taskSlug,n.value,n.value==="run"?d.value:"");!s&&i===$||xe().catch(()=>{})}return H(()=>[e.taskSlug,e.active,n.value,d.value],([s,i],h=[])=>{const p=h[0]||"";s!==p&&(u.value="",$="",g.value=[],d.value="",E="",A=-1,j=""),!(!s||!i)&&be()},{immediate:!0}),H(()=>{var s,i;return[l.value,((i=(s=o.value)==null?void 0:s.files)==null?void 0:i.length)||0]},()=>{Q()}),H(()=>[u.value,I.value.length],()=>{ee.value=0,V.clear(),Qe(()=>{var s,i;I.value.length?ce(0,{behavior:"auto",block:"start"}):(i=(s=ie.value)==null?void 0:s.scrollTo)==null||i.call(s,{top:0,behavior:"auto"})})}),H(()=>u.value,()=>{ye().catch(()=>{})},{immediate:!0}),H(()=>[e.preferredScope,e.preferredRunId,e.focusToken],([s,i,h],p=[])=>{const L=Number(p[2]||0),R=s==="run"?"run":s==="task"?"task":"workspace",C=R==="run"&&i?String(i||""):"",q=n.value!==R,ne=R==="run"&&C&&d.value!==C;n.value=R,C&&(d.value=C),R!=="run"&&(d.value=""),!q&&!ne&&e.active&&e.taskSlug&&h!==L&&($="",be())},{immediate:!0}),H(()=>O.readyVersion.value,()=>{!e.active||!e.taskSlug||(E="",A=-1,$="",j="",be({force:!0}))}),H(()=>O.getTaskDiffSyncVersion(e.taskSlug),()=>{!e.active||!e.taskSlug||(E="",A=-1,j="",$="",be({force:!0}))}),{activeHunkIndex:ee,baselineMetaText:J,diffPayload:o,diffScope:n,error:y,fileSearch:x,filteredFiles:K,getFilterButtonClass:pe,getFilterLabel:ve,getPatchLineClass:m,getRunStatusLabel:T,getStatusClass:me,getStatusLabel:he,jumpToAdjacentHunk:fe,loadDiff:xe,loading:b,normalizeFileStatus:Y,patchLoading:B,patchViewportRef:ie,runs:g,selectedFile:oe,selectedFilePath:u,selectedPatchHunks:I,selectedPatchLines:re,selectedRunId:d,setPatchLineRef:w,showSummarySkeleton:ue,statsLoading:_,statusCounts:de,statusFilter:l,terminalRuns:ae,formatRunOptionLabel:N}}const mt={class:"mb-3 grid grid-cols-2 gap-2"},vt=["onClick"],pt={class:"theme-input-shell mb-3 flex items-center gap-2 rounded-sm border px-3 py-2 text-xs text-[var(--theme-textMuted)]"},gt=["placeholder"],xt={key:0,class:"theme-empty-state theme-empty-state-strong mb-3 px-3 py-2 text-[11px]"},yt={key:1,class:"theme-empty-state px-3 py-4 text-xs"},bt={key:2,class:"theme-empty-state px-3 py-4 text-xs"},wt={key:3,class:"space-y-2"},kt=["onClick"],St={class:"flex items-start gap-2"},Rt={class:"min-w-0 flex-1"},Ct={class:"break-all text-xs font-medium"},Ft={class:"mt-1 text-[11px] opacity-75"},Oe={__name:"TaskDiffFileList",props:{diffPayload:{type:Object,default:null},fileSearch:{type:String,default:""},filteredFiles:{type:Array,default:()=>[]},getFilterButtonClass:{type:Function,default:()=>""},getFilterLabel:{type:Function,default:e=>e},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},selectedFilePath:{type:String,default:""},showSummarySkeleton:{type:Boolean,default:!1},statusCounts:{type:Object,default:()=>({})},statusFilter:{type:String,default:"all"}},emits:["select-file","update:fileSearch","update:statusFilter"],setup(e,{emit:n}){const d=e,u=n,{t:l}=Re(),x=M({get:()=>d.fileSearch,set:b=>u("update:fileSearch",b)}),g=M({get:()=>d.statusFilter,set:b=>u("update:statusFilter",b)}),o=M(()=>{var b;return Array.isArray((b=d.diffPayload)==null?void 0:b.files)&&d.diffPayload.files.length>0});return(b,_)=>(c(),v(Z,null,[a("div",mt,[(c(),v(Z,null,Se(["all","A","M","D"],y=>a("button",{key:y,type:"button",class:F(["inline-flex w-full items-center justify-center gap-1 whitespace-nowrap rounded-sm border px-2 py-1 text-[11px] transition",e.getFilterButtonClass(y)]),onClick:B=>g.value=y},r(e.getFilterLabel(y))+" "+r(e.statusCounts[y]||0),11,vt)),64))]),a("label",pt,[k(t(nt),{class:"h-3.5 w-3.5 shrink-0"}),Te(a("input",{"onUpdate:modelValue":_[0]||(_[0]=y=>x.value=y),type:"text",placeholder:t(l)("diffReview.searchFilePath"),class:"min-w-0 flex-1 bg-transparent text-xs text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,8,gt),[[Xe,x.value]])]),e.showSummarySkeleton?(c(),v("div",xt,r(t(l)("diffReview.statsPending")),1)):D("",!0),o.value?e.filteredFiles.length?(c(),v("div",wt,[(c(!0),v(Z,null,Se(e.filteredFiles,y=>(c(),v("button",{key:y.path,type:"button",class:F(["w-full rounded-sm border px-3 py-2 text-left transition",y.path===e.selectedFilePath?"theme-filter-active":"theme-filter-idle"]),onClick:B=>u("select-file",y.path)},[a("div",St,[a("span",{class:F(["inline-flex shrink-0 rounded-sm border px-1.5 py-0.5 text-[10px]",e.getStatusClass(y.status)])},r(e.getStatusLabel(y.status)),3),a("div",Rt,[a("div",Ct,r(y.path),1),a("div",Ft,r(y.statsLoaded?`+${y.additions} / -${y.deletions}`:t(l)("diffReview.statsOnDemand")),1)])])],10,kt))),128))])):(c(),v("div",bt,r(t(l)("diffReview.noMatches")),1)):(c(),v("div",yt,r(t(l)("diffReview.noChanges")),1))],64))}},$t={key:0,class:"flex h-full min-h-0 flex-col overflow-hidden"},Lt={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-xs"},Pt={class:"space-y-3 sm:hidden"},_t={class:"flex items-start gap-2"},Tt={class:"min-w-0 break-all font-medium text-[var(--theme-textPrimary)]"},jt={class:"flex items-center justify-between gap-3"},Mt={class:"opacity-75"},Dt=["disabled"],Ht={class:"min-w-[64px] text-center text-[11px] text-[var(--theme-textSecondary)]"},At=["disabled"],It={class:"hidden items-center gap-3 sm:flex"},Nt={class:"flex min-w-0 flex-1 flex-wrap items-center gap-2"},Bt={class:"break-all font-medium text-[var(--theme-textPrimary)]"},Vt={class:"opacity-75"},zt=["disabled"],Ot={class:"min-w-[64px] text-center text-[11px] text-[var(--theme-textSecondary)]"},Et=["disabled"],Ut={key:0,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-sm"},qt={class:"theme-empty-state px-4 py-4"},Wt={key:1,class:"theme-muted-text flex-1 overflow-y-auto px-4 py-4 text-sm"},Gt={class:"min-w-max px-4 py-4 font-mono text-[11px] leading-5"},Kt={class:"select-none border-r border-[var(--theme-borderMuted)] px-2 py-0.5 text-right opacity-60"},Jt={class:"select-none border-r border-[var(--theme-borderMuted)] px-2 py-0.5 text-right opacity-60"},Qt={class:"overflow-visible whitespace-pre px-3 py-0.5"},Xt={key:3,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-sm"},Yt={class:"theme-empty-state px-4 py-4"},Zt={key:1,class:"theme-muted-text flex h-full items-center justify-center px-5 text-sm"},Ee={__name:"TaskDiffPatchView",props:{activeHunkIndex:{type:Number,default:0},getPatchLineClass:{type:Function,default:()=>""},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},jumpToAdjacentHunk:{type:Function,default:()=>{}},patchLoading:{type:Boolean,default:!1},selectedFile:{type:Object,default:null},selectedPatchHunks:{type:Array,default:()=>[]},selectedPatchLines:{type:Array,default:()=>[]},setPatchLineRef:{type:Function,default:()=>{}},setPatchViewportRef:{type:Function,default:()=>{}}},setup(e){const{t:n}=Re();return(d,u)=>e.selectedFile?(c(),v("div",$t,[a("div",Lt,[a("div",Pt,[a("div",_t,[a("span",{class:F(["inline-flex shrink-0 rounded-sm border px-1.5 py-0.5 text-[10px]",e.getStatusClass(e.selectedFile.status)])},r(e.getStatusLabel(e.selectedFile.status)),3),a("span",Tt,r(e.selectedFile.path),1)]),a("div",jt,[a("span",Mt,r(e.selectedFile.statsLoaded?`+${e.selectedFile.additions} / -${e.selectedFile.deletions}`:t(n)("diffReview.statsOnDemand")),1),a("div",{class:F(["inline-flex h-8 shrink-0 items-center gap-1 rounded-sm border px-1.5 py-1",e.selectedPatchHunks.length?"theme-inline-panel":"pointer-events-none invisible border-transparent"])},[a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex<=0,onClick:u[0]||(u[0]=l=>e.jumpToAdjacentHunk(-1))},[k(t(Ae),{class:"h-4 w-4"})],8,Dt),a("span",Ht,r(t(n)("diffReview.changeIndex",{current:Math.min(e.activeHunkIndex+1,e.selectedPatchHunks.length),total:e.selectedPatchHunks.length})),1),a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex>=e.selectedPatchHunks.length-1,onClick:u[1]||(u[1]=l=>e.jumpToAdjacentHunk(1))},[k(t(Ie),{class:"h-4 w-4"})],8,At)],2)])]),a("div",It,[a("div",Nt,[a("span",{class:F(["inline-flex rounded-sm border px-1.5 py-0.5 text-[10px]",e.getStatusClass(e.selectedFile.status)])},r(e.getStatusLabel(e.selectedFile.status)),3),a("span",Bt,r(e.selectedFile.path),1),a("span",Vt,r(e.selectedFile.statsLoaded?`+${e.selectedFile.additions} / -${e.selectedFile.deletions}`:t(n)("diffReview.statsOnDemand")),1)]),a("div",{class:F(["inline-flex h-8 w-[132px] shrink-0 items-center gap-1 rounded-sm border px-1.5 py-1",e.selectedPatchHunks.length?"theme-inline-panel":"pointer-events-none invisible border-transparent"])},[a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex<=0,onClick:u[2]||(u[2]=l=>e.jumpToAdjacentHunk(-1))},[k(t(Ae),{class:"h-4 w-4"})],8,zt),a("span",Ot,r(t(n)("diffReview.changeIndex",{current:Math.min(e.activeHunkIndex+1,e.selectedPatchHunks.length),total:e.selectedPatchHunks.length})),1),a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex>=e.selectedPatchHunks.length-1,onClick:u[3]||(u[3]=l=>e.jumpToAdjacentHunk(1))},[k(t(Ie),{class:"h-4 w-4"})],8,Et)],2)])]),e.selectedFile.message?(c(),v("div",Ut,[a("div",qt,r(e.selectedFile.message),1)])):e.patchLoading&&!e.selectedFile.patchLoaded?(c(),v("div",Wt,r(t(n)("diffReview.loadingFileDiff")),1)):e.selectedPatchLines.length?(c(),v("div",{key:2,ref:e.setPatchViewportRef,class:"flex-1 overflow-auto"},[a("div",Gt,[(c(!0),v(Z,null,Se(e.selectedPatchLines,l=>{var x;return c(),v("div",{key:l.id,ref_for:!0,ref:g=>e.setPatchLineRef(l.id,g),class:F(["grid grid-cols-[56px_56px_minmax(0,1fr)]",[e.getPatchLineClass(l.kind),l.kind==="hunk"&&((x=e.selectedPatchHunks[e.activeHunkIndex])==null?void 0:x.id)===l.id?"ring-1 ring-inset ring-[var(--theme-warning)]":""]])},[a("span",Kt,r(l.oldNumber),1),a("span",Jt,r(l.newNumber),1),a("pre",Qt,r(l.content),1)],2)}),128))])],512)):(c(),v("div",Xt,[a("div",Yt,r(t(n)("diffReview.noFileDiffContent")),1)]))])):(c(),v("div",Zt,r(t(n)("diffReview.selectFile")),1))}},es={class:"panel flex h-full min-h-0 flex-col overflow-hidden"},ts={class:"theme-divider border-b px-4 py-3"},ss={class:"flex flex-col gap-2"},as={class:"grid grid-cols-4 gap-2 sm:flex sm:flex-wrap sm:items-center"},ns={class:"sm:hidden"},is={class:"hidden sm:inline"},ls={class:"sm:hidden"},os={class:"hidden sm:inline"},rs=["disabled"],ds={class:"sm:hidden"},us={class:"hidden sm:inline"},cs={class:"truncate text-xs text-[var(--theme-textPrimary)]"},fs={class:"theme-divider theme-muted-text border-b border-dashed px-3 py-2 text-[11px]"},hs=["onClick"],ms={class:"flex items-start gap-3"},vs={class:"min-w-0 flex-1"},ps={class:"truncate text-xs font-medium text-[var(--theme-textPrimary)]"},gs={class:"theme-muted-text mt-1 text-[11px]"},xs={key:0,class:"theme-divider theme-danger-text border-b px-4 py-3 text-sm"},ys={class:"inline-flex items-start gap-2"},bs={class:"break-all"},ws={key:1,class:"theme-muted-text flex flex-1 items-center justify-center px-5 text-sm"},ks={key:2,class:"flex flex-1 items-center justify-center px-5"},Ss={class:"theme-empty-state w-full max-w-xl px-4 py-5 text-sm text-[var(--theme-textSecondary)]"},Rs={class:"theme-heading inline-flex items-center gap-2 font-medium"},Cs={class:"mt-2 break-all leading-7"},Fs={key:0,class:"mt-3 flex flex-wrap gap-2 text-xs"},$s={class:"theme-status-neutral inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},Ls={class:"break-all"},Ps={key:0,class:"theme-status-success inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},_s={key:3,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ts={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-xs"},js={class:"flex flex-wrap items-center gap-2"},Ms={key:0,class:"theme-status-info inline-flex min-w-0 items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},Ds={class:"min-w-0 break-all"},Hs={class:"theme-status-success inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},As={class:"text-[var(--theme-textPrimary)]"},Is={class:"font-medium text-[var(--theme-success)]"},Ns={class:"font-medium text-[var(--theme-danger)]"},Bs={key:2,class:"opacity-75"},Vs={key:0,class:"mt-2 break-all text-[11px] opacity-75"},zs={key:1,class:"mt-2 flex flex-col gap-1"},Os={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Es={class:"theme-divider border-b px-3 py-3"},Us={class:"grid grid-cols-2 gap-2"},qs=["disabled"],Ws={class:"theme-divider theme-muted-panel min-h-0 flex-1 overflow-y-auto p-3"},Gs={class:"min-h-0 flex-1 overflow-hidden bg-[var(--theme-appPanelStrong)]"},Ks={key:1,class:"grid min-h-0 flex-1 grid-cols-[320px_minmax(0,1fr)] overflow-hidden"},Js={class:"theme-divider theme-muted-panel min-h-0 overflow-y-auto border-r p-3"},Qs={class:"min-h-0 overflow-hidden bg-[var(--theme-appPanelStrong)]"},Xs={__name:"TaskDiffReviewPanel",props:{taskSlug:{type:String,default:""},preferredScope:{type:String,default:"workspace"},preferredRunId:{type:String,default:""},focusToken:{type:Number,default:0},active:{type:Boolean,default:!1}},setup(e){const n=e,{activeHunkIndex:d,baselineMetaText:u,diffPayload:l,diffScope:x,error:g,fileSearch:o,filteredFiles:b,formatRunOptionLabel:_,getFilterButtonClass:y,getFilterLabel:B,getPatchLineClass:ie,getRunStatusLabel:ee,getStatusClass:V,getStatusLabel:O,jumpToAdjacentHunk:G,loadDiff:te,loading:$,patchLoading:j,patchViewportRef:E,selectedFile:A,selectedFilePath:U,selectedPatchHunks:se,selectedPatchLines:le,selectedRunId:ae,setPatchLineRef:de,showSummarySkeleton:K,statsLoading:oe,statusCounts:re,statusFilter:I,terminalRuns:ue}=ht(n),{matches:J}=it("(max-width: 767px)"),T=P("files"),{t:w}=Re();function ce(N){U.value=N,J.value&&(T.value="patch")}function fe(N){E.value=N||null}return H(J,N=>{N||(T.value="files")},{immediate:!0}),H(U,N=>{!N&&J.value&&(T.value="files")}),H(x,()=>{J.value&&(T.value="files")}),(N,f)=>{var Q,he,me,ve,pe;return c(),v("section",es,[a("div",ts,[a("div",ss,[a("div",as,[a("button",{type:"button",class:F(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",t(x)==="workspace"?"theme-filter-active":""]),onClick:f[0]||(f[0]=m=>x.value="workspace")},[a("span",ns,r(t(w)("diffReview.scopeCurrentShort")),1),a("span",is,r(t(w)("diffReview.scopeCurrent")),1)],2),a("button",{type:"button",class:F(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",t(x)==="task"?"theme-filter-active":""]),onClick:f[1]||(f[1]=m=>x.value="task")},[a("span",ls,r(t(w)("diffReview.scopeTaskShort")),1),a("span",os,r(t(w)("diffReview.scopeTask")),1)],2),a("button",{type:"button",class:F(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",t(x)==="run"?"theme-filter-active":""]),onClick:f[2]||(f[2]=m=>x.value="run")},[a("span",null,r(t(w)("diffReview.scopeRun")),1)],2),a("button",{type:"button",class:"tool-button tool-button-info-subtle inline-flex shrink-0 items-center justify-center gap-2 px-3 py-2 text-xs",disabled:t($)||t(oe),onClick:f[3]||(f[3]=(...m)=>t(te)&&t(te)(...m))},[k(t(Ve),{class:F(["h-3.5 w-3.5 sm:hidden",t($)?"animate-spin":""])},null,8,["class"]),a("span",ds,r(t(w)("diffReview.refresh")),1),k(t(Ve),{class:F(["hidden h-3.5 w-3.5 sm:inline-block",t($)?"animate-spin":""])},null,8,["class"]),a("span",us,r(t($)?t(w)("diffReview.refreshing"):t(oe)?t(w)("diffReview.computing"):t(w)("diffReview.refresh")),1)],8,rs)]),t(x)==="run"?(c(),je(ot,{key:0,modelValue:t(ae),"onUpdate:modelValue":f[4]||(f[4]=m=>Ye(ae)?ae.value=m:null),class:"min-w-0 sm:max-w-[360px]",options:t(ue),loading:t($),"get-option-value":m=>(m==null?void 0:m.id)||"",placeholder:t(w)("diffReview.selectRun"),"empty-text":t(w)("diffReview.noRuns")},{trigger:$e(({selectedOption:m})=>[a("div",cs,r(m?t(_)(m):t(w)("diffReview.selectRun")),1)]),header:$e(()=>[a("div",fs,r(t(w)("diffReview.runCount",{count:t(ue).length})),1)]),option:$e(({option:m,selected:ge,select:xe})=>[a("button",{type:"button",class:F(["w-full rounded-sm border border-dashed px-3 py-2 text-left transition",ge?"theme-filter-active":"theme-filter-idle"]),onClick:xe},[a("div",ms,[a("div",vs,[a("div",ps,r(t(Ue)(m.startedAt||m.createdAt)),1),a("div",gs,r(t(ee)(m)),1)]),ge?(c(),je(t(lt),{key:0,class:"mt-0.5 h-4 w-4 shrink-0 text-[var(--theme-textSecondary)]"})):D("",!0)])],10,hs)]),_:1},8,["modelValue","options","loading","get-option-value","placeholder","empty-text"])):D("",!0)])]),t(g)?(c(),v("div",xs,[a("div",ys,[k(t(rt),{class:"mt-0.5 h-4 w-4 shrink-0"}),a("span",bs,r(t(g)),1)])])):D("",!0),t($)&&!t(l)?(c(),v("div",ws,r(t(w)("diffReview.loading")),1)):t(l)&&!t(l).supported?(c(),v("div",ks,[a("div",Ss,[a("div",Rs,[k(t(We),{class:"h-4 w-4"}),a("span",null,r(t(w)("diffReview.unavailableTitle")),1)]),a("p",Cs,r(t(l).reason||t(w)("diffReview.unavailableReason")),1),t(l).repoRoot?(c(),v("div",Fs,[a("div",$s,[k(t(Ne),{class:"h-3.5 w-3.5 shrink-0"}),a("span",Ls,r(t(l).repoRoot),1)]),t(l).branch?(c(),v("div",Ps,[k(t(Be),{class:"h-3.5 w-3.5 shrink-0"}),a("span",null,r(t(l).branch),1)])):D("",!0)])):D("",!0)])])):t(l)?(c(),v("div",_s,[a("div",Ts,[a("div",js,[t(l).repoRoot?(c(),v("div",Ms,[k(t(Ne),{class:"h-3.5 w-3.5 shrink-0"}),a("span",Ds,r(t(l).repoRoot),1)])):D("",!0),a("div",Hs,[k(t(Be),{class:"h-3.5 w-3.5 shrink-0"}),a("span",null,r(t(l).branch||t(w)("diffReview.unknownBranch")),1),f[16]||(f[16]=a("span",{class:"opacity-50"},"•",-1)),a("span",As,r(t(w)("diffReview.fileCount",{count:((Q=t(l).summary)==null?void 0:Q.fileCount)||0})),1),(he=t(l).summary)!=null&&he.statsComplete?(c(),v(Z,{key:0},[f[12]||(f[12]=a("span",{class:"opacity-50"},"•",-1)),a("span",Is,"+"+r(((me=t(l).summary)==null?void 0:me.additions)||0),1),a("span",Ns,"-"+r(((ve=t(l).summary)==null?void 0:ve.deletions)||0),1)],64)):t(K)?(c(),v(Z,{key:1},[f[13]||(f[13]=a("span",{class:"opacity-50"},"•",-1)),f[14]||(f[14]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-successSoft)]"},null,-1)),f[15]||(f[15]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-dangerSoft)]"},null,-1))],64)):(c(),v("span",Bs,r(t(w)("diffReview.waitingStats")),1))])]),t(u)?(c(),v("p",Vs,r(t(u)),1)):D("",!0),(pe=t(l).warnings)!=null&&pe.length?(c(),v("div",zs,[(c(!0),v(Z,null,Se(t(l).warnings,m=>(c(),v("p",{key:m,class:"text-[11px] text-[var(--theme-warningText)]"},r(m),1))),128))])):D("",!0)]),t(J)?(c(),v("div",Os,[a("div",Es,[a("div",Us,[a("button",{type:"button",class:F(["tool-button px-3 py-2 text-sm",T.value==="files"?"tool-button-accent-subtle":""]),onClick:f[5]||(f[5]=m=>T.value="files")},r(t(w)("diffReview.filesTab")),3),a("button",{type:"button",class:F(["tool-button px-3 py-2 text-sm",T.value==="patch"?"tool-button-accent-subtle":""]),disabled:!t(A),onClick:f[6]||(f[6]=m=>T.value="patch")},r(t(w)("diffReview.diffTab")),11,qs)])]),Te(a("div",Ws,[k(Oe,{"diff-payload":t(l),"file-search":t(o),"filtered-files":t(b),"get-filter-button-class":t(y),"get-filter-label":t(B),"get-status-class":t(V),"get-status-label":t(O),"selected-file-path":t(U),"show-summary-skeleton":t(K),"status-counts":t(re),"status-filter":t(I),"onUpdate:fileSearch":f[7]||(f[7]=m=>o.value=m),"onUpdate:statusFilter":f[8]||(f[8]=m=>I.value=m),onSelectFile:ce},null,8,["diff-payload","file-search","filtered-files","get-filter-button-class","get-filter-label","get-status-class","get-status-label","selected-file-path","show-summary-skeleton","status-counts","status-filter"])],512),[[He,T.value==="files"]]),Te(a("div",Gs,[k(Ee,{"active-hunk-index":t(d),"get-patch-line-class":t(ie),"get-status-class":t(V),"get-status-label":t(O),"jump-to-adjacent-hunk":t(G),"patch-loading":t(j),"selected-file":t(A),"selected-patch-hunks":t(se),"selected-patch-lines":t(le),"set-patch-line-ref":t(de),"set-patch-viewport-ref":fe},null,8,["active-hunk-index","get-patch-line-class","get-status-class","get-status-label","jump-to-adjacent-hunk","patch-loading","selected-file","selected-patch-hunks","selected-patch-lines","set-patch-line-ref"])],512),[[He,T.value==="patch"]])])):(c(),v("div",Ks,[a("div",Js,[k(Oe,{"diff-payload":t(l),"file-search":t(o),"filtered-files":t(b),"get-filter-button-class":t(y),"get-filter-label":t(B),"get-status-class":t(V),"get-status-label":t(O),"selected-file-path":t(U),"show-summary-skeleton":t(K),"status-counts":t(re),"status-filter":t(I),"onUpdate:fileSearch":f[9]||(f[9]=m=>o.value=m),"onUpdate:statusFilter":f[10]||(f[10]=m=>I.value=m),onSelectFile:f[11]||(f[11]=m=>U.value=m)},null,8,["diff-payload","file-search","filtered-files","get-filter-button-class","get-filter-label","get-status-class","get-status-label","selected-file-path","show-summary-skeleton","status-counts","status-filter"])]),a("div",Qs,[k(Ee,{"active-hunk-index":t(d),"get-patch-line-class":t(ie),"get-status-class":t(V),"get-status-label":t(O),"jump-to-adjacent-hunk":t(G),"patch-loading":t(j),"selected-file":t(A),"selected-patch-hunks":t(se),"selected-patch-lines":t(le),"set-patch-line-ref":t(de),"set-patch-viewport-ref":fe},null,8,["active-hunk-index","get-patch-line-class","get-status-class","get-status-label","jump-to-adjacent-hunk","patch-loading","selected-file","selected-patch-hunks","selected-patch-lines","set-patch-line-ref"])])]))])):D("",!0)])}}},Ys={class:"panel flex h-full w-full min-h-0 flex-col overflow-hidden sm:h-[min(90vh,960px)] sm:max-w-[min(96vw,1560px)]"},Zs={class:"theme-divider flex items-start justify-between gap-4 border-b px-4 py-4 sm:px-5"},ea={class:"min-w-0"},ta={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},sa={class:"min-h-0 flex-1 overflow-hidden p-3 sm:p-4"},ia={__name:"TaskDiffReviewDialog",props:{open:{type:Boolean,default:!1},taskSlug:{type:String,default:""},taskTitle:{type:String,default:""},preferredScope:{type:String,default:"task"},preferredRunId:{type:String,default:""},focusToken:{type:Number,default:0}},emits:["close"],setup(e,{emit:n}){const d=e,u=n,{t:l}=Re(),x=M(()=>{const o=String(d.taskTitle||"").trim();return o?l("diffReview.dialogTitleWithTask",{title:o}):l("diffReview.dialogTitle")});function g(o){d.open&&o.key==="Escape"&&u("close")}return H(()=>d.open,o=>{if(document.body.classList.toggle("overflow-hidden",o),o){window.addEventListener("keydown",g);return}window.removeEventListener("keydown",g)}),Ze(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",g)}),(o,b)=>(c(),je(tt,{to:"body"},[e.open?(c(),v("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-50 flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:b[1]||(b[1]=et(_=>u("close"),["self"]))},[a("section",Ys,[a("div",Zs,[a("div",ea,[a("div",ta,[k(t(We),{class:"h-4 w-4"}),a("span",null,r(x.value),1)])]),a("button",{type:"button",class:"theme-icon-button h-8 w-8 shrink-0",onClick:b[0]||(b[0]=_=>u("close"))},[k(t(dt),{class:"h-4 w-4"})])]),a("div",sa,[k(Xs,{"task-slug":e.taskSlug,active:e.open,"preferred-scope":e.preferredScope,"preferred-run-id":e.preferredRunId,"focus-token":e.focusToken},null,8,["task-slug","active","preferred-scope","preferred-run-id","focus-token"])])])])):D("",!0)]))}};export{ia as default};
@@ -1,26 +0,0 @@
1
- import{a as l,b as r,d as e,t as a,u as i,F as ne,r as ae,j as Ye,P as Rt,i as v,n as Ze,q as Tt,c as $,f as h,w as Je,o as St,e as N,B as Ke,y as se,A as Mt,z as pe,Q as Et,g as Pt,T as $t,s as m,C as _e,D as Ut}from"./index-CPEYh7Do.js";import{c as ie,r as W,d as jt,h as Lt,X as Bt,i as Nt,_ as Ft,L as me,j as It}from"./WorkbenchView-C2MWZt4p.js";import{I as qt}from"./info-DUErgVjs.js";/**
2
- * @license lucide-vue-next v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ge=ie("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/**
7
- * @license lucide-vue-next v0.577.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const zt=ie("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
12
- * @license lucide-vue-next v0.577.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const At=ie("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
17
- * @license lucide-vue-next v0.577.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const Vt=ie("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);/**
22
- * @license lucide-vue-next v0.577.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const Qe=ie("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);function Ht(){return W("/api/relay/config",{cache:"no-store"})}function Xe(U){return W("/api/relay/config",{method:"PUT",body:JSON.stringify(U)})}function Ot(){return W("/api/relay/reconnect",{method:"POST"})}function Wt(){return W("/api/system/config",{cache:"no-store"})}function Jt(U){return W("/api/system/config",{method:"PUT",body:JSON.stringify(U)})}function Kt(){return W("/api/diagnostics/runtime",{cache:"no-store"})}const Gt={class:"space-y-4"},Qt={class:"flex items-center justify-between gap-3"},Xt={class:"theme-heading text-sm font-medium"},Yt={class:"theme-toggle-current theme-badge-muted theme-muted-text rounded-sm border border-dashed px-2 py-1 text-[11px]"},Zt={class:"theme-muted-text theme-note-text mt-1"},es={class:"space-y-4"},ts={class:"theme-muted-text px-1 text-[10px] font-medium uppercase tracking-[0.16em]"},ss=["onClick"],ns={class:"flex items-start gap-3"},as={class:"mt-0.5 flex items-center gap-1.5"},is={class:"min-w-0 flex-1"},os={class:"flex items-center justify-between gap-2"},ls={class:"truncate text-sm font-medium"},rs={class:"theme-muted-text theme-note-text mt-1"},cs={__name:"ThemeToggle",setup(U){const{currentTheme:J,setTheme:F,themes:I}=Rt(),{t:T}=Ye(),ge=v(()=>{const b=I.value.filter(x=>x.mode==="light"),q=I.value.filter(x=>x.mode==="dark");return[{id:"light",label:T("theme.groupLight"),items:b},{id:"dark",label:T("theme.groupDark"),items:q}].filter(x=>x.items.length)});function he(b){F(b)}function s(b){return T(`theme.description.${b.id}`,{},b.description)}return(b,q)=>(l(),r("div",Gt,[e("div",null,[e("div",Qt,[e("div",Xt,a(i(T)("theme.heading")),1),e("div",Yt,a(i(T)("theme.currentTheme",{name:i(J).shortName})),1)]),e("div",Zt,a(i(T)("theme.helper")),1)]),e("div",es,[(l(!0),r(ne,null,ae(ge.value,x=>(l(),r("section",{key:x.id,class:"space-y-1.5"},[e("div",ts,a(x.label),1),(l(!0),r(ne,null,ae(x.items,y=>(l(),r("button",{key:y.id,type:"button",class:Ze(["theme-option theme-toggle-card w-full rounded-sm border px-3 py-2 text-left transition",y.id===i(J).id?"theme-option-active":"theme-option-idle"]),onClick:D=>he(y.id)},[e("div",ns,[e("div",as,[(l(!0),r(ne,null,ae(y.swatches,(D,w)=>(l(),r("span",{key:`${y.id}-${w}`,class:"h-3 w-3 rounded-full border border-black/10",style:Tt({backgroundColor:D})},null,4))),128))]),e("div",is,[e("div",os,[e("span",ls,a(y.shortName),1),y.id===i(J).id?(l(),$(i(jt),{key:0,class:"h-4 w-4 shrink-0"})):h("",!0)]),e("div",rs,a(s(y)),1)])])],10,ss))),128))]))),128))])]))}},ds={class:"panel settings-dialog-panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-[42rem] sm:max-h-[88vh]"},us={class:"theme-divider settings-dialog-header flex items-start justify-between gap-4 border-b px-5 py-4"},ms={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},gs={class:"settings-dialog-body min-h-0 flex flex-1 flex-col sm:flex-row"},hs={class:"settings-dialog-content min-h-0 flex-1 overflow-y-auto px-5 py-5"},vs={key:0,class:"space-y-4"},ys={class:"theme-heading text-base font-medium"},xs={class:"theme-muted-text mt-1 text-xs leading-5"},ps={class:"settings-section-card px-4 py-4"},_s={class:"settings-section-card space-y-4 px-4 py-4"},fs={class:"theme-heading text-sm font-medium"},bs={class:"theme-muted-text mt-1 text-xs leading-5"},ks={class:"block space-y-1.5"},Ds={class:"theme-muted-text text-xs"},ws={class:"truncate text-sm text-[var(--theme-textPrimary)]"},Cs=["onClick"],Rs={class:"flex items-center justify-between gap-3"},Ts={class:"min-w-0"},Ss={class:"truncate text-[var(--theme-textPrimary)]"},Ms={class:"theme-muted-text mt-1 truncate text-xs"},Es={key:0,class:"theme-status-success rounded-sm border border-dashed px-2 py-0.5 text-[10px]"},Ps={class:"theme-muted-text theme-note-text"},$s={key:1,class:"space-y-4"},Us={class:"flex items-start justify-between gap-3"},js={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},Ls={class:"settings-section-card space-y-4 px-4 py-4"},Bs={class:"settings-form-card flex items-center justify-between gap-3 px-3 py-2"},Ns={class:"text-sm font-medium text-[var(--theme-textPrimary)]"},Fs={class:"theme-muted-text mt-1 text-xs"},Is=["disabled"],qs={class:"grid gap-4 sm:grid-cols-2"},zs={class:"space-y-1.5 sm:col-span-2"},As={class:"theme-muted-text text-xs"},Vs=["disabled"],Hs={class:"space-y-1.5"},Os={class:"theme-muted-text text-xs"},Ws=["disabled"],Js={class:"space-y-1.5"},Ks={class:"theme-muted-text text-xs"},Gs={class:"relative"},Qs=["type","placeholder","disabled"],Xs=["disabled"],Ys={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},Zs={class:"min-w-0 space-y-1"},en={key:0,class:"theme-danger-text theme-note-text"},tn={key:1,class:"theme-status-warning theme-note-text"},sn={key:2,class:"theme-danger-text theme-note-text"},nn={key:3,class:"theme-status-success theme-note-text"},an={key:4,class:"theme-danger-text theme-note-text"},on={key:5,class:"theme-muted-text theme-note-text"},ln={key:6,class:"theme-muted-text theme-note-text"},rn={key:7,class:"theme-muted-text theme-note-text"},cn={key:8,class:"theme-status-success theme-note-text"},dn={key:9,class:"theme-muted-text theme-note-text"},un={class:"flex flex-wrap items-center gap-2"},mn=["disabled"],gn=["disabled"],hn=["disabled"],vn={key:2,class:"space-y-4"},yn={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},xn={class:"theme-muted-text mt-1 text-xs leading-5"},pn={class:"settings-section-card space-y-4 px-4 py-4"},_n={class:"space-y-1.5"},fn={class:"theme-muted-text text-xs"},bn=["disabled"],kn={class:"theme-muted-text text-xs leading-5"},Dn={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},wn={class:"min-w-0 space-y-1"},Cn={key:0,class:"theme-status-warning theme-note-text"},Rn={key:1,class:"theme-danger-text theme-note-text"},Tn={key:2,class:"theme-status-success theme-note-text"},Sn={key:3,class:"theme-muted-text theme-note-text"},Mn={class:"flex flex-wrap items-center gap-2"},En=["disabled"],Pn={class:"settings-section-card space-y-4 px-4 py-4"},$n={class:"flex flex-wrap items-start justify-between gap-3"},Un={class:"theme-heading text-sm font-medium"},jn={class:"theme-muted-text mt-1 text-xs leading-5"},Ln={class:"flex flex-wrap items-center gap-2"},Bn=["disabled"],Nn={class:"min-w-0 space-y-1"},Fn={key:0,class:"theme-danger-text theme-note-text"},In={key:1,class:"theme-status-success theme-note-text"},qn={key:2,class:"theme-muted-text theme-note-text"},zn={key:0,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4"},An={class:"settings-form-card space-y-1 px-3 py-3"},Vn={class:"theme-heading text-lg font-medium"},Hn={class:"theme-muted-text text-xs"},On={class:"settings-form-card space-y-1 px-3 py-3"},Wn={class:"theme-heading text-lg font-medium"},Jn={class:"theme-muted-text text-xs"},Kn={class:"settings-form-card space-y-1 px-3 py-3"},Gn={class:"theme-heading text-lg font-medium"},Qn={class:"theme-muted-text text-xs"},Xn={class:"settings-form-card space-y-1 px-3 py-3"},Yn={class:"theme-heading text-lg font-medium"},Zn={class:"theme-muted-text text-xs"},ea={key:1,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4"},ta={class:"settings-form-card space-y-1 px-3 py-3"},sa={class:"theme-heading text-lg font-medium"},na={class:"theme-muted-text text-xs"},aa={class:"settings-form-card space-y-1 px-3 py-3"},ia={class:"theme-heading text-lg font-medium"},oa={class:"theme-muted-text text-xs"},la={class:"settings-form-card space-y-1 px-3 py-3"},ra={class:"theme-heading text-lg font-medium"},ca={class:"theme-muted-text text-xs"},da={class:"settings-form-card space-y-1 px-3 py-3"},ua={class:"theme-heading text-lg font-medium"},ma={class:"theme-muted-text text-xs"},ga={key:2,class:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3"},ha={class:"settings-form-card space-y-1 px-3 py-3"},va={class:"theme-heading text-lg font-medium"},ya={class:"theme-muted-text text-xs"},xa={class:"settings-form-card space-y-1 px-3 py-3"},pa={class:"theme-heading text-lg font-medium"},_a={class:"theme-muted-text text-xs"},fa={class:"settings-form-card space-y-1 px-3 py-3"},ba={class:"theme-heading text-sm font-medium"},ka={class:"theme-muted-text text-xs"},Da={class:"grid gap-4 lg:grid-cols-2"},wa={class:"settings-form-card space-y-3 px-3 py-3"},Ca={class:"theme-heading text-sm font-medium"},Ra={class:"space-y-2 text-xs"},Ta={class:"flex items-center justify-between gap-3"},Sa={class:"truncate text-right text-[var(--theme-textPrimary)]"},Ma={class:"flex items-center justify-between gap-3"},Ea={class:"text-right text-[var(--theme-textPrimary)]"},Pa={class:"flex items-center justify-between gap-3"},$a={class:"text-right text-[var(--theme-textPrimary)]"},Ua={class:"flex items-center justify-between gap-3"},ja={class:"text-right text-[var(--theme-textPrimary)]"},La={class:"flex items-center justify-between gap-3"},Ba={class:"text-right text-[var(--theme-textPrimary)]"},Na={class:"settings-form-card space-y-3 px-3 py-3"},Fa={class:"theme-heading text-sm font-medium"},Ia={class:"space-y-2 text-xs"},qa={class:"theme-muted-text"},za={class:"text-[var(--theme-textPrimary)]"},Aa={key:3,class:"settings-form-card space-y-3 px-3 py-3"},Va={class:"theme-heading text-sm font-medium"},Ha={class:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3 text-xs"},Oa={class:"theme-muted-text"},Wa={class:"text-[var(--theme-textPrimary)]"},Ja={key:4,class:"settings-form-card space-y-2 px-3 py-3"},Ka={class:"theme-heading text-sm font-medium"},Ga={class:"theme-muted-text text-xs leading-5"},Qa={class:"theme-muted-text text-xs leading-5"},Xa={key:3,class:"space-y-4"},Ya={class:"theme-heading text-base font-medium"},Za={class:"theme-muted-text mt-1 text-xs leading-5"},ei={class:"settings-section-card px-4 py-4"},ti={class:"flex items-center justify-between gap-3"},si={class:"theme-heading text-sm font-medium"},ni={class:"theme-muted-text mt-1 text-xs leading-5"},ai={class:"theme-badge-strong rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium"},ci={__name:"WorkbenchSettingsDialog",props:{open:{type:Boolean,default:!1}},emits:["close"],setup(U,{emit:J}){const F=U,I=J,{locale:T,localeOptions:ge,setLocale:he,t:s}=Ye(),b=m(""),q=m(!1),x=m(""),y=m(!1),D=m(!1),w=m(!1),_=m(""),C=m(""),oe=m(!1),z=m(!1),A=m(""),K=m(""),V=m(!1),G=m(""),R=m(null),u=m(null),f=m(!1),H=_e({runnerMaxConcurrentRuns:!1}),Q=m(!1),le=m(!1),re=m(!1),ce=m(!1),c=_e({enabled:!1,relayUrl:"",deviceId:"",deviceToken:""}),O=_e({runnerMaxConcurrentRuns:3}),S=m("theme");let j=null,L=null,de=null;const et=v(()=>[{id:"theme",label:s("theme.title"),description:s("theme.sectionDescription"),icon:Vt},{id:"relay",label:s("settingsDialog.relay.sectionLabel"),description:s("settingsDialog.relay.sectionDescription"),icon:Qe},{id:"system",label:s("settingsDialog.system.sectionLabel"),description:s("settingsDialog.system.sectionDescription"),icon:Ge},{id:"about",label:s("settingsDialog.about.sectionLabel"),description:s("settingsDialog.about.sectionDescription"),icon:qt}]);function tt(t=null,n=""){const o=String((t==null?void 0:t.messageKey)||"").trim();if(o){const g=s(o);if(g&&g!==o)return g}return String((t==null?void 0:t.message)||"").trim()||(n?s(n):"")}function ue(t="",n=""){const o=String(t||"").trim();if(o){const g=`settingsDialog.relay.reason.${o}`,k=s(g);if(k!==g)return k}return String(n||"").trim()||s("common.notAvailable")}function st(t=null){const n=String((t==null?void 0:t.type)||"").trim()||"unknown",o=`settingsDialog.relay.event.${n}`,g=s(o);return g!==o?g:n}function nt(t=null){const n=String((t==null?void 0:t.lastErrorKey)||"").trim(),o=t!=null&&t.lastErrorParams&&typeof t.lastErrorParams=="object"?t.lastErrorParams:{};return n==="connect_failed"?s("settingsDialog.relay.error.connect_failed"):n==="disconnected"?s("settingsDialog.relay.error.disconnected",{reason:ue(o.reasonCode,t==null?void 0:t.lastCloseReason)}):n==="rejected"?s("settingsDialog.relay.error.rejected",{reason:ue(o.reasonCode,t==null?void 0:t.lastCloseReason)}):n==="closed_with_code"?s("settingsDialog.relay.error.closedWithCode",{code:o.code||(t==null?void 0:t.lastCloseCode)||0}):String((t==null?void 0:t.lastError)||"").trim()}const at=v(()=>{var t,n,o,g;return w.value?s("settingsDialog.relay.status.reconnecting"):D.value||Q.value?s("settingsDialog.relay.status.saving"):y.value?s("settingsDialog.relay.status.loading"):(t=u.value)!=null&&t.reconnectPaused?s("settingsDialog.relay.status.paused"):(n=u.value)!=null&&n.connected?s("settingsDialog.relay.status.connected"):(((o=u.value)==null?void 0:o.enabled)??c.enabled)&&Number(((g=u.value)==null?void 0:g.nextReconnectDelayMs)||0)>0?s("settingsDialog.relay.status.waitingReconnect"):c.enabled?s("settingsDialog.relay.status.disconnected"):s("settingsDialog.relay.status.disabled")}),it=v(()=>{var t,n;return(t=u.value)!=null&&t.reconnectPaused?"theme-status-danger":(n=u.value)!=null&&n.connected?"theme-status-success":c.enabled?"theme-status-warning":"theme-status-neutral"}),ot=v(()=>{var t,n,o;return!f.value&&!_.value&&!C.value&&!((t=u.value)!=null&&t.lastError)&&!((n=u.value)!=null&&n.lastCloseReason)&&!((o=u.value)!=null&&o.lastConnectedAt)}),lt=v(()=>{const t=c.deviceToken?`${"*".repeat(Math.max(0,c.deviceToken.length-4))}${c.deviceToken.slice(-4)}`:"";return JSON.stringify({generatedAt:new Date().toISOString(),source:"local-settings",config:{enabled:c.enabled,relayUrl:c.relayUrl,deviceId:c.deviceId,deviceTokenMasked:t,managedByEnv:f.value},status:u.value||null},null,2)}),B=v(()=>{var t,n;return((n=(t=R.value)==null?void 0:t.runner)==null?void 0:n.runner)||null}),X=v(()=>{var t,n;return!!((n=(t=R.value)==null?void 0:t.runner)!=null&&n.ok&&B.value)}),p=v(()=>{var t;return((t=B.value)==null?void 0:t.metrics)||null}),fe=v(()=>{var t;return((t=R.value)==null?void 0:t.recovery)||null}),be=v(()=>{var t;return((t=R.value)==null?void 0:t.maintenance)||null}),rt=v(()=>{var t;return((t=R.value)==null?void 0:t.gitDiffWorker)||null}),ct=v(()=>JSON.stringify({generatedAt:new Date().toISOString(),source:"local-settings",config:{runner:{maxConcurrentRuns:O.runnerMaxConcurrentRuns,managedByEnv:H.runnerMaxConcurrentRuns}},diagnostics:R.value||null},null,2));function Y(t){const n=String(t||"").trim();if(!n)return s("common.notAvailable");const o=new Date(n);return Number.isNaN(o.getTime())?n:Ut(o.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}const dt=v(()=>{var t,n,o,g,k,M,E,P;return[{key:"queued_cancelled",label:s("settingsDialog.system.stopReasons.queued_cancelled"),value:Math.max(0,Number((n=(t=p.value)==null?void 0:t.stopReasons)==null?void 0:n.queued_cancelled)||0)},{key:"user_requested",label:s("settingsDialog.system.stopReasons.user_requested"),value:Math.max(0,Number((g=(o=p.value)==null?void 0:o.stopReasons)==null?void 0:g.user_requested)||0)},{key:"user_requested_after_error",label:s("settingsDialog.system.stopReasons.user_requested_after_error"),value:Math.max(0,Number((M=(k=p.value)==null?void 0:k.stopReasons)==null?void 0:M.user_requested_after_error)||0)},{key:"stop_timeout",label:s("settingsDialog.system.stopReasons.stop_timeout"),value:Math.max(0,Number((P=(E=p.value)==null?void 0:E.stopReasons)==null?void 0:P.stop_timeout)||0)}]}),ut=v(()=>{var t,n,o,g,k,M,E,P,ee,te;return[{key:"runner_timeout_without_stop_request",label:s("settingsDialog.system.stopTimeoutPhases.runner_timeout_without_stop_request"),value:Math.max(0,Number((n=(t=p.value)==null?void 0:t.stopTimeoutPhases)==null?void 0:n.runner_timeout_without_stop_request)||0)},{key:"runner_timeout_before_cancel",label:s("settingsDialog.system.stopTimeoutPhases.runner_timeout_before_cancel"),value:Math.max(0,Number((g=(o=p.value)==null?void 0:o.stopTimeoutPhases)==null?void 0:g.runner_timeout_before_cancel)||0)},{key:"cli_not_exiting",label:s("settingsDialog.system.stopTimeoutPhases.cli_not_exiting"),value:Math.max(0,Number((M=(k=p.value)==null?void 0:k.stopTimeoutPhases)==null?void 0:M.cli_not_exiting)||0)},{key:"os_kill_slow",label:s("settingsDialog.system.stopTimeoutPhases.os_kill_slow"),value:Math.max(0,Number((P=(E=p.value)==null?void 0:E.stopTimeoutPhases)==null?void 0:P.os_kill_slow)||0)},{key:"runner_finalize_after_exit",label:s("settingsDialog.system.stopTimeoutPhases.runner_finalize_after_exit"),value:Math.max(0,Number((te=(ee=p.value)==null?void 0:ee.stopTimeoutPhases)==null?void 0:te.runner_finalize_after_exit)||0)}]}),mt=v(()=>ge.value.map(t=>({value:t.value,label:t.value==="zh-CN"?s("locale.zhHans"):s("locale.enUs"),englishLabel:t.englishLabel})));async function gt(){q.value=!0,x.value="";try{const t=await It(),n=String((t==null?void 0:t.version)||"").trim();b.value=n,n||(x.value=s("settingsDialog.about.versionPending"))}catch(t){b.value="",x.value=(t==null?void 0:t.message)||s("settingsDialog.about.versionLoadFailed")}finally{q.value=!1}}function ve(t={}){c.enabled=!!(t!=null&&t.enabled),c.relayUrl=String((t==null?void 0:t.relayUrl)||""),c.deviceId=String((t==null?void 0:t.deviceId)||""),c.deviceToken=String((t==null?void 0:t.deviceToken)||"")}function ke(t={}){var n;O.runnerMaxConcurrentRuns=Math.max(1,Number((n=t==null?void 0:t.runner)==null?void 0:n.maxConcurrentRuns)||3)}async function De(){y.value=!0,_.value="",C.value="";try{const t=await Ht();ve((t==null?void 0:t.config)||{}),f.value=!!(t!=null&&t.managedByEnv),u.value=(t==null?void 0:t.relay)||null}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayConfigLoadFailed"),u.value=null}finally{y.value=!1}}async function ht(){var t,n;oe.value=!0,A.value="",K.value="";try{const o=await Wt();ke((o==null?void 0:o.config)||{}),H.runnerMaxConcurrentRuns=!!((n=(t=o==null?void 0:o.managedByEnv)==null?void 0:t.runner)!=null&&n.maxConcurrentRuns),Z()}catch(o){A.value=(o==null?void 0:o.message)||s("settingsDialog.system.systemConfigLoadFailed")}finally{oe.value=!1}}async function Z(){V.value=!0,G.value="";try{R.value=await Kt()}catch(t){G.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemDiagnosticsLoadFailed")}finally{V.value=!1}}async function vt(){D.value=!0,_.value="",C.value="";try{const t=await Xe({enabled:c.enabled,relayUrl:c.relayUrl,deviceId:c.deviceId,deviceToken:c.deviceToken});ve((t==null?void 0:t.config)||{}),f.value=!!(t!=null&&t.managedByEnv),u.value=(t==null?void 0:t.relay)||null,C.value=c.enabled?s("settingsDialog.relay.relayConfigSavedEnabled"):s("settingsDialog.relay.relayConfigSavedDisabled")}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayConfigSaveFailed")}finally{D.value=!1}}async function yt(){w.value=!0,_.value="",C.value="";try{const t=await Ot();u.value=(t==null?void 0:t.relay)||null,C.value=s("settingsDialog.relay.relayReconnectTriggered"),setTimeout(()=>{De()},1200)}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayReconnectFailed")}finally{w.value=!1}}async function xt(){var t,n;z.value=!0,A.value="",K.value="";try{const o=await Jt({runner:{maxConcurrentRuns:O.runnerMaxConcurrentRuns}});ke((o==null?void 0:o.config)||{}),H.runnerMaxConcurrentRuns=!!((n=(t=o==null?void 0:o.managedByEnv)==null?void 0:t.runner)!=null&&n.maxConcurrentRuns),K.value=s("settingsDialog.system.systemConfigSaved"),Z()}catch(o){A.value=(o==null?void 0:o.message)||s("settingsDialog.system.systemConfigSaveFailed")}finally{z.value=!1}}function pt(){return!!(String(c.relayUrl||"").trim()&&String(c.deviceId||"").trim()&&String(c.deviceToken||"").trim())}async function _t(){var t;if(!f.value){if(_.value="",C.value="",c.enabled&&!pt()){c.enabled=!1,_.value=s("settingsDialog.relay.relayFieldsRequired");return}Q.value=!0;try{const n=await Xe({enabled:c.enabled,relayUrl:c.relayUrl,deviceId:c.deviceId,deviceToken:c.deviceToken});ve((n==null?void 0:n.config)||{}),f.value=!!(n!=null&&n.managedByEnv),u.value=(n==null?void 0:n.relay)||null,C.value=c.enabled?s("settingsDialog.relay.relayEnabledSaved"):s("settingsDialog.relay.relayConfigSavedDisabled")}catch(n){c.enabled=!!((t=u.value)!=null&&t.enabled),_.value=(n==null?void 0:n.message)||s("settingsDialog.relay.relayToggleFailed")}finally{Q.value=!1}}}async function we(t){var o;if((o=navigator.clipboard)!=null&&o.writeText&&window.isSecureContext){await navigator.clipboard.writeText(t);return}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}async function ft(){try{await we(lt.value),re.value=!0,j&&clearTimeout(j),j=setTimeout(()=>{re.value=!1,j=null},2e3)}catch(t){_.value=(t==null?void 0:t.message)||s("settingsDialog.relay.relayDiagnosticsCopyFailed")}}async function bt(){try{await we(ct.value),ce.value=!0,L&&clearTimeout(L),L=setTimeout(()=>{ce.value=!1,L=null},2e3)}catch(t){G.value=(t==null?void 0:t.message)||s("settingsDialog.system.systemDiagnosticsCopyFailed")}}function kt(t){he(t)}function ye(){de&&(clearInterval(de),de=null)}function Dt(){ye(),!(!F.open||S.value!=="system")&&(Z(),de=setInterval(()=>{Z()},5e3))}function xe(t){F.open&&t.key==="Escape"&&I("close")}return Je(()=>F.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",xe),S.value="theme",gt(),De(),ht();return}window.removeEventListener("keydown",xe)},{immediate:!0}),Je([()=>F.open,S],([t,n])=>{if(t&&n==="system"){Dt();return}ye()},{immediate:!0}),St(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",xe),j&&(clearTimeout(j),j=null),L&&(clearTimeout(L),L=null),ye()}),(t,n)=>{var o,g,k,M,E,P,ee,te,Ce,Re,Te,Se,Me,Ee,Pe,$e,Ue,je,Le,Be,Ne,Fe,Ie,qe,ze,Ae,Ve,He,Oe,We;return l(),$($t,{to:"body"},[U.open?(l(),r("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-[70] flex items-center justify-center px-4 py-6",onClick:n[8]||(n[8]=Pt(d=>I("close"),["self"]))},[e("section",ds,[e("div",us,[e("div",null,[e("div",ms,[N(i(Lt),{class:"h-4 w-4"}),e("span",null,a(i(s)("common.settings")),1)])]),e("button",{type:"button",class:"theme-icon-button h-8 w-8 shrink-0",onClick:n[0]||(n[0]=d=>I("close"))},[N(i(Bt),{class:"h-4 w-4"})])]),e("div",gs,[N(Nt,{modelValue:S.value,"onUpdate:modelValue":n[1]||(n[1]=d=>S.value=d),sections:et.value},null,8,["modelValue","sections"]),e("div",hs,[S.value==="theme"?(l(),r("section",vs,[e("div",null,[e("div",ys,a(i(s)("theme.title")),1),e("p",xs,a(i(s)("theme.sectionDescription")),1)]),e("section",ps,[N(cs)]),e("section",_s,[e("div",null,[e("div",fs,a(i(s)("locale.title")),1),e("p",bs,a(i(s)("locale.description")),1)]),e("label",ks,[e("span",Ds,a(i(s)("locale.field")),1),N(Ft,{"model-value":i(T),options:mt.value,"get-option-value":d=>d.value,"onUpdate:modelValue":kt},{trigger:Ke(({selectedOption:d})=>[e("div",ws,a((d==null?void 0:d.label)||i(s)("common.select")),1)]),option:Ke(({option:d,selected:wt,select:Ct})=>[e("button",{type:"button",class:"workbench-select-option theme-filter-idle w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm",onClick:ii=>Ct()},[e("div",Rs,[e("div",Ts,[e("div",Ss,a(d.label),1),e("div",Ms,a(d.englishLabel),1)]),wt?(l(),r("span",Es,a(i(s)("common.enabled")),1)):h("",!0)])],8,Cs)]),_:1},8,["model-value","options","get-option-value"])]),e("p",Ps,a(i(s)("locale.immediateHint")),1)])])):S.value==="relay"?(l(),r("section",$s,[e("div",Us,[e("div",null,[e("div",js,[N(i(Qe),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.relay.title")),1)])]),e("span",{class:Ze(["rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium",it.value])},a(at.value),3)]),e("section",Ls,[e("label",Bs,[e("div",null,[e("div",Ns,a(i(s)("settingsDialog.relay.enableTitle")),1),e("p",Fs,a(i(s)("settingsDialog.relay.enableDescription")),1)]),se(e("input",{"onUpdate:modelValue":n[2]||(n[2]=d=>c.enabled=d),type:"checkbox",class:"h-4 w-4",disabled:f.value,onChange:_t},null,40,Is),[[Mt,c.enabled]])]),e("div",qs,[e("label",zs,[e("span",As,a(i(s)("settingsDialog.relay.relayUrl")),1),se(e("input",{"onUpdate:modelValue":n[3]||(n[3]=d=>c.relayUrl=d),type:"text",placeholder:"https://user1.promptx.example.com",class:"tool-input",disabled:f.value},null,8,Vs),[[pe,c.relayUrl]])]),e("label",Hs,[e("span",Os,a(i(s)("settingsDialog.relay.deviceId")),1),se(e("input",{"onUpdate:modelValue":n[4]||(n[4]=d=>c.deviceId=d),type:"text",placeholder:"my-macbook",class:"tool-input",disabled:f.value},null,8,Ws),[[pe,c.deviceId]])]),e("label",Js,[e("span",Ks,a(i(s)("settingsDialog.relay.deviceToken")),1),e("div",Gs,[se(e("input",{"onUpdate:modelValue":n[5]||(n[5]=d=>c.deviceToken=d),type:le.value?"text":"password",placeholder:i(s)("settingsDialog.relay.deviceTokenPlaceholder"),class:"tool-input pr-10",disabled:f.value},null,8,Qs),[[Et,c.deviceToken]]),e("button",{type:"button",class:"theme-icon-button absolute inset-y-1 right-1 flex h-auto w-8 items-center justify-center",disabled:f.value,onClick:n[6]||(n[6]=d=>le.value=!le.value)},[le.value?(l(),$(i(zt),{key:1,class:"h-4 w-4"})):(l(),$(i(At),{key:0,class:"h-4 w-4"}))],8,Xs)])])]),e("div",Ys,[e("div",Zs,[(o=u.value)!=null&&o.reconnectPausedReason?(l(),r("p",en,a(i(s)("settingsDialog.relay.pausedReconnect",{reason:ue(u.value.reconnectPausedReasonCode,u.value.reconnectPausedReason)})),1)):h("",!0),f.value?(l(),r("p",tn,a(i(s)("settingsDialog.relay.managedByEnv")),1)):h("",!0),_.value?(l(),r("p",sn,a(_.value),1)):C.value?(l(),r("p",nn,a(C.value),1)):(g=u.value)!=null&&g.lastError?(l(),r("p",an,a(i(s)("settingsDialog.relay.lastError",{value:nt(u.value)})),1)):(k=u.value)!=null&&k.lastCloseReason?(l(),r("p",on,a(i(s)("settingsDialog.relay.lastClosed",{reason:ue(u.value.lastCloseReasonCode,u.value.lastCloseReason),code:u.value.lastCloseCode})),1)):(M=u.value)!=null&&M.lastConnectedAt?(l(),r("p",ln,a(i(s)("settingsDialog.relay.lastConnected",{value:Y(u.value.lastConnectedAt)})),1)):h("",!0),(P=(E=u.value)==null?void 0:E.recentEvents)!=null&&P.length?(l(),r("p",rn,a(i(s)("settingsDialog.relay.recentEvent",{value:st(u.value.recentEvents[0])})),1)):h("",!0),re.value?(l(),r("p",cn,a(i(s)("settingsDialog.relay.copied")),1)):h("",!0),ot.value?(l(),r("p",dn,a(i(s)("settingsDialog.relay.defaultHint")),1)):h("",!0)]),e("div",un,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:y.value||D.value||Q.value||w.value||!(((ee=u.value)==null?void 0:ee.enabled)??c.enabled),onClick:yt},[w.value?(l(),$(i(me),{key:0,class:"h-4 w-4 animate-spin"})):h("",!0),e("span",null,a(w.value?i(s)("settingsDialog.relay.reconnecting"):i(s)("settingsDialog.relay.reconnectNow")),1)],8,mn),e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:y.value||w.value,onClick:ft},[e("span",null,a(re.value?i(s)("settingsDialog.relay.diagnosticsCopied"):i(s)("settingsDialog.relay.copyDiagnostics")),1)],8,gn),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:y.value||D.value||Q.value||w.value||f.value,onClick:vt},[D.value?(l(),$(i(me),{key:0,class:"h-4 w-4 animate-spin"})):h("",!0),e("span",null,a(D.value?i(s)("common.saving"):i(s)("settingsDialog.relay.saveConfig")),1)],8,hn)])])])])):S.value==="system"?(l(),r("section",vn,[e("div",null,[e("div",yn,[N(i(Ge),{class:"h-4 w-4"}),e("span",null,a(i(s)("settingsDialog.system.title")),1)]),e("p",xn,a(i(s)("settingsDialog.system.intro")),1)]),e("section",pn,[e("label",_n,[e("span",fn,a(i(s)("settingsDialog.system.maxConcurrentRuns")),1),se(e("input",{"onUpdate:modelValue":n[7]||(n[7]=d=>O.runnerMaxConcurrentRuns=d),type:"number",min:"1",max:"16",step:"1",class:"tool-input",disabled:H.runnerMaxConcurrentRuns||oe.value||z.value},null,8,bn),[[pe,O.runnerMaxConcurrentRuns,void 0,{number:!0}]]),e("p",kn,a(i(s)("settingsDialog.system.maxConcurrentRunsHint")),1)]),e("div",Dn,[e("div",wn,[H.runnerMaxConcurrentRuns?(l(),r("p",Cn,a(i(s)("settingsDialog.system.managedByEnv")),1)):A.value?(l(),r("p",Rn,a(A.value),1)):K.value?(l(),r("p",Tn,a(K.value),1)):(l(),r("p",Sn,a(i(s)("settingsDialog.system.diagnosticsHint")),1))]),e("div",Mn,[e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:H.runnerMaxConcurrentRuns||oe.value||z.value,onClick:xt},[z.value?(l(),$(i(me),{key:0,class:"h-4 w-4 animate-spin"})):h("",!0),e("span",null,a(z.value?i(s)("common.saving"):i(s)("settingsDialog.system.saveConfig")),1)],8,En)])])]),e("section",Pn,[e("div",$n,[e("div",null,[e("div",Un,a(i(s)("settingsDialog.system.runtimeDiagnostics")),1),e("p",jn,a(i(s)("settingsDialog.system.runtimeDiagnosticsHint")),1)]),e("div",Ln,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:V.value,onClick:Z},[V.value?(l(),$(i(me),{key:0,class:"h-4 w-4 animate-spin"})):h("",!0),e("span",null,a(V.value?i(s)("settingsDialog.system.refreshingDiagnostics"):i(s)("settingsDialog.system.refreshDiagnostics")),1)],8,Bn),e("button",{type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",onClick:bt},[e("span",null,a(ce.value?i(s)("settingsDialog.system.diagnosticsCopied"):i(s)("settingsDialog.system.copyDiagnostics")),1)])])]),e("div",Nn,[G.value?(l(),r("p",Fn,a(G.value),1)):ce.value?(l(),r("p",In,a(i(s)("settingsDialog.system.diagnosticsCopiedHint")),1)):(l(),r("p",qn,a(i(s)("settingsDialog.system.diagnosticsHint")),1))]),X.value?(l(),r("div",zn,[e("div",An,[n[9]||(n[9]=e("div",{class:"theme-muted-text text-xs"},"active",-1)),e("div",Vn,a(((te=B.value)==null?void 0:te.activeRunCount)||0),1),e("p",Hn,a(i(s)("settingsDialog.system.active")),1)]),e("div",On,[n[10]||(n[10]=e("div",{class:"theme-muted-text text-xs"},"tracked",-1)),e("div",Wn,a(((Ce=B.value)==null?void 0:Ce.trackedRunCount)||0),1),e("p",Jn,a(i(s)("settingsDialog.system.tracked")),1)]),e("div",Kn,[n[11]||(n[11]=e("div",{class:"theme-muted-text text-xs"},"queued",-1)),e("div",Gn,a(((Re=B.value)==null?void 0:Re.queuedRunCount)||0),1),e("p",Qn,a(i(s)("settingsDialog.system.queued")),1)]),e("div",Xn,[n[12]||(n[12]=e("div",{class:"theme-muted-text text-xs"},"maxConcurrent",-1)),e("div",Yn,a(((Se=(Te=B.value)==null?void 0:Te.config)==null?void 0:Se.maxConcurrentRuns)||O.runnerMaxConcurrentRuns),1),e("p",Zn,a(i(s)("settingsDialog.system.maxConcurrent")),1)])])):h("",!0),X.value?(l(),r("div",ea,[e("div",ta,[n[13]||(n[13]=e("div",{class:"theme-muted-text text-xs"},"completed",-1)),e("div",sa,a(((Me=p.value)==null?void 0:Me.totalCompleted)||0),1),e("p",na,a(i(s)("settingsDialog.system.completed")),1)]),e("div",aa,[n[14]||(n[14]=e("div",{class:"theme-muted-text text-xs"},"stopped",-1)),e("div",ia,a(((Ee=p.value)==null?void 0:Ee.totalStopped)||0),1),e("p",oa,a(i(s)("settingsDialog.system.stopped")),1)]),e("div",la,[n[15]||(n[15]=e("div",{class:"theme-muted-text text-xs"},"error",-1)),e("div",ra,a(((Pe=p.value)==null?void 0:Pe.totalErrored)||0),1),e("p",ca,a(i(s)("settingsDialog.system.error")),1)]),e("div",da,[n[16]||(n[16]=e("div",{class:"theme-muted-text text-xs"},"stop_timeout",-1)),e("div",ua,a((($e=p.value)==null?void 0:$e.totalStopTimeout)||0),1),e("p",ma,a(i(s)("settingsDialog.system.stopTimeout")),1)])])):h("",!0),X.value?(l(),r("div",ga,[e("div",ha,[n[17]||(n[17]=e("div",{class:"theme-muted-text text-xs"},"event flush failures",-1)),e("div",va,a(((Ue=p.value)==null?void 0:Ue.eventFlushFailureCount)||0),1),e("p",ya,a(i(s)("settingsDialog.system.eventWriteFailures")),1)]),e("div",xa,[n[18]||(n[18]=e("div",{class:"theme-muted-text text-xs"},"recovered runs",-1)),e("div",pa,a(((Le=(je=fe.value)==null?void 0:je.metrics)==null?void 0:Le.totalRecovered)||0),1),e("p",_a,a(i(s)("settingsDialog.system.recoveredRuns")),1)]),e("div",fa,[n[19]||(n[19]=e("div",{class:"theme-muted-text text-xs"},"last cleanup",-1)),e("div",ba,a(Y((Ne=(Be=be.value)==null?void 0:Be.lastCleanup)==null?void 0:Ne.finishedAt)),1),e("p",ka,a(i(s)("settingsDialog.system.lastMaintenanceAt")),1)])])):h("",!0),e("div",Da,[e("div",wa,[e("div",Ca,a(i(s)("settingsDialog.system.baseStatus")),1),e("div",Ra,[e("div",Ta,[n[20]||(n[20]=e("span",{class:"theme-muted-text"},"runner baseUrl",-1)),e("span",Sa,a(((Ie=(Fe=R.value)==null?void 0:Fe.runner)==null?void 0:Ie.baseUrl)||"-"),1)]),e("div",Ma,[n[21]||(n[21]=e("span",{class:"theme-muted-text"},"runner startedAt",-1)),e("span",Ea,a(Y((qe=B.value)==null?void 0:qe.startedAt)),1)]),e("div",Pa,[n[22]||(n[22]=e("span",{class:"theme-muted-text"},"last sweep",-1)),e("span",$a,a(Y((Ae=(ze=fe.value)==null?void 0:ze.metrics)==null?void 0:Ae.lastSweepFinishedAt)),1)]),e("div",Ua,[n[23]||(n[23]=e("span",{class:"theme-muted-text"},"git diff worker",-1)),e("span",ja,a(rt.value?i(s)("settingsDialog.system.available"):i(s)("settingsDialog.system.unknown")),1)]),e("div",La,[n[24]||(n[24]=e("span",{class:"theme-muted-text"},"db vacuum",-1)),e("span",Ba,a(Y((Ve=be.value)==null?void 0:Ve.lastVacuumAt)),1)])])]),e("div",Na,[e("div",Fa,a(i(s)("settingsDialog.system.stopReasonTitle")),1),e("div",Ia,[(l(!0),r(ne,null,ae(dt.value,d=>(l(),r("div",{key:d.key,class:"flex items-center justify-between gap-3"},[e("span",qa,a(d.label),1),e("span",za,a(d.value),1)]))),128))])])]),X.value?(l(),r("div",Aa,[e("div",Va,a(i(s)("settingsDialog.system.stopTimeoutPhaseTitle")),1),e("div",Ha,[(l(!0),r(ne,null,ae(ut.value,d=>(l(),r("div",{key:d.key,class:"flex items-center justify-between gap-3 rounded-sm border border-dashed border-[var(--theme-borderMuted)] px-2.5 py-2"},[e("span",Oa,a(d.label),1),e("span",Wa,a(d.value),1)]))),128))])])):h("",!0),!X.value&&!V.value?(l(),r("div",Ja,[e("div",Ka,a(i(s)("settingsDialog.system.runnerUnavailable")),1),e("p",Ga,a(tt((He=R.value)==null?void 0:He.runner,"settingsDialog.system.runnerUnavailableDescription")),1),e("p",Qa," baseUrl: "+a(((We=(Oe=R.value)==null?void 0:Oe.runner)==null?void 0:We.baseUrl)||"-"),1)])):h("",!0)])])):(l(),r("section",Xa,[e("div",null,[e("div",Ya,a(i(s)("settingsDialog.about.title")),1),e("p",Za,a(i(s)("settingsDialog.about.intro")),1)]),e("section",ei,[e("div",ti,[e("div",null,[e("div",si,a(i(s)("settingsDialog.about.versionTitle")),1),e("p",ni,a(x.value||i(s)("settingsDialog.about.versionDescription")),1)]),e("span",ai,a(q.value?i(s)("common.loading"):b.value?`v${b.value}`:i(s)("common.unavailable")),1)])])]))])])])])):h("",!0)])}}};export{ci as default};