dsh-ui-tweaks 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -1,4 +1,4 @@
1
- window.__ModuleLoader__.load({id:"dsh-ui-tweaks",factory:Ve=>{var je=Object.create(null),Ze=Object.create(null);je["./archive.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.ARCHIVE_CSS=void 0,j.installArchiveStyles=ee,j.ArchiveSection=B;const e=q("react/jsx-runtime"),o=q("react"),z="/_dsh/ui-tweaks/archive";async function F(p){const y=await fetch(z,{credentials:"same-origin",...p});let M;try{M=await y.json()}catch{M=void 0}if(!y.ok||M===void 0||!M.ok){const f=M,c=new Error(f?.error?.message??`UI Tweaks archive request failed with HTTP ${y.status}`);throw c.code=f?.error?.code,c}return M.value}function K(p,y){return p?.code==="session-live"?y("archiveLiveError"):p instanceof Error?p.message:String(p)}function R(p){p.refresh()}function U(p){return p===void 0||p===""?"":p.replace(/[\\/]+$/u,"").split(/[\\/]/u).at(-1)??""}function se(p,y,M){const f=Math.round((p-y)/1e3),c=Math.abs(f);return c<60?M.format(f,"second"):c<3600?M.format(Math.round(f/60),"minute"):c<86400?M.format(Math.round(f/3600),"hour"):c<604800?M.format(Math.round(f/86400),"day"):M.format(Math.round(f/604800),"week")}j.ARCHIVE_CSS=`
1
+ window.__ModuleLoader__.load({id:"dsh-ui-tweaks",factory:Ve=>{var je=Object.create(null),Ze=Object.create(null);je["./archive.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.ARCHIVE_CSS=void 0,j.installArchiveStyles=ee,j.ArchiveSection=$;const e=K("react/jsx-runtime"),o=K("react"),L="/_dsh/ui-tweaks/archive";async function z(p){const y=await fetch(L,{credentials:"same-origin",...p});let E;try{E=await y.json()}catch{E=void 0}if(!y.ok||E===void 0||!E.ok){const f=E,d=new Error(f?.error?.message??`UI Tweaks archive request failed with HTTP ${y.status}`);throw d.code=f?.error?.code,d}return E.value}function Y(p,y){return p?.code==="session-live"?y("archiveLiveError"):p instanceof Error?p.message:String(p)}function F(p){p.refresh()}function U(p){return p===void 0||p===""?"":p.replace(/[\\/]+$/u,"").split(/[\\/]/u).at(-1)??""}function se(p,y,E){const f=Math.round((p-y)/1e3),d=Math.abs(f);return d<60?E.format(f,"second"):d<3600?E.format(Math.round(f/60),"minute"):d<86400?E.format(Math.round(f/3600),"hour"):d<604800?E.format(Math.round(f/86400),"day"):E.format(Math.round(f/604800),"week")}j.ARCHIVE_CSS=`
2
2
  .dut-arc{display:grid;gap:12px;max-width:680px;padding:6px 2px 36px}
3
3
  .dut-arc-head{display:flex;align-items:center;gap:10px;padding:14px 16px 0}
4
4
  .dut-arc-head h2{margin:0;font-size:15px;font-weight:600;letter-spacing:-.01em;color:var(--dsw-alias-label-primary)}
@@ -19,7 +19,7 @@ window.__ModuleLoader__.load({id:"dsh-ui-tweaks",factory:Ve=>{var je=Object.crea
19
19
  .dut-arc-alert{margin:8px 16px 0;padding:8px 12px;border-radius:10px;font-size:12px;line-height:1.5;background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);color:var(--dsw-alias-state-error-primary)}
20
20
  .dut-arc-off{padding:20px 16px;display:grid;gap:12px}
21
21
  .dut-arc-off p{margin:0;font-size:12.5px;line-height:1.6;color:var(--dsw-alias-label-secondary)}
22
- `;function ee(){const p="dsh-ui-tweaks-archive";if(document.querySelector(`style[data-plugin-css="${p}"]`)!==null)return()=>{};const M=document.createElement("style");return M.dataset.plugin="dsh-ui-tweaks",M.dataset.pluginCss=p,M.textContent=j.ARCHIVE_CSS,document.head.appendChild(M),()=>{M.remove()}}function B({controller:p,t:y,sessionsService:M,useSessions:f,useWorkspaces:c}){const k=(0,o.useSyncExternalStore)(p.subscribe,p.getSnapshot,p.getSnapshot).value?.archiveManagerEnabled===!0,S=f(l=>l),P=c(l=>l),[x,H]=(0,o.useState)(null),[D,O]=(0,o.useState)(!1),[A,I]=(0,o.useState)(null),[$,W]=(0,o.useState)(null),ne=(0,o.useMemo)(()=>new Intl.RelativeTimeFormat(navigator.language,{numeric:"auto"}),[]),Z=Date.now();(0,o.useEffect)(()=>{if(x===null)return;const l=window.setTimeout(()=>{H(N=>N===x?null:N)},3e3);return()=>{window.clearTimeout(l)}},[x]),(0,o.useEffect)(()=>{if(!D)return;const l=window.setTimeout(()=>{O(!1)},3e3);return()=>{window.clearTimeout(l)}},[D]);const X=(0,o.useMemo)(()=>{const l=S.byId;return P.archivedSessionIds.map(N=>({id:N,summary:l[N]})).sort((N,b)=>{const a=N.summary?.updatedAt??0;return(b.summary?.updatedAt??0)-a})},[P.archivedSessionIds,S.byId]),J=(l,N,b)=>{I(l),W(null),F({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}).then(()=>{b?.()}).catch(a=>{W(K(a,y))}).finally(()=>{I(a=>a===l?null:a)})},le=l=>{J(`restore:${l}`,{action:"restore",sessionId:l})},ae=l=>{if(x!==l){H(l);return}H(null),J(`delete:${l}`,{action:"delete",sessionId:l},()=>{R(M)})},de=()=>{J("restore-all",{action:"restore-all"})},G=()=>{if(!D){O(!0);return}O(!1),J("delete-all",{action:"delete-all"},()=>{R(M)})};return k?(0,e.jsx)("div",{className:"dut-arc",children:(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsxs)("div",{className:"dut-arc-head",children:[(0,e.jsx)("h2",{children:y("archiveTitle")}),(0,e.jsxs)("span",{className:"dut-arc-count",children:[X.length," ",y("archiveCount")]}),(0,e.jsx)("span",{className:"dut-arc-spacer"}),X.length>1?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"dut-arc-btn",disabled:A!==null,onClick:de,children:y(A==="restore-all"?"archiveRestoring":"archiveRestoreAll")}),(0,e.jsx)("button",{type:"button",className:"dut-arc-btn dut-arc-del"+(D?" dut-arc-confirm":""),disabled:A!==null,onClick:G,children:A==="delete-all"?y("archiveDeleteAll")+"…":D?y("archiveDeleteAll")+"?":y("archiveDeleteAll")})]}):null]}),$!==null?(0,e.jsx)("div",{className:"dut-arc-alert",children:$}):null,(0,e.jsx)("div",{className:"dut-arc-body",children:X.length===0?(0,e.jsx)("div",{className:"dut-arc-empty",children:y("archiveEmpty")}):X.map(l=>{const N=l.summary,b=N?.displayTitle??l.id,a=[U(N?.cwd),N!==void 0?se(N.updatedAt,Z,ne):""].filter(Boolean).join(" · ");return(0,e.jsxs)("div",{className:"dut-arc-row",children:[(0,e.jsxs)("div",{className:"dut-arc-main",title:b,children:[(0,e.jsx)("span",{className:"dut-arc-title",children:b}),a!==""?(0,e.jsx)("span",{className:"dut-arc-sub",children:a}):null]}),(0,e.jsx)("button",{type:"button",className:"dut-arc-btn",disabled:A!==null,onClick:()=>{le(l.id)},children:A===`restore:${l.id}`?y("archiveRestoring"):y("archiveRestore")}),(0,e.jsx)("button",{type:"button",className:"dut-arc-btn dut-arc-del"+(x===l.id?" dut-arc-confirm":""),disabled:A!==null,onClick:()=>{ae(l.id)},children:A===`delete:${l.id}`?y("archiveDelete")+"…":x===l.id?y("archiveDelete")+"?":y("archiveDelete")})]},l.id)})})]})}):(0,e.jsx)("div",{className:"dut-arc",children:(0,e.jsxs)("div",{className:"dut-panel dut-arc-off",children:[(0,e.jsx)("p",{children:y("archiveDisabledHint")}),(0,e.jsx)("div",{children:(0,e.jsx)("button",{type:"button",className:"dut-btn dut-btn-active",onClick:()=>{p.set("archiveManagerEnabled",!0).catch(()=>{W(y("unavailable"))})},children:y("archiveEnable")})})]})})}},je["./cachehit.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.PreciseCacheHitEntry=R;const e=q("react"),o=/(?:缓存命中|Cache hit)\s*\d+(?:\.\d+)?%/,z=/\d+(?:\.\d+)?%(?=\s*$)/;function F(U){return U.uncachedInputTokens+U.cacheReadTokens+U.cacheWriteTokens}function K(U,se){return o.test(U)?U.replace(z,`${se}%`):U}function R({useProjection:U}){const se=U("tokenUsage");return(0,e.useEffect)(()=>{const ee=document.querySelectorAll('[data-slot="conversation.composer.dock"]');if(ee.length===0)return;const B=new Map,p=new Map,y=new Map,M=()=>{for(const x of[...B.keys()])x.isConnected||B.delete(x);for(const x of[...p.keys()])x.isConnected||p.delete(x);for(const x of[...y.keys()])x.isConnected||y.delete(x)},f=()=>{if(se===void 0)return null;const x=F(se);return x>0?(se.cacheReadTokens/x*100).toFixed(2):null},c=(x,H)=>{const D=x.data;if(!o.test(D))return;if(H===null){const A=B.get(x);A!==void 0&&(A!==D&&(x.data=A),B.delete(x));return}B.has(x)||B.set(x,D);const O=K(D,H);O!==D&&(x.data=O)},m=(x,H)=>{const D=x.getAttribute("aria-label")??"";if(!o.test(D))return;if(H===null){const A=p.get(x);A!==void 0&&(A!==D&&x.setAttribute("aria-label",A),p.delete(x));return}p.has(x)||p.set(x,D);const O=K(D,H);O!==D&&x.setAttribute("aria-label",O)},k=x=>{for(const H of document.querySelectorAll("dl[data-session-stats-usage]"))for(const D of H.querySelectorAll("dt")){const O=(D.textContent??"").trim();if(O!=="缓存命中"&&O!=="Cache hit")continue;const A=D.nextElementSibling;if(A===null||A.tagName!=="DD")continue;if(x===null){const $=y.get(A);$!==void 0&&(A.textContent!==$&&(A.textContent=$),y.delete(A));continue}y.has(A)||y.set(A,A.textContent??"");const I=`${x}%`;A.textContent!==I&&(A.textContent=I)}},S=()=>{M();const x=f();for(const H of ee){const D=document.createTreeWalker(H,NodeFilter.SHOW_TEXT);let O=D.nextNode();for(;O!==null;)c(O,x),O=D.nextNode();for(const A of H.querySelectorAll("[aria-label]"))m(A,x)}k(x)};S();const P=new MutationObserver(S);return P.observe(document.body,{childList:!0,characterData:!0,subtree:!0}),()=>{P.disconnect();for(const[x,H]of B)x.data!==H&&(x.data=H);B.clear();for(const[x,H]of p)x.getAttribute("aria-label")!==H&&x.setAttribute("aria-label",H);p.clear();for(const[x,H]of y)x.textContent!==H&&(x.textContent=H);y.clear()}},[se]),null}},je["./effort.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.classifyEffort=z,j.installEffortTag=B;const e={low:["low","minimal","mini","eco","fast","低","快速"],medium:["medium","standard","balanced","moderate","中","标准"],high:["high","deep","advanced","高","深度","强"],max:["max","maximum","ultra","extreme","highest","xhigh","最高","最强"]},o=["default","provider default","auto","off","none","disabled","默认","自动","关闭","无"];function z(p){const y=p.trim().toLowerCase();if(y==="")return null;for(const M of o)if(y===M)return null;for(const[M,f]of Object.entries(e))if(f.includes(y))return M;return null}const F="data-dut-effort",K='div[data-slot="conversation.input.model"] button',R=new Set(["推理等级","Effort"]);function U(p,y){if(p instanceof HTMLElement){if(y===null){p.hasAttribute(F)&&p.removeAttribute(F);return}p.getAttribute(F)!==y&&p.setAttribute(F,y)}}function se(p){const y=p.querySelectorAll(":scope > span");for(const M of y){const f=y.length>=2&&M===y[y.length-1];U(M,f?z(M.textContent?.trim()??""):null)}}function ee(p){const y=p.querySelectorAll('button[role="menuitemradio"]'),M=p.querySelector('section[role="group"]')!==null;for(const f of y){if(!(f instanceof HTMLButtonElement))continue;if(M){f.removeAttribute(F);for(const k of f.querySelectorAll(`span[${F}]`))k.removeAttribute(F);continue}const c=f.querySelector(":scope > span"),m=z(c?.textContent?.trim()??"");U(c,m),m===null?f.removeAttribute(F):f.getAttribute(F)!==m&&f.setAttribute(F,m)}for(const f of p.querySelectorAll('button[role="menuitem"]')){if(!(f instanceof HTMLButtonElement))continue;const c=f.querySelectorAll(":scope > span");if(c.length<2)continue;const m=c[0],k=c[c.length-1]??null,S=R.has(m?.textContent?.trim()??"");U(k,S?z(k?.textContent?.trim()??""):null)}}function B(){const p=()=>{for(const M of document.querySelectorAll(K)){se(M);const f=M.getAttribute("aria-controls"),c=f===null?null:document.getElementById(f);c!==null&&ee(c)}};p();const y=new MutationObserver(p);return y.observe(document.body,{childList:!0,characterData:!0,subtree:!0}),()=>{y.disconnect();for(const M of document.querySelectorAll(`[${F}]`))M.removeAttribute(F)}}},je["./gitbar.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.GITBAR_CSS=void 0,j.installGitBarStyles=S,j.warmGitStatus=I,j.GitWarmup=$,j.BranchChipEntry=X,j.DiffPanel=J,j.DiffTabTitle=le,j.installHeroChip=G;const e=q("react/jsx-runtime"),o=q("react"),z=q("react-dom"),F=q("react-dom/client"),K=re("./graphlayout.js"),R="/_dsh/ui-tweaks/git",U=1e4,se=150,ee=30,B=60,p=62,y="45%";function M(l){const N=Math.max(l.lanes,1)*K.GRAPH_LANE_W,b=h=>h*K.GRAPH_LANE_W+K.GRAPH_LANE_W/2,a=K.GRAPH_ROW_H/2;return(0,e.jsxs)("svg",{width:N,height:K.GRAPH_ROW_H,viewBox:`0 0 ${N} ${K.GRAPH_ROW_H}`,"aria-hidden":!0,focusable:"false",children:[l.row.edges.map((h,T)=>{const d=`${h.kind}:${h.from}>${h.to}:${T}`;if(h.kind==="pass")return(0,e.jsx)("line",{x1:b(h.from),y1:0,x2:b(h.to),y2:K.GRAPH_ROW_H,stroke:h.color,strokeWidth:2},d);if(h.kind==="in")return(0,e.jsx)("line",{x1:b(h.from),y1:0,x2:b(h.to),y2:a,stroke:h.color,strokeWidth:2},d);const r=b(h.from),t=b(h.to);if(r===t)return(0,e.jsx)("line",{x1:r,y1:a,x2:t,y2:K.GRAPH_ROW_H,stroke:h.color,strokeWidth:2},d);const u=a+(K.GRAPH_ROW_H-a)*.55;return(0,e.jsx)("path",{d:`M ${r} ${a} C ${r} ${u}, ${t} ${u}, ${t} ${K.GRAPH_ROW_H}`,fill:"none",stroke:h.color,strokeWidth:2,strokeLinecap:"round"},d)}),(0,e.jsx)("circle",{cx:b(l.row.dot),cy:a,r:4,fill:l.row.color,style:{stroke:"var(--dsw-alias-bg-layer-2)",strokeWidth:1.5}})]})}async function f(l){const N=await fetch(l,{credentials:"same-origin"}),b=await N.json();if(!N.ok||!b.ok){const a=b;throw new Error(a.error?.message??`Git request failed with HTTP ${N.status}`)}return b.value}async function c(l,N){const b=await fetch(l,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),a=await b.json();if(!b.ok||!a.ok){const h=a;throw new Error(h.error?.message??`Git action failed with HTTP ${b.status}`)}return a.value}function m(l){return l.session!==void 0?`session=${encodeURIComponent(l.session)}`:l.ws!==void 0?`ws=${encodeURIComponent(l.ws)}`:""}function k(l){if(l===void 0||l==="")return"—";const N=l.replace(/[\\/]+$/,""),b=Math.max(N.lastIndexOf("\\"),N.lastIndexOf("/"));return b>=0?N.slice(b+1):N}j.GITBAR_CSS=`
22
+ `;function ee(){const p="dsh-ui-tweaks-archive";if(document.querySelector(`style[data-plugin-css="${p}"]`)!==null)return()=>{};const E=document.createElement("style");return E.dataset.plugin="dsh-ui-tweaks",E.dataset.pluginCss=p,E.textContent=j.ARCHIVE_CSS,document.head.appendChild(E),()=>{E.remove()}}function $({controller:p,t:y,sessionsService:E,useSessions:f,useWorkspaces:d}){const k=(0,o.useSyncExternalStore)(p.subscribe,p.getSnapshot,p.getSnapshot).value?.archiveManagerEnabled===!0,C=f(c=>c),R=d(c=>c),[w,P]=(0,o.useState)(null),[H,D]=(0,o.useState)(!1),[A,B]=(0,o.useState)(null),[W,G]=(0,o.useState)(null),ne=(0,o.useMemo)(()=>new Intl.RelativeTimeFormat(navigator.language,{numeric:"auto"}),[]),V=Date.now();(0,o.useEffect)(()=>{if(w===null)return;const c=window.setTimeout(()=>{P(x=>x===w?null:x)},3e3);return()=>{window.clearTimeout(c)}},[w]),(0,o.useEffect)(()=>{if(!H)return;const c=window.setTimeout(()=>{D(!1)},3e3);return()=>{window.clearTimeout(c)}},[H]);const Z=(0,o.useMemo)(()=>{const c=C.byId;return R.archivedSessionIds.map(x=>({id:x,summary:c[x]})).sort((x,m)=>{const a=x.summary?.updatedAt??0;return(m.summary?.updatedAt??0)-a})},[R.archivedSessionIds,C.byId]),X=(c,x,m)=>{B(c),G(null),z({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}).then(()=>{m?.()}).catch(a=>{G(Y(a,y))}).finally(()=>{B(a=>a===c?null:a)})},ue=c=>{X(`restore:${c}`,{action:"restore",sessionId:c})},ae=c=>{if(w!==c){P(c);return}P(null),X(`delete:${c}`,{action:"delete",sessionId:c},()=>{F(E)})},ce=()=>{X("restore-all",{action:"restore-all"})},q=()=>{if(!H){D(!0);return}D(!1),X("delete-all",{action:"delete-all"},()=>{F(E)})};return k?(0,e.jsx)("div",{className:"dut-arc",children:(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsxs)("div",{className:"dut-arc-head",children:[(0,e.jsx)("h2",{children:y("archiveTitle")}),(0,e.jsxs)("span",{className:"dut-arc-count",children:[Z.length," ",y("archiveCount")]}),(0,e.jsx)("span",{className:"dut-arc-spacer"}),Z.length>1?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",className:"dut-arc-btn",disabled:A!==null,onClick:ce,children:y(A==="restore-all"?"archiveRestoring":"archiveRestoreAll")}),(0,e.jsx)("button",{type:"button",className:"dut-arc-btn dut-arc-del"+(H?" dut-arc-confirm":""),disabled:A!==null,onClick:q,children:A==="delete-all"?y("archiveDeleteAll")+"…":H?y("archiveDeleteAll")+"?":y("archiveDeleteAll")})]}):null]}),W!==null?(0,e.jsx)("div",{className:"dut-arc-alert",children:W}):null,(0,e.jsx)("div",{className:"dut-arc-body",children:Z.length===0?(0,e.jsx)("div",{className:"dut-arc-empty",children:y("archiveEmpty")}):Z.map(c=>{const x=c.summary,m=x?.displayTitle??c.id,a=[U(x?.cwd),x!==void 0?se(x.updatedAt,V,ne):""].filter(Boolean).join(" · ");return(0,e.jsxs)("div",{className:"dut-arc-row",children:[(0,e.jsxs)("div",{className:"dut-arc-main",title:m,children:[(0,e.jsx)("span",{className:"dut-arc-title",children:m}),a!==""?(0,e.jsx)("span",{className:"dut-arc-sub",children:a}):null]}),(0,e.jsx)("button",{type:"button",className:"dut-arc-btn",disabled:A!==null,onClick:()=>{ue(c.id)},children:A===`restore:${c.id}`?y("archiveRestoring"):y("archiveRestore")}),(0,e.jsx)("button",{type:"button",className:"dut-arc-btn dut-arc-del"+(w===c.id?" dut-arc-confirm":""),disabled:A!==null,onClick:()=>{ae(c.id)},children:A===`delete:${c.id}`?y("archiveDelete")+"…":w===c.id?y("archiveDelete")+"?":y("archiveDelete")})]},c.id)})})]})}):(0,e.jsx)("div",{className:"dut-arc",children:(0,e.jsxs)("div",{className:"dut-panel dut-arc-off",children:[(0,e.jsx)("p",{children:y("archiveDisabledHint")}),(0,e.jsx)("div",{children:(0,e.jsx)("button",{type:"button",className:"dut-btn dut-btn-active",onClick:()=>{p.set("archiveManagerEnabled",!0).catch(()=>{G(y("unavailable"))})},children:y("archiveEnable")})})]})})}},je["./cachehit.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.PreciseCacheHitEntry=F;const e=K("react"),o=/(?:缓存命中|Cache hit)\s*\d+(?:\.\d+)?%/,L=/\d+(?:\.\d+)?%(?=\s*$)/;function z(U){return U.uncachedInputTokens+U.cacheReadTokens+U.cacheWriteTokens}function Y(U,se){return o.test(U)?U.replace(L,`${se}%`):U}function F({useProjection:U}){const se=U("tokenUsage");return(0,e.useEffect)(()=>{const ee=document.querySelectorAll('[data-slot="conversation.composer.dock"]');if(ee.length===0)return;const $=new Map,p=new Map,y=new Map,E=()=>{for(const w of[...$.keys()])w.isConnected||$.delete(w);for(const w of[...p.keys()])w.isConnected||p.delete(w);for(const w of[...y.keys()])w.isConnected||y.delete(w)},f=()=>{if(se===void 0)return null;const w=z(se);return w>0?(se.cacheReadTokens/w*100).toFixed(2):null},d=(w,P)=>{const H=w.data;if(!o.test(H))return;if(P===null){const A=$.get(w);A!==void 0&&(A!==H&&(w.data=A),$.delete(w));return}$.has(w)||$.set(w,H);const D=Y(H,P);D!==H&&(w.data=D)},g=(w,P)=>{const H=w.getAttribute("aria-label")??"";if(!o.test(H))return;if(P===null){const A=p.get(w);A!==void 0&&(A!==H&&w.setAttribute("aria-label",A),p.delete(w));return}p.has(w)||p.set(w,H);const D=Y(H,P);D!==H&&w.setAttribute("aria-label",D)},k=w=>{for(const P of document.querySelectorAll("dl[data-session-stats-usage]"))for(const H of P.querySelectorAll("dt")){const D=(H.textContent??"").trim();if(D!=="缓存命中"&&D!=="Cache hit")continue;const A=H.nextElementSibling;if(A===null||A.tagName!=="DD")continue;if(w===null){const W=y.get(A);W!==void 0&&(A.textContent!==W&&(A.textContent=W),y.delete(A));continue}y.has(A)||y.set(A,A.textContent??"");const B=`${w}%`;A.textContent!==B&&(A.textContent=B)}},C=()=>{E();const w=f();for(const P of ee){const H=document.createTreeWalker(P,NodeFilter.SHOW_TEXT);let D=H.nextNode();for(;D!==null;)d(D,w),D=H.nextNode();for(const A of P.querySelectorAll("[aria-label]"))g(A,w)}k(w)};C();const R=new MutationObserver(C);return R.observe(document.body,{childList:!0,characterData:!0,subtree:!0}),()=>{R.disconnect();for(const[w,P]of $)w.data!==P&&(w.data=P);$.clear();for(const[w,P]of p)w.getAttribute("aria-label")!==P&&w.setAttribute("aria-label",P);p.clear();for(const[w,P]of y)w.textContent!==P&&(w.textContent=P);y.clear()}},[se]),null}},je["./effort.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.classifyEffort=L,j.installEffortTag=$;const e={low:["low","minimal","mini","eco","fast","低","快速"],medium:["medium","standard","balanced","moderate","中","标准"],high:["high","deep","advanced","高","深度","强"],max:["max","maximum","ultra","extreme","highest","xhigh","最高","最强"]},o=["default","provider default","auto","off","none","disabled","默认","自动","关闭","无"];function L(p){const y=p.trim().toLowerCase();if(y==="")return null;for(const E of o)if(y===E)return null;for(const[E,f]of Object.entries(e))if(f.includes(y))return E;return null}const z="data-dut-effort",Y='div[data-slot="conversation.input.model"] button',F=new Set(["推理等级","Effort"]);function U(p,y){if(p instanceof HTMLElement){if(y===null){p.hasAttribute(z)&&p.removeAttribute(z);return}p.getAttribute(z)!==y&&p.setAttribute(z,y)}}function se(p){const y=p.querySelectorAll(":scope > span");for(const E of y){const f=y.length>=2&&E===y[y.length-1];U(E,f?L(E.textContent?.trim()??""):null)}}function ee(p){const y=p.querySelectorAll('button[role="menuitemradio"]'),E=p.querySelector('section[role="group"]')!==null;for(const f of y){if(!(f instanceof HTMLButtonElement))continue;if(E){f.removeAttribute(z);for(const k of f.querySelectorAll(`span[${z}]`))k.removeAttribute(z);continue}const d=f.querySelector(":scope > span"),g=L(d?.textContent?.trim()??"");U(d,g),g===null?f.removeAttribute(z):f.getAttribute(z)!==g&&f.setAttribute(z,g)}for(const f of p.querySelectorAll('button[role="menuitem"]')){if(!(f instanceof HTMLButtonElement))continue;const d=f.querySelectorAll(":scope > span");if(d.length<2)continue;const g=d[0],k=d[d.length-1]??null,C=F.has(g?.textContent?.trim()??"");U(k,C?L(k?.textContent?.trim()??""):null)}}function $(){const p=()=>{for(const E of document.querySelectorAll(Y)){se(E);const f=E.getAttribute("aria-controls"),d=f===null?null:document.getElementById(f);d!==null&&ee(d)}};p();const y=new MutationObserver(p);return y.observe(document.body,{childList:!0,characterData:!0,subtree:!0}),()=>{y.disconnect();for(const E of document.querySelectorAll(`[${z}]`))E.removeAttribute(z)}}},je["./gitbar.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.GITBAR_CSS=void 0,j.installGitBarStyles=C,j.warmGitStatus=B,j.GitWarmup=W,j.BranchChipEntry=Z,j.DiffPanel=X,j.DiffTabTitle=ue,j.installHeroChip=q;const e=K("react/jsx-runtime"),o=K("react"),L=K("react-dom"),z=K("react-dom/client"),Y=re("./graphlayout.js"),F="/_dsh/ui-tweaks/git",U=1e4,se=150,ee=30,$=60,p=62,y="45%";function E(c){const x=Math.max(c.lanes,1)*Y.GRAPH_LANE_W,m=h=>h*Y.GRAPH_LANE_W+Y.GRAPH_LANE_W/2,a=Y.GRAPH_ROW_H/2;return(0,e.jsxs)("svg",{width:x,height:Y.GRAPH_ROW_H,viewBox:`0 0 ${x} ${Y.GRAPH_ROW_H}`,"aria-hidden":!0,focusable:"false",children:[c.row.edges.map((h,T)=>{const l=`${h.kind}:${h.from}>${h.to}:${T}`;if(h.kind==="pass")return(0,e.jsx)("line",{x1:m(h.from),y1:0,x2:m(h.to),y2:Y.GRAPH_ROW_H,stroke:h.color,strokeWidth:2},l);if(h.kind==="in")return(0,e.jsx)("line",{x1:m(h.from),y1:0,x2:m(h.to),y2:a,stroke:h.color,strokeWidth:2},l);const S=m(h.from),s=m(h.to);if(S===s)return(0,e.jsx)("line",{x1:S,y1:a,x2:s,y2:Y.GRAPH_ROW_H,stroke:h.color,strokeWidth:2},l);const t=a+(Y.GRAPH_ROW_H-a)*.55;return(0,e.jsx)("path",{d:`M ${S} ${a} C ${S} ${t}, ${s} ${t}, ${s} ${Y.GRAPH_ROW_H}`,fill:"none",stroke:h.color,strokeWidth:2,strokeLinecap:"round"},l)}),(0,e.jsx)("circle",{cx:m(c.row.dot),cy:a,r:4,fill:c.row.color,style:{stroke:"var(--dsw-alias-bg-layer-2)",strokeWidth:1.5}})]})}async function f(c){const x=await fetch(c,{credentials:"same-origin"}),m=await x.json();if(!x.ok||!m.ok){const a=m;throw new Error(a.error?.message??`Git request failed with HTTP ${x.status}`)}return m.value}async function d(c,x){const m=await fetch(c,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}),a=await m.json();if(!m.ok||!a.ok){const h=a;throw new Error(h.error?.message??`Git action failed with HTTP ${m.status}`)}return a.value}function g(c){return c.session!==void 0?`session=${encodeURIComponent(c.session)}`:c.ws!==void 0?`ws=${encodeURIComponent(c.ws)}`:""}function k(c){if(c===void 0||c==="")return"—";const x=c.replace(/[\\/]+$/,""),m=Math.max(x.lastIndexOf("\\"),x.lastIndexOf("/"));return m>=0?x.slice(m+1):x}j.GITBAR_CSS=`
23
23
  /* DSH does not force border-box globally; normalize it for the whole GitBar
24
24
  subtree (including the body-portaled panels/modal), or widths overflow. */
25
25
  .gbar,.gbar *,.gbar-view,.gbar-view *,.gbar-modal-wrap,.gbar-modal-wrap *,.gbar-notice,.gbar-notice *{box-sizing:border-box}
@@ -501,7 +501,7 @@ window.__ModuleLoader__.load({id:"dsh-ui-tweaks",factory:Ve=>{var je=Object.crea
501
501
  /* hero (new-session) floating chip wrapper */
502
502
  .gbar-hero{position:fixed;z-index:110;transform:translateY(-50%);display:inline-flex;align-items:center;gap:6px}
503
503
  @media (prefers-reduced-motion:reduce){.gbar-view,.gbar-modal,.gbar-notice,.gbar-pop{animation:none}}
504
- `;function S(){const l="dsh-ui-tweaks-gitbar";if(document.querySelector(`style[data-plugin-css="${l}"]`)!==null)return()=>{};const b=document.createElement("style");return b.dataset.plugin="dsh-ui-tweaks",b.dataset.pluginCss=l,b.textContent=j.GITBAR_CSS,document.head.appendChild(b),()=>{b.remove()}}function P(l){const N=l.lastIndexOf("/");return N>=0&&l.startsWith("origin/")?l.slice(N+1):l}function x(l){return l==="main"||l==="master"}function H(l){return l==="U"?"U":l.length>1?l[0]??"M":l}function D(l){const N=H(l);return N==="A"?"gbar-a":N==="D"?"gbar-d":N==="U"?"gbar-u":"gbar-m"}const O=new Map;try{window.localStorage.removeItem("dsh-ui-tweaks.git.snapshots.v1")}catch{}const A=new Map;function I(l){const N=l.session??l.ws??"";if(N===""||O.has(N)||A.has(N))return;const b=f(`${R}/status?${m(l)}`).then(a=>{a.unresolved||O.set(N,a)}).catch(()=>{}).finally(()=>{A.delete(N)});A.set(N,b)}function $({sessionId:l}){return(0,o.useEffect)(()=>{I({session:String(l)})},[l]),null}const W=[400,800,1600,3200],ne=6;function Z(l,N){const b=N.session??N.ws??"",[a,h]=(0,o.useState)(()=>O.get(b)??null);(0,o.useEffect)(()=>{if(!l||b===""){h(null);return}h(O.get(b)??null);let d=!1,r,t,u=0,s=O.has(b);const i=w=>w.unresolved===!0?(!d&&!s&&h(null),!1):(s=!0,u=0,O.set(b,w),d||h(w),!0),v=async()=>{try{return i(await f(`${R}/status?${m(N)}`))}catch{return s}},g=()=>{if(d||s||u>=ne)return;const w=W[Math.min(u,W.length-1)]??3200;u+=1,t=window.setTimeout(()=>{d||v().then(C=>{C||g()})},w)};return v().then(w=>{w||g()}),r=window.setInterval(()=>{document.visibilityState==="visible"&&v()},U),()=>{d=!0,r!==void 0&&clearInterval(r),t!==void 0&&clearTimeout(t)}},[l,b]);const T=(0,o.useCallback)(async()=>{if(b!=="")try{const d=await f(`${R}/status?${m(N)}`);d.unresolved||(O.set(b,d),h(d))}catch{}},[N.session,N.ws]);return[a,T]}function X({sessionId:l,sessionsService:N,controller:b,t:a}){const T=(0,o.useSyncExternalStore)(b.subscribe,b.getSnapshot,b.getSnapshot).value?.gitBarEnabled??!0,d=String(l),r={session:d},t=N.list,u=(0,o.useMemo)(()=>t.subscribe.bind(t),[t]),s=(0,o.useSyncExternalStore)(u,()=>t.getSnapshot().byId[l]?.cwd,()=>{}),[i,v]=Z(T,r),[g,w]=(0,o.useState)(!1),[C,V]=(0,o.useState)(null),[Y,be]=(0,o.useState)(""),[ue,we]=(0,o.useState)(!1),[me,te]=(0,o.useState)(null),[ye,ve]=(0,o.useState)(""),[Te,Ne]=(0,o.useState)(!1),[ce,Ce]=(0,o.useState)(null),[Me,L]=(0,o.useState)(""),[fe,E]=(0,o.useState)(null),[oe,ke]=(0,o.useState)(""),[Oe,qe]=(0,o.useState)(""),[Xe,He]=(0,o.useState)(!1),[$e,De]=(0,o.useState)(null),[ze,Ae]=(0,o.useState)(null),[_,ie]=(0,o.useState)(""),[pe,Se]=(0,o.useState)(""),[Pe,Ie]=(0,o.useState)(!1),[Re,Ke]=(0,o.useState)(null),[Le,We]=(0,o.useState)(!1),Fe=(0,o.useMemo)(()=>Re===null?null:(0,K.layoutCommitGraph)(Re.commits),[Re]),[xe,Be]=(0,o.useState)(null),[Je,sa]=(0,o.useState)(null),na=(0,o.useRef)(null),ia=(0,o.useRef)(null);(0,o.useEffect)(()=>{(!T||d===void 0)&&(w(!1),Ne(!1),Ce(null),He(!1),Ae(null),De(null),Ie(!1))},[T,d]);const Ee=(n,Q)=>{sa({kind:n,text:Q}),window.setTimeout(()=>sa(null),4e3)},_e=async(n,Q)=>{if(xe!==null)return!1;Be(n);try{return await Q(),!0}catch(ge){return Ee("err",ge instanceof Error?ge.message:String(ge)),!1}finally{Be(null)}},Ye=()=>{d!==void 0&&f(`${R}/branches?${m(r)}`).then(V).catch(n=>{Ee("err",n instanceof Error?n.message:String(n))})},Ge=()=>{d!==void 0&&f(`${R}/tags?${m(r)}`).then(E).catch(n=>{Ee("err",n instanceof Error?n.message:String(n))})},ua=()=>{const n=!g;w(n),n&&(Ye(),Ge())},oa=n=>{d===void 0||n===C?.current||_e("checkout",async()=>{await c(`${R}/checkout`,{session:d,branch:n}),w(!1),await v(),Ee("ok",`→ ${n}`)})},pa=()=>{if(d===void 0)return;const n=i?.upstream??i?.branch??"";_e("pull",async()=>{await c(`${R}/pull`,{session:d}),w(!1),await v(),Ee("ok",`⬇ ${n}`)})},la=()=>{d===void 0||Y.trim()===""||_e(ue?"create-push":"create",async()=>{await c(`${R}/create`,{session:d,name:Y.trim(),base:ye===""?void 0:ye,push:ue}),w(!1),Ne(!1),be(""),we(!1),ve(""),await v(),ue&&Ee("ok",`☁ ${Y.trim()}`)})},ha=()=>{be(""),ve(""),we(!1),Ne(!0)},ba=n=>{te(null),L(n),Ce(n)},da=()=>{if(d===void 0||ce===null)return;const n=ce,Q=Me.trim();if(Q===""||Q===n){Ce(null);return}_e("branch-rename",async()=>{await c(`${R}/branch-rename`,{session:d,name:n,newName:Q}),Ce(null),Ye(),await v(),Ee("ok",`✎ ${n} → ${Q}`)})},ga=()=>{Ge(),He(!0)},Qe=()=>{if(d===void 0)return;const n=oe.trim();if(n==="")return;const Q=Oe.trim();_e("tag-create",async()=>{await c(`${R}/tag-create`,{session:d,name:n,...Q!==""?{message:Q}:{}}),ke(""),qe(""),Ge(),Ee("ok",`🏷 ${n}`)})},ma=(n,Q)=>{ie(""),Se(""),Ae({ref:n,hash:Q})},ea=()=>{if(d===void 0||ze===null)return;const n=_.trim();if(n==="")return;const Q=pe.trim();_e("tag-create",async()=>{await c(`${R}/tag-create`,{session:d,name:n,ref:ze.ref,...Q!==""?{message:Q}:{}}),Ae(null),Ge(),aa(),Ee("ok",`🏷 ${n}`)})},fa=n=>{d!==void 0&&_e("tag-push",async()=>{await c(`${R}/tag-push`,{session:d,name:n}),Ee("ok",`☁ ${n}`)})},xa=n=>{d!==void 0&&($e===n?(De(null),_e("tag-delete",async()=>{await c(`${R}/tag-delete`,{session:d,name:n}),Ge(),Ee("ok",`🗑 ${n}`)})):(De(n),window.setTimeout(()=>{De(Q=>Q===n?null:Q)},3e3)))},va=n=>{d!==void 0&&(me===n?(te(null),_e("branch-delete",async()=>{await c(`${R}/branch-delete`,{session:d,name:n}),Ye(),await v(),Ee("ok",`🗑 ${n}`)})):(te(n),window.setTimeout(()=>{te(Q=>Q===n?null:Q)},3e3)))},wa=n=>{d!==void 0&&(me===n?(te(null),_e("remote-delete",async()=>{await c(`${R}/remote-delete`,{session:d,name:n}),Ye(),await v(),Ee("ok",`🗑 ${n}`)})):(te(n),window.setTimeout(()=>{te(Q=>Q===n?null:Q)},3e3)))},aa=()=>{d!==void 0&&(We(!0),f(`${R}/graph?session=${encodeURIComponent(d)}&limit=150`).then(Ke).catch(n=>{Ee("err",n instanceof Error?n.message:String(n))}).finally(()=>{We(!1)}))},ya=()=>{Ie(!0),aa()};if((0,o.useEffect)(()=>{if(!g)return;const n=ge=>{const ta=ge.target;ta!==null&&(na.current?.contains(ta)||ia.current?.contains(ta)||w(!1))},Q=ge=>{ge.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",n),document.addEventListener("keydown",Q),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",Q)}},[g]),!T||d===void 0||i!==null&&i.unresolved!==!0&&!i.isRepo)return null;if(i===null||i.unresolved===!0)return s===void 0||s===""?null:(0,e.jsx)("span",{className:"gbar","data-slot-plugin":"dsh-ui-tweaks-gitbar",children:(0,e.jsxs)("span",{className:"gbar-fchip",title:s,children:[(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z"})}),(0,e.jsx)("span",{className:"gbar-folder",children:k(s)})]})});const Ue=!i.clean;return(0,e.jsxs)("span",{className:"gbar","data-slot-plugin":"dsh-ui-tweaks-gitbar",children:[(0,e.jsxs)("span",{className:"gbar-fchip",title:s??i.cwd,children:[(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z"})}),(0,e.jsx)("span",{className:"gbar-folder",children:k(s??i.cwd)})]}),(0,e.jsxs)("span",{className:"gbar-bwrap",children:[(0,e.jsxs)("button",{type:"button",ref:na,className:"gbar-chip"+(g?" gbar-open":""),onClick:ua,title:a(Ue?"dirty":"clean"),"aria-expanded":g,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{className:"gbar-bname",children:i.branch??i.detachedHead??"—"}),Ue?(0,e.jsx)("span",{className:"gbar-chip-dot","aria-hidden":!0}):null]}),g?(0,e.jsxs)("div",{className:"gbar-pop",role:"menu","aria-label":i.branch??"git",ref:ia,children:[(0,e.jsxs)("div",{className:"gbar-pop-head",children:[(0,e.jsxs)("span",{className:"gbar-curname",title:a(Ue?"dirty":"clean"),children:[(0,e.jsxs)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{children:i.branch??i.detachedHead??"—"})]}),(0,e.jsxs)("span",{className:"gbar-state",children:[(0,e.jsx)("span",{className:"gbar-dot "+(Ue?"gbar-dirty":"gbar-clean"),"aria-hidden":!0}),i.ahead>0?(0,e.jsxs)("span",{children:["↑",i.ahead]}):null,i.behind>0?(0,e.jsxs)("span",{children:["↓",i.behind]}):null]}),i.branch!==null&&i.upstream!==void 0?(0,e.jsx)("button",{type:"button",className:"gbar-pull",onClick:pa,disabled:xe!==null,title:a("branchPull"),"aria-label":a("branchPull"),children:xe==="pull"?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M8 2.5v7.5"}),(0,e.jsx)("path",{d:"M4.6 6.9 8 10.3l3.4-3.4"}),(0,e.jsx)("path",{d:"M2.5 13.5h11"})]})}):null]}),(0,e.jsxs)("div",{className:"gbar-pop-body",children:[(0,e.jsxs)("div",{className:"gbar-sec",children:[a("branchLocal"),C!==null?(0,e.jsx)("span",{className:"gbar-count",children:C.local.length}):null]}),C===null?(0,e.jsxs)("div",{className:"gbar-loading",children:[(0,e.jsx)("span",{className:"gbar-spin"}),a("loading")]}):C.local.map(n=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row"+(n===C.current?" gbar-cur":""),onClick:()=>{oa(n)},children:[(0,e.jsxs)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M11.5 3.7v3a2.6 2.6 0 0 1-2.6 2.6H4.5"})]}),(0,e.jsx)("span",{children:n}),n===C.current?(0,e.jsx)("span",{className:"gbar-check","aria-hidden":!0,children:"✓"}):null]}),x(n)?null:(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{ba(n)},title:a("branchRename"),children:(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M11.3 2a1.9 1.9 0 0 1 2.7 2.7L6.4 12.3l-3.9 1.2 1.2-3.9L11.3 2Z"})})}),n!==C.current&&!x(n)?(0,e.jsx)("button",{type:"button",className:"gbar-del"+(me===n?" gbar-arm":""),onClick:()=>{va(n)},title:a("branchDelete"),children:me===n?a("branchDeleteConfirm"):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 4.5h11"}),(0,e.jsx)("path",{d:"M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2"}),(0,e.jsx)("path",{d:"M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2"})]})}):null]},n)),(0,e.jsxs)("div",{className:"gbar-sec",children:[a("branchRemote"),C!==null?(0,e.jsx)("span",{className:"gbar-count",children:C.remote.length}):null]}),C?.remote.map(n=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row"+(n===C.current?" gbar-cur":""),onClick:()=>{oa(n)},children:[(0,e.jsx)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M5.2 13a3.2 3.2 0 1 1 .5-6.36 4 4 0 0 1 7.75 1.06 2.65 2.65 0 0 1-.55 5.3H5.2Z"})}),(0,e.jsx)("span",{children:P(n)}),(0,e.jsx)("span",{className:"gbar-rm",children:n.split("/")[0]})]}),x(P(n))?null:(0,e.jsx)("button",{type:"button",className:"gbar-del"+(me===n?" gbar-arm":""),onClick:()=>{wa(n)},title:a("branchRemoteDelete"),children:me===n?a("branchDeleteConfirm"):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 4.5h11"}),(0,e.jsx)("path",{d:"M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2"}),(0,e.jsx)("path",{d:"M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2"})]})})]},n))]}),(0,e.jsxs)("div",{className:"gbar-actions",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-act",onClick:ha,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M4 2v8"}),(0,e.jsx)("circle",{cx:"12",cy:"4",r:"2"}),(0,e.jsx)("circle",{cx:"4",cy:"12",r:"2"}),(0,e.jsx)("path",{d:"M12 6a6 6 0 0 1-6 6"}),(0,e.jsx)("path",{d:"M12.5 10.5v4"}),(0,e.jsx)("path",{d:"M10.5 12.5h4"})]}),a("branchNew")]}),(0,e.jsxs)("button",{type:"button",className:"gbar-act",onClick:ya,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M4 2v12"}),(0,e.jsx)("path",{d:"M12 5.2C12 8.4 4 8.4 4 11.5"}),(0,e.jsx)("circle",{cx:"4",cy:"5",r:"1.7",fill:"currentColor",stroke:"none"}),(0,e.jsx)("circle",{cx:"12",cy:"3.5",r:"1.7",fill:"currentColor",stroke:"none"})]}),a("branchGraph")]}),(0,e.jsxs)("button",{type:"button",className:"gbar-act",onClick:ga,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 6.8V3.5a1 1 0 0 1 1-1h3.3c.27 0 .52.1.71.3l5.9 5.9a1 1 0 0 1 0 1.4l-3.9 3.9a1 1 0 0 1-1.4 0l-5.9-5.9a1 1 0 0 1-.3-.71Z"}),(0,e.jsx)("circle",{cx:"5.4",cy:"5.4",r:"0.5",fill:"currentColor",stroke:"none"})]}),a("tagsTitle")]})]})]}):null]}),Te?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&Ne(!1)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":a("branchNew"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("branchNew")}),(0,e.jsx)("span",{className:"gbar-branch",children:i.branch??i.detachedHead??"—"}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{Ne(!1)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:Y,onChange:n=>{be(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&la()},placeholder:a("branchNewPlaceholder"),"aria-label":a("branchNew"),autoFocus:!0}),(0,e.jsxs)("div",{className:"gbar-baserow",children:[(0,e.jsx)("label",{className:"gbar-baselabel",htmlFor:"gbar-base-dlg",children:a("branchFrom")}),(0,e.jsxs)("select",{id:"gbar-base-dlg",className:"gbar-base",value:ye,onChange:n=>{ve(n.target.value)},"aria-label":a("branchFrom"),children:[(0,e.jsx)("option",{value:"",children:a("branchFromHead")}),C?.local.map(n=>(0,e.jsx)("option",{value:n,children:n},n)),C?.remote.map(n=>(0,e.jsx)("option",{value:n,children:n},n))]})]}),(0,e.jsxs)("div",{className:"gbar-pushrow",children:[(0,e.jsx)("button",{type:"button",className:"gbar-chk"+(ue?"":" gbar-off"),onClick:()=>{we(n=>!n)},"aria-label":a("branchPushRemote"),children:ue?"✓":"✕"}),(0,e.jsx)("span",{className:"gbar-pushlabel",children:a("branchPushRemote")})]}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{Ne(!1)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:la,disabled:xe!==null||Y.trim()==="",children:[xe==="create"||xe==="create-push"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("branchCreate")]})]})]})}),document.body):null,ce!==null?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&Ce(null)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":a("branchRename"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("branchRename")}),(0,e.jsx)("span",{className:"gbar-branch",children:ce}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{Ce(null)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:Me,onChange:n=>{L(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&da()},placeholder:a("branchNewPlaceholder"),"aria-label":a("branchRename"),autoFocus:!0,onFocus:n=>{n.target.select()}}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{Ce(null)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:da,disabled:xe!==null||Me.trim()===""||Me.trim()===ce,children:[xe==="branch-rename"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("branchRename")]})]})]})}),document.body):null,Xe?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&He(!1)},children:(0,e.jsxs)("div",{className:"gbar-modal gbar-tags-modal",role:"dialog","aria-label":a("tagsTitle"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("tagsTitle")}),(0,e.jsx)("span",{className:"gbar-branch",children:i.branch??i.detachedHead??"—"}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{He(!1)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("div",{className:"gbar-tags-list",children:fe===null?(0,e.jsxs)("div",{className:"gbar-loading",children:[(0,e.jsx)("span",{className:"gbar-spin"}),a("loading")]}):fe.tags.length===0?(0,e.jsx)("div",{className:"gbar-graph-empty",children:a("noChanges")}):fe.tags.map(n=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("div",{className:"gbar-row",title:n.subject!==""?`${n.hash} ${n.subject}`:n.hash,children:[(0,e.jsxs)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 6.8V3.5a1 1 0 0 1 1-1h3.3c.27 0 .52.1.71.3l5.9 5.9a1 1 0 0 1 0 1.4l-3.9 3.9a1 1 0 0 1-1.4 0l-5.9-5.9a1 1 0 0 1-.3-.71Z"}),(0,e.jsx)("circle",{cx:"5.4",cy:"5.4",r:"0.5",fill:"currentColor",stroke:"none"})]}),(0,e.jsx)("span",{children:n.name}),(0,e.jsx)("span",{className:"gbar-rm",children:n.hash})]}),(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{fa(n.name)},title:a("tagPush"),children:(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M5.2 13a3.2 3.2 0 1 1 .5-6.36 4 4 0 0 1 7.75 1.06 2.65 2.65 0 0 1-.55 5.3H5.2Z"}),(0,e.jsx)("path",{d:"M8 9.5V3"}),(0,e.jsx)("path",{d:"M5.4 5.1 8 2.5l2.6 2.6"})]})}),(0,e.jsx)("button",{type:"button",className:"gbar-del"+($e===n.name?" gbar-arm":""),onClick:()=>{xa(n.name)},title:a("tagDelete"),children:$e===n.name?a("branchDeleteConfirm"):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 4.5h11"}),(0,e.jsx)("path",{d:"M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2"}),(0,e.jsx)("path",{d:"M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2"})]})})]},n.name))}),(0,e.jsx)("input",{value:oe,onChange:n=>{ke(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&Qe()},placeholder:a("tagCreatePlaceholder"),"aria-label":a("tagCreate")}),(0,e.jsx)("input",{value:Oe,onChange:n=>{qe(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&Qe()},placeholder:a("tagMessagePlaceholder"),"aria-label":a("tagMessagePlaceholder")}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{He(!1)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:Qe,disabled:xe!==null||oe.trim()==="",children:[xe==="tag-create"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("tagCreate")]})]})]})}),document.body):null,ze!==null?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&Ae(null)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":a("tagCreate"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("tagCreate")}),(0,e.jsxs)("span",{className:"gbar-branch",children:["#",ze.hash]}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{Ae(null)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:_,onChange:n=>{ie(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&ea()},placeholder:a("tagCreatePlaceholder"),"aria-label":a("tagCreate"),autoFocus:!0}),(0,e.jsx)("input",{value:pe,onChange:n=>{Se(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&ea()},placeholder:a("tagMessagePlaceholder"),"aria-label":a("tagMessagePlaceholder")}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{Ae(null)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:ea,disabled:xe!==null||_.trim()==="",children:[xe==="tag-create"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("tagCreate")]})]})]})}),document.body):null,Pe?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&Ie(!1)},children:(0,e.jsxs)("div",{className:"gbar-modal gbar-graph-modal",role:"dialog","aria-label":a("graphTitle"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("graphTitle")}),(0,e.jsx)("span",{className:"gbar-branch",children:i.branch??i.detachedHead??"—"}),(0,e.jsx)("span",{className:"gbar-spacer"}),(0,e.jsx)("button",{type:"button",className:"gbar-x gbar-refresh",onClick:aa,"aria-label":a("branchRefresh"),title:a("branchRefresh"),disabled:Le,children:Le?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M13.4 8a5.4 5.4 0 1 1-1.6-3.8"}),(0,e.jsx)("path",{d:"M13.4 1.5v3h-3"})]})}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{Ie(!1)},"aria-label":"✕",children:"✕"})]}),Re===null?(0,e.jsx)("div",{className:"gbar-graph-empty",children:a(Le?"loading":"noChanges")}):Fe===null||Fe.rows.length===0?(0,e.jsx)("div",{className:"gbar-graph-empty",children:a("noChanges")}):(0,e.jsxs)("div",{className:"gbar-graph-table",role:"table","aria-label":a("graphTitle"),children:[(0,e.jsxs)("div",{className:"gbar-graph-row gbar-graph-head",role:"row",children:[(0,e.jsx)("span",{className:"gbar-c-graph",role:"columnheader",children:a("graphColGraph")}),(0,e.jsx)("span",{className:"gbar-c-hash",role:"columnheader",children:a("graphColCommit")}),(0,e.jsx)("span",{className:"gbar-c-subject",role:"columnheader",children:a("graphColSubject")}),(0,e.jsx)("span",{className:"gbar-c-author",role:"columnheader",children:a("graphColAuthor")}),(0,e.jsx)("span",{className:"gbar-c-date",role:"columnheader",children:a("graphColDate")}),(0,e.jsx)("span",{className:"gbar-c-tag",role:"columnheader"})]}),Fe.rows.map((n,Q)=>{const ge=Re.commits[Q];return ge===void 0?null:(0,e.jsxs)("div",{className:"gbar-graph-row",role:"row",children:[(0,e.jsx)("span",{className:"gbar-c-graph",role:"cell",children:(0,e.jsx)(M,{row:n,lanes:Fe.lanes})}),(0,e.jsx)("span",{className:"gbar-c-hash",role:"cell",children:(0,e.jsx)("code",{className:"gbar-hash",children:ge.hash})}),(0,e.jsxs)("span",{className:"gbar-c-subject",role:"cell",children:[(0,e.jsx)("span",{className:"gbar-subject",children:ge.subject}),ge.refs!==""?(0,e.jsx)("span",{className:"gbar-refs",children:ge.refs}):null]}),(0,e.jsx)("span",{className:"gbar-c-author",role:"cell",children:ge.author}),(0,e.jsx)("span",{className:"gbar-c-date",role:"cell",title:ge.date,children:ge.dateRelative}),(0,e.jsx)("span",{className:"gbar-c-tag",role:"cell",children:(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{ma(ge.fullHash,ge.hash)},title:a("tagCreate"),children:(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 6.8V3.5a1 1 0 0 1 1-1h3.3c.27 0 .52.1.71.3l5.9 5.9a1 1 0 0 1 0 1.4l-3.9 3.9a1 1 0 0 1-1.4 0l-5.9-5.9a1 1 0 0 1-.3-.71Z"}),(0,e.jsx)("circle",{cx:"5.4",cy:"5.4",r:"0.5",fill:"currentColor",stroke:"none"})]})})})]},ge.fullHash)})]})]})}),document.body):null,Je!==null?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-notice gbar-"+Je.kind,role:"status",children:Je.text}),document.body):null]})}function J({sessionId:l,useSession:N,controller:b,t:a}){const T=(0,o.useSyncExternalStore)(b.subscribe,b.getSnapshot,b.getSnapshot).value?.gitBarEnabled??!0,d=String(l),r=N(_=>_.running)??!1,[t,u]=Z(T,{session:d}),[s,i]=(0,o.useState)(null),[v,g]=(0,o.useState)("hunk"),[w,C]=(0,o.useState)(null),[V,Y]=(0,o.useState)(0),[be,ue]=(0,o.useState)(""),[we,me]=(0,o.useState)(""),[te,ye]=(0,o.useState)(null),[ve,Te]=(0,o.useState)(null),[Ne,ce]=(0,o.useState)(new Set),[Ce,Me]=(0,o.useState)(null),[L,fe]=(0,o.useState)(null),[E,oe]=(0,o.useState)(null),ke=(_,ie)=>{Te({kind:_,text:ie}),window.setTimeout(()=>Te(null),4e3)},Oe=async(_,ie)=>{if(te!==null)return!1;ye(_);try{return await ie(),!0}catch(pe){return ke("err",pe instanceof Error?pe.message:String(pe)),!1}finally{ye(null)}},qe=_=>{ce(ie=>{const pe=new Set(ie);return pe.has(_)?pe.delete(_):pe.add(_),pe})};(0,o.useEffect)(()=>{u()},[]),(0,o.useEffect)(()=>{C(_=>_??t?.files[0]?.path??null)},[t]);const Xe=_=>{C(_)},He=_=>{g(_)},$e=()=>{Oe("refresh",async()=>{await u(),Y(_=>_+1)})};(0,o.useEffect)(()=>{if(d===void 0||w===null)return;let _=!1;return i(null),f(`${R}/diff?${m({session:d})}&file=${encodeURIComponent(w)}&mode=${v}`).then(ie=>{_||i(ie)}).catch(ie=>{_||ke("err",ie instanceof Error?ie.message:String(ie))}),()=>{_=!0}},[d,w,v,V]);const De=_=>{r||Oe(_?"commit-push":"commit",async()=>{const ie=be.trim();if(ie===""){ke("err",a("commitEmpty"));return}const pe=we.trim(),Se=await c(`${R}/commit`,{session:d,message:ie,push:_,exclude:[...Ne],...pe!==""?{tag:pe}:{}});ue(""),me(""),ce(new Set),await u();const Pe=Se.tag!==void 0?` · 🏷 ${Se.tag}`:"";ke("ok",_?`✓ ${Se.hash??"committed"} · pushed${Pe}`:`✓ ${Se.hash??"committed"}${Pe}`)})},ze=(_,ie)=>{ie.preventDefault();const pe=document.querySelector(".gbar-view"),Se=Fe=>{const xe=pe?.querySelector(Fe)??null;return xe===null?0:xe.getBoundingClientRect().height},Pe=ie.clientY,Ie=Se(".gbar-files"),Re=Se(".gbar-side-commit"),Ke=Se(".gbar-diff");oe(_);const Le=Fe=>{const xe=Fe.clientY-Pe;if(_==="files"){const Be=Math.max(ee,Ie+Ke-B);Me(Math.round(Math.min(Be,Math.max(ee,Ie+xe))))}else{const Be=Math.max(p,Re+Ke-B);fe(Math.round(Math.min(Be,Math.max(p,Re-xe))))}},We=()=>{oe(null),window.removeEventListener("pointermove",Le),window.removeEventListener("pointerup",We)};window.addEventListener("pointermove",Le),window.addEventListener("pointerup",We)};if(!T||d===void 0)return null;if(t!==null&&!t.isRepo)return(0,e.jsx)("div",{className:"gbar-view",children:(0,e.jsx)("div",{className:"gbar-view-empty",children:a("notRepo")})});if(t===null)return(0,e.jsxs)("div",{className:"gbar-view",children:[(0,e.jsxs)("div",{className:"gbar-side-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("diffView")}),(0,e.jsx)("span",{className:"gbar-spacer"})]}),(0,e.jsx)("div",{className:"gbar-side-body",children:(0,e.jsx)("div",{className:"gbar-diff",children:(0,e.jsxs)("div",{className:"gbar-empty",children:[(0,e.jsx)("span",{className:"gbar-spin"})," ",a("loading")]})})})]});const Ae=!t.clean;return(0,e.jsxs)("div",{className:"gbar-view",children:[(0,e.jsxs)("div",{className:"gbar-side-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:w??a("diffView")}),(0,e.jsxs)("span",{className:"gbar-sub",children:[t.files.length," ",a("diffFiles")," · ",(0,e.jsxs)("span",{className:"gbar-a",children:["+",t.totalAdded]})," ",(0,e.jsxs)("span",{className:"gbar-d",children:["−",t.totalDeleted]})]}),(0,e.jsx)("span",{className:"gbar-spacer"}),(0,e.jsxs)("div",{className:"gbar-seg",role:"group",children:[(0,e.jsx)("button",{type:"button",className:v==="hunk"?"gbar-on":"",onClick:()=>{He("hunk")},children:a("diffOnly")}),(0,e.jsx)("button",{type:"button",className:v==="full"?"gbar-on":"",onClick:()=>{He("full")},children:a("diffFull")})]}),(0,e.jsx)("button",{type:"button",className:"gbar-side-half",onClick:$e,disabled:te!==null,title:a("branchRefresh"),"aria-label":a("branchRefresh"),children:te==="refresh"?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M13.4 8a5.4 5.4 0 1 1-1.6-3.8"}),(0,e.jsx)("path",{d:"M13.4 1.5v3h-3"})]})})]}),(0,e.jsxs)("div",{className:"gbar-side-body",children:[(0,e.jsx)("div",{className:"gbar-files",style:Ce===null?{maxHeight:se}:{height:Ce,maxHeight:y},children:t.files.map(_=>{const ie=Ne.has(_.path),pe=_.path.lastIndexOf("/"),Se=pe>=0?_.path.slice(0,pe+1):"",Pe=pe>=0?_.path.slice(pe+1):_.path;return(0,e.jsxs)("div",{className:"gbar-file"+(w===_.path?" gbar-on":"")+(ie?" gbar-excl":""),children:[(0,e.jsx)("button",{type:"button",className:"gbar-chk"+(ie?" gbar-off":""),onClick:()=>{qe(_.path)},"aria-label":a(ie?"excludeFile":"includeFile"),children:ie?"✕":"✓"}),(0,e.jsxs)("button",{type:"button",className:"gbar-file-main",onClick:()=>{Xe(_.path)},title:_.path,children:[(0,e.jsx)("span",{className:"gbar-st "+D(_.status),children:H(_.status)}),(0,e.jsxs)("span",{className:"gbar-path",children:[Se!==""?(0,e.jsx)("span",{className:"gbar-dir",children:Se}):null,(0,e.jsx)("span",{children:Pe})]}),(0,e.jsxs)("span",{className:"gbar-nums",children:[(0,e.jsxs)("span",{className:"gbar-a",children:["+",_.added]})," ",(0,e.jsxs)("span",{className:"gbar-d",children:["−",_.deleted]})]})]})]},_.path)})}),(0,e.jsx)("div",{className:"gbar-vsplit"+(E==="files"?" gbar-dragging":""),role:"separator","aria-orientation":"horizontal",title:"拖动调整文件列表高度(双击复位)",onPointerDown:_=>{ze("files",_)},onDoubleClick:()=>{Me(null)}}),s===null?(0,e.jsx)("div",{className:"gbar-diff",children:(0,e.jsx)("div",{className:"gbar-empty",children:t.clean||t.files.length===0?a("clean"):a("loading")})}):s.lines.length===0?(0,e.jsx)("div",{className:"gbar-diff",children:(0,e.jsx)("div",{className:"gbar-empty",children:a("noChanges")})}):(0,e.jsxs)("div",{className:"gbar-diff",children:[s.lines.map((_,ie)=>(0,e.jsxs)("div",{className:"gbar-line gbar-"+_.type,children:[(0,e.jsx)("span",{className:"gbar-ln",children:_.old??""}),(0,e.jsx)("span",{className:"gbar-ln",children:_.new??""}),(0,e.jsx)("span",{className:"gbar-code",children:_.text})]},ie)),s.truncated?(0,e.jsx)("div",{className:"gbar-empty",children:"…"}):null]}),Ae?(0,e.jsx)("div",{className:"gbar-vsplit"+(E==="commit"?" gbar-dragging":""),role:"separator","aria-orientation":"horizontal",title:"拖动调整提交区高度(双击复位)",onPointerDown:_=>{ze("commit",_)},onDoubleClick:()=>{fe(null)}}):null]}),(0,e.jsxs)("div",{className:"gbar-side-foot",children:[(0,e.jsx)("span",{className:"gbar-dot"}),t.branch??"—"," · ",a(Ae?"dirty":"clean")]}),Ae?(0,e.jsxs)("div",{className:"gbar-side-commit",style:L===null?void 0:{height:L,maxHeight:y},children:[(0,e.jsx)("div",{className:"gbar-crow",children:(0,e.jsx)("textarea",{value:be,onChange:_=>{ue(_.target.value)},onKeyDown:_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),De(!1))},placeholder:a("commitPlaceholder"),"aria-label":a("commitMessage"),rows:1})}),(0,e.jsxs)("div",{className:"gbar-actions",children:[(0,e.jsx)("input",{className:"gbar-taginput",value:we,onChange:_=>{me(_.target.value)},onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),De(!1))},placeholder:a("tagCommitPlaceholder"),"aria-label":a("tagCommitPlaceholder")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-soft",onClick:()=>{De(!1)},disabled:te!==null||r,title:r?a("commitBusy"):void 0,children:[te==="commit"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("commitSubmit")]}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:()=>{De(!0)},disabled:te!==null||r,title:r?a("commitBusy"):void 0,children:[te==="commit-push"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("commitSubmitPush")]})]})]}):null,ve!==null?(0,e.jsx)("div",{className:"gbar-notice gbar-"+ve.kind,role:"status",children:ve.text}):null]})}function le({sessionId:l,controller:N,t:b}){const h=(0,o.useSyncExternalStore)(N.subscribe,N.getSnapshot,N.getSnapshot).value?.gitBarEnabled??!0,[T]=Z(h,{session:String(l)}),d=T!==null&&T.isRepo&&!T.clean;return(0,e.jsxs)("span",{children:[b("diffView"),d?(0,e.jsx)("span",{className:"gbar-tab-dot","aria-hidden":!0}):null]})}const ae='[class$="_workspace"]';function de({t:l,right:N,top:b}){const a=(0,o.useMemo)(()=>document.querySelector(ae)?.textContent?.trim()??"",[]),[h,T]=Z(!0,{ws:a}),[d,r]=(0,o.useState)(!1),[t,u]=(0,o.useState)(null),[s,i]=(0,o.useState)(null),[v,g]=(0,o.useState)(null),[w,C]=(0,o.useState)(""),[V,Y]=(0,o.useState)(null),[be,ue]=(0,o.useState)(null),we=(0,o.useRef)(null),me=(0,o.useRef)(null),te=(E,oe)=>{ue({kind:E,text:oe}),window.setTimeout(()=>ue(null),4e3)},ye=async(E,oe)=>{if(V!==null)return!1;Y(E);try{return await oe(),!0}catch(ke){return te("err",ke instanceof Error?ke.message:String(ke)),!1}finally{Y(null)}},ve=()=>{f(`${R}/branches?${m({ws:a})}`).then(u).catch(E=>{te("err",E instanceof Error?E.message:String(E))})},Te=E=>{E!==t?.current&&ye("checkout",async()=>{await c(`${R}/checkout`,{ws:a,branch:E}),r(!1),await T(),ve(),te("ok",`→ ${E}`)})},Ne=()=>{const E=h?.upstream??h?.branch??"";ye("pull",async()=>{await c(`${R}/pull`,{ws:a}),r(!1),await T(),te("ok",`⬇ ${E}`)})},ce=E=>{s===E?(i(null),ye("branch-delete",async()=>{await c(`${R}/branch-delete`,{ws:a,name:E}),ve(),te("ok",`🗑 ${E}`)})):(i(E),window.setTimeout(()=>{i(oe=>oe===E?null:oe)},3e3))},Ce=E=>{s===E?(i(null),ye("remote-delete",async()=>{await c(`${R}/remote-delete`,{ws:a,name:E}),ve(),te("ok",`🗑 ${E}`)})):(i(E),window.setTimeout(()=>{i(oe=>oe===E?null:oe)},3e3))},Me=E=>{i(null),C(E),g(E)},L=()=>{if(v===null)return;const E=v,oe=w.trim();if(oe===""||oe===E){g(null);return}ye("branch-rename",async()=>{await c(`${R}/branch-rename`,{ws:a,name:E,newName:oe}),g(null),ve(),await T(),te("ok",`✎ ${E} → ${oe}`)})};if((0,o.useEffect)(()=>{if(!d)return;const E=ke=>{const Oe=ke.target;Oe!==null&&(we.current?.contains(Oe)||me.current?.contains(Oe)||r(!1))},oe=ke=>{ke.key==="Escape"&&r(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",oe),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",oe)}},[d]),h===null||!h.isRepo)return null;const fe=!h.clean;return(0,e.jsxs)("div",{className:"gbar-hero",style:{top:b,right:N},children:[(0,e.jsxs)("span",{className:"gbar-fchip",title:h.cwd,children:[(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z"})}),(0,e.jsx)("span",{className:"gbar-folder",children:k(h.cwd)})]}),(0,e.jsxs)("span",{className:"gbar-bwrap",children:[(0,e.jsxs)("button",{type:"button",ref:we,className:"gbar-chip"+(d?" gbar-open":""),onClick:()=>{r(E=>(E||ve(),!E))},title:l(fe?"dirty":"clean"),"aria-expanded":d,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{className:"gbar-bname",children:h.branch??h.detachedHead??"—"})]}),d?(0,e.jsxs)("div",{className:"gbar-pop",ref:me,role:"menu",children:[(0,e.jsxs)("div",{className:"gbar-pop-head",children:[(0,e.jsxs)("svg",{style:{width:14,height:14,color:"var(--dsw-alias-state-business-primary)",flex:"none"},viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{className:"cname",children:h.branch??h.detachedHead??"—"}),(0,e.jsxs)("span",{className:"state",children:[(0,e.jsx)("span",{style:{width:6,height:6,borderRadius:999,background:fe?"var(--dsw-alias-state-warn-primary)":"var(--dsw-alias-state-success-primary)"}}),h.ahead>0?(0,e.jsxs)("span",{children:["↑",h.ahead]}):null,h.behind>0?(0,e.jsxs)("span",{children:["↓",h.behind]}):null]}),h.branch!==null&&h.upstream!==void 0?(0,e.jsx)("button",{type:"button",className:"gbar-pull",style:{marginLeft:"auto"},onClick:Ne,disabled:V!==null,title:l("branchPull"),"aria-label":l("branchPull"),children:V==="pull"?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M8 2.5v7.5"}),(0,e.jsx)("path",{d:"M4.6 6.9 8 10.3l3.4-3.4"}),(0,e.jsx)("path",{d:"M2.5 13.5h11"})]})}):null]}),(0,e.jsxs)("div",{className:"gbar-pop-body",children:[(0,e.jsxs)("div",{className:"gbar-sec",children:[l("branchLocal"),t!==null?(0,e.jsx)("span",{className:"gbar-count",children:t.local.length}):null]}),t===null?(0,e.jsxs)("div",{className:"gbar-loading",children:[(0,e.jsx)("span",{className:"gbar-spin"}),l("loading")]}):t.local.map(E=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row"+(E===t.current?" gbar-cur":""),onClick:()=>{Te(E)},children:[(0,e.jsx)("span",{children:E}),E===t.current?(0,e.jsx)("span",{className:"gbar-check","aria-hidden":!0,children:"✓"}):null]}),x(E)?null:(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{Me(E)},title:l("branchRename"),children:(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M11.3 2a1.9 1.9 0 0 1 2.7 2.7L6.4 12.3l-3.9 1.2 1.2-3.9L11.3 2Z"})})}),E!==t.current&&!x(E)?(0,e.jsx)("button",{type:"button",className:"gbar-del"+(s===E?" gbar-arm":""),onClick:()=>{ce(E)},title:l("branchDelete"),children:s===E?l("branchDeleteConfirm"):"🗑"}):null]},E)),(0,e.jsxs)("div",{className:"gbar-sec",children:[l("branchRemote"),t!==null?(0,e.jsx)("span",{className:"gbar-count",children:t.remote.length}):null]}),t?.remote.map(E=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row",onClick:()=>{Te(P(E))},children:[(0,e.jsx)("span",{children:P(E)}),(0,e.jsx)("span",{className:"gbar-rm",children:E.split("/")[0]})]}),x(P(E))?null:(0,e.jsx)("button",{type:"button",className:"gbar-del"+(s===E?" gbar-arm":""),onClick:()=>{Ce(E)},title:l("branchRemoteDelete"),children:s===E?l("branchDeleteConfirm"):"🗑"})]},E))]})]}):null]}),be!==null?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-notice gbar-"+be.kind,role:"status",children:be.text}),document.body):null,v!==null?(0,z.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:E=>{E.target===E.currentTarget&&g(null)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":l("branchRename"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:l("branchRename")}),(0,e.jsx)("span",{className:"gbar-branch",children:v}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{g(null)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:w,onChange:E=>{C(E.target.value)},onKeyDown:E=>{E.key==="Enter"&&L()},placeholder:l("branchNewPlaceholder"),"aria-label":l("branchRename"),autoFocus:!0,onFocus:E=>{E.target.select()}}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{g(null)},children:l("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:L,disabled:V!==null||w.trim()===""||w.trim()===v,children:[V==="branch-rename"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",l("branchRename")]})]})]})}),document.body):null]})}function G(l,N){const b=document.createElement("div");b.dataset.plugin="dsh-ui-tweaks-gitbar-hero",document.body.appendChild(b);const a=(0,F.createRoot)(b);let h=null;const T=()=>{const s=l.getSnapshot().value?.gitBarEnabled??!0;a.render(h===null||!s?null:(0,e.jsx)(de,{t:N,right:h.right,top:h.top}))},d=()=>{const s=document.querySelector(ae);h=s===null?null:(()=>{const i=s.getBoundingClientRect();return{right:Math.max(0,Math.round(window.innerWidth-i.left+8)),top:Math.round(i.top+i.height/2)}})(),T()};let r=0;const t=new MutationObserver(()=>{cancelAnimationFrame(r),r=requestAnimationFrame(d)});t.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("resize",d);const u=l.subscribe(T);return d(),()=>{t.disconnect(),cancelAnimationFrame(r),window.removeEventListener("resize",d),u(),a.render(null),b.remove()}}},je["./graphlayout.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.GRAPH_ROW_H=j.GRAPH_LANE_W=j.GRAPH_PALETTE=void 0,j.layoutCommitGraph=e,j.GRAPH_PALETTE=["#4c8dff","#8b5cf6","#10b981","#f59e0b","#ec4899","#06b6d4","#f97316","#84cc16"],j.GRAPH_LANE_W=13,j.GRAPH_ROW_H=28;function e(o){const z=[],F=[];let K=0;const R=()=>j.GRAPH_PALETTE[K++%j.GRAPH_PALETTE.length],U=[];let se=0;for(const ee of o){const B=[];let p=z.indexOf(ee.fullHash),y;const M=p!==-1;p===-1?(p=z.indexOf(null),p===-1&&(p=z.length,z.push(null),F.push(null)),y=R(),F[p]=y):y=F[p]??R(),z[p]=null,M&&B.push({from:p,to:p,color:y,kind:"in"});for(let f=0;f<z.length;f++)f!==p&&z[f]!==null&&B.push({from:f,to:f,color:F[f]??R(),kind:"pass"});for(const[f,c]of(ee.parents??[]).entries()){let m=z.indexOf(c),k;m!==-1?k=F[m]??R():f===0&&z[p]===null?(m=p,k=y,F[m]=y):(m=z.indexOf(null),m===-1&&(m=z.length,z.push(null),F.push(null)),k=m===p?y:R(),F[m]=k),z[m]=c,B.push({from:p,to:m,color:k,kind:"out"})}se=Math.max(se,z.length),U.push({dot:p,color:y,edges:B})}return{rows:U,lanes:se}}},je["./icons.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.DiffIcon=o;const e=q("react/jsx-runtime");function o({size:z=16,className:F}){return(0,e.jsxs)("svg",{width:z,height:z,className:F,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)("path",{d:"M9.5 1.5H4A1.5 1.5 0 0 0 2.5 3v10A1.5 1.5 0 0 0 4 14.5h8A1.5 1.5 0 0 0 13.5 13V5.5l-4-4Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M9.5 1.5V5.5h4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M5.75 10h4.5M5.75 7.5h2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}},je["./index.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.inject=j.SettingsClient=void 0,j.apply=d;const e=q("react/jsx-runtime"),o=q("react"),z=q("react-dom"),F=re("./gitbar.js"),K=re("./icons.js"),R=re("./archive.js"),U=re("./mcp.js"),se=re("./search.js"),ee=re("./timeline.js"),B=re("./cachehit.js"),p=re("./effort.js"),y=re("./notifier.js"),M="ui-tweaks",f="/_dsh/ui-tweaks/settings",c=81,m=11,k=8,S=32,P=12/11,x=1,H=19,D=16,O="dsh-ui-tweaks-code-font-scope",A={nav:"UI Tweaks",settingsTitle:"UI Tweaks",settingsIntro:"Tune the conversation UI — code size, tables and layout, plus optional features: git bar, archive & MCP managers and the /init command. Changes apply live.",sectionText:"Text",sectionLayout:"Layout",sectionFeatures:"Features",codeFontSize:"Code font size",codeFontSizeHint:`Absolute code size in px (${k}–${S}); ${m}px is DSH's default at a 14px body. Applies to code blocks; inline code follows proportionally.`,timeline:"Timeline",timelineHint:"Native: DSH’s built-in turn rail at the right edge (stock). Web (classic): the v0.11 right-side navigation rail — hover to preview, click to jump; auto-hidden in short conversations.",timelineNative:"Native",timelineWeb:"Web (classic)",theme:"Theme",themeHint:"Conversation skin. Default keeps DSH’s stock look; Minimal leaves the stock look alone and only tints markdown inline code with the Anthropic red (#c15f3c in light, #d97757 in dark); Neon poster is a two-scheme skin — paper-white with ink-black hairlines in light mode, near-black with light hairlines in dark mode, lime highlights and an Anthropic-red action accent, applied live.",themeDefault:"Default",themeMinimal:"Minimal",themeNeonLime:"Neon poster",sectionSearch:"Web search",searchOn:"On",searchOff:"Off",searchEnabled:"Web search",searchEnabledHint:'Takes over the built-in web_search tool with this plugin’s multi-engine provider, and adds a "搜索" settings page for the engine picker and per-platform API keys. Off restores the stock backend.',searchNav:"Search",searchTitle:"Web search",searchIntro:"Pick the preferred engine for the built-in web_search tool; any engine that fails falls through to the next one automatically.",sectionKeys:"API keys",keyFree:"FREE",keyOptional:"KEY OPTIONAL",keyRequired:"KEY REQUIRED",keyConfigured:"Configured",keyNotConfigured:"Not configured",keySave:"Save",keyClear:"Clear",keySaved:"Key saved.",keyCleared:"Key cleared.",keyEnvHint:"Keys are stored in the credentials center, one per line:",searchTest:"Test engine",searchTesting:"Testing…",searchTestOk:"Engine works",searchTestFail:"Engine failed",searchEngine:"Search engine",searchEngineHint:"Backend for the built-in web_search tool. Free engines (Bing, DuckDuckGo) need no key; Exa / Tavily / Keenable use their keyless anonymous quota without one; Perplexity and DeepSeek require a key.",searchEngineBing:"Bing (free)",searchEngineDdg:"DuckDuckGo (free)",searchEngineExa:"Exa",searchEngineTavily:"Tavily",searchEngineKeenable:"Keenable",searchEnginePerplexity:"Perplexity",searchEngineDeepseek:"DeepSeek",bingMarket:"Bing market",bingMarketHint:"Market code for Bing results, e.g. zh-CN or en-US.",searchKeysHint:"API keys live in ~/.dsh/.credentials.yaml, one per line: EXA_API_KEY / TAVILY_API_KEY / KEENABLE_API_KEY / PERPLEXITY_API_KEY / DEEPSEEK_API_KEY: sk-.... Keys resolve from the credentials center first, then environment variables.",gitBar:"Git bar",gitBarHint:"Branch / diff pills above the input inside git repos, with branch management and commit & push; auto-hidden outside git.",gitBarOn:"On",gitBarOff:"Off",archiveManager:"Archive manager",archiveManagerHint:"An Archive settings page to restore or permanently delete archived sessions.",archiveManagerOn:"On",archiveManagerOff:"Off",mcpManager:"MCP manager",mcpManagerHint:"An MCP settings page listing servers with status and tools; edit and restart them.",mcpManagerOn:"On",mcpManagerOff:"Off",mcpNav:"MCP",mcpTitle:"MCP servers",mcpEmpty:"No MCP servers configured.",mcpStatusActive:"Running",mcpStatusFailed:"Failed",mcpStatusLoading:"Loading",mcpStatusStopped:"Stopped",mcpStatusDisabled:"Disabled",mcpTools:"tools",mcpEnv:"Env",mcpAdd:"Add server",mcpAddTitle:"Add MCP server",mcpEditTitle:"Edit MCP server",mcpEdit:"Edit",mcpDelete:"Delete",mcpEnabledAction:"Enable",mcpDisabledAction:"Disable",mcpSaved:"Saved.",mcpRemoved:"Removed.",mcpFormTab:"Form",mcpYamlTab:"YAML",mcpYamlHint:"Fill in the MCP config directly (serverName / transport / command / args / env / toolCallTimeoutMs / url / headers …). It is validated before saving.",mcpYamlPlaceholder:`serverName: my-server
504
+ `;function C(){const c="dsh-ui-tweaks-gitbar";if(document.querySelector(`style[data-plugin-css="${c}"]`)!==null)return()=>{};const m=document.createElement("style");return m.dataset.plugin="dsh-ui-tweaks",m.dataset.pluginCss=c,m.textContent=j.GITBAR_CSS,document.head.appendChild(m),()=>{m.remove()}}function R(c){const x=c.lastIndexOf("/");return x>=0&&c.startsWith("origin/")?c.slice(x+1):c}function w(c){return c==="main"||c==="master"}function P(c){return c==="U"?"U":c.length>1?c[0]??"M":c}function H(c){const x=P(c);return x==="A"?"gbar-a":x==="D"?"gbar-d":x==="U"?"gbar-u":"gbar-m"}const D=new Map;try{window.localStorage.removeItem("dsh-ui-tweaks.git.snapshots.v1")}catch{}const A=new Map;function B(c){const x=c.session??c.ws??"";if(x===""||D.has(x)||A.has(x))return;const m=f(`${F}/status?${g(c)}`).then(a=>{a.unresolved||D.set(x,a)}).catch(()=>{}).finally(()=>{A.delete(x)});A.set(x,m)}function W({sessionId:c}){return(0,o.useEffect)(()=>{B({session:String(c)})},[c]),null}const G=[400,800,1600,3200],ne=6;function V(c,x){const m=x.session??x.ws??"",[a,h]=(0,o.useState)(()=>D.get(m)??null);(0,o.useEffect)(()=>{if(!c||m===""){h(null);return}h(D.get(m)??null);let l=!1,S,s,t=0,u=D.has(m);const r=v=>v.unresolved===!0?(!l&&!u&&h(null),!1):(u=!0,t=0,D.set(m,v),l||h(v),!0),i=async()=>{try{return r(await f(`${F}/status?${g(x)}`))}catch{return u}},b=()=>{if(l||u||t>=ne)return;const v=G[Math.min(t,G.length-1)]??3200;t+=1,s=window.setTimeout(()=>{l||i().then(M=>{M||b()})},v)};return i().then(v=>{v||b()}),S=window.setInterval(()=>{document.visibilityState==="visible"&&i()},U),()=>{l=!0,S!==void 0&&clearInterval(S),s!==void 0&&clearTimeout(s)}},[c,m]);const T=(0,o.useCallback)(async()=>{if(m!=="")try{const l=await f(`${F}/status?${g(x)}`);l.unresolved||(D.set(m,l),h(l))}catch{}},[x.session,x.ws]);return[a,T]}function Z({sessionId:c,sessionsService:x,controller:m,t:a}){const T=(0,o.useSyncExternalStore)(m.subscribe,m.getSnapshot,m.getSnapshot).value?.gitBarEnabled??!0,l=String(c),S={session:l},s=x.list,t=(0,o.useMemo)(()=>s.subscribe.bind(s),[s]),u=(0,o.useSyncExternalStore)(t,()=>s.getSnapshot().byId[c]?.cwd,()=>{}),[r,i]=V(T,S),[b,v]=(0,o.useState)(!1),[M,O]=(0,o.useState)(null),[J,ie]=(0,o.useState)(""),[pe,ve]=(0,o.useState)(!1),[ge,te]=(0,o.useState)(null),[we,xe]=(0,o.useState)(""),[Te,ye]=(0,o.useState)(!1),[Se,de]=(0,o.useState)(null),[Ee,Me]=(0,o.useState)(""),[I,N]=(0,o.useState)(null),[oe,ke]=(0,o.useState)(""),[Oe,qe]=(0,o.useState)(""),[Xe,He]=(0,o.useState)(!1),[$e,De]=(0,o.useState)(null),[ze,Ae]=(0,o.useState)(null),[_,le]=(0,o.useState)(""),[he,Ne]=(0,o.useState)(""),[Pe,Ie]=(0,o.useState)(!1),[Re,Ke]=(0,o.useState)(null),[Le,We]=(0,o.useState)(!1),Fe=(0,o.useMemo)(()=>Re===null?null:(0,Y.layoutCommitGraph)(Re.commits),[Re]),[fe,Be]=(0,o.useState)(null),[Je,sa]=(0,o.useState)(null),na=(0,o.useRef)(null),ia=(0,o.useRef)(null);(0,o.useEffect)(()=>{(!T||l===void 0)&&(v(!1),ye(!1),de(null),He(!1),Ae(null),De(null),Ie(!1))},[T,l]);const Ce=(n,Q)=>{sa({kind:n,text:Q}),window.setTimeout(()=>sa(null),4e3)},_e=async(n,Q)=>{if(fe!==null)return!1;Be(n);try{return await Q(),!0}catch(me){return Ce("err",me instanceof Error?me.message:String(me)),!1}finally{Be(null)}},Ye=()=>{l!==void 0&&f(`${F}/branches?${g(S)}`).then(O).catch(n=>{Ce("err",n instanceof Error?n.message:String(n))})},Ge=()=>{l!==void 0&&f(`${F}/tags?${g(S)}`).then(N).catch(n=>{Ce("err",n instanceof Error?n.message:String(n))})},ua=()=>{const n=!b;v(n),n&&(Ye(),Ge())},oa=n=>{l===void 0||n===M?.current||_e("checkout",async()=>{await d(`${F}/checkout`,{session:l,branch:n}),v(!1),await i(),Ce("ok",`→ ${n}`)})},pa=()=>{if(l===void 0)return;const n=r?.upstream??r?.branch??"";_e("pull",async()=>{await d(`${F}/pull`,{session:l}),v(!1),await i(),Ce("ok",`⬇ ${n}`)})},la=()=>{l===void 0||J.trim()===""||_e(pe?"create-push":"create",async()=>{await d(`${F}/create`,{session:l,name:J.trim(),base:we===""?void 0:we,push:pe}),v(!1),ye(!1),ie(""),ve(!1),xe(""),await i(),pe&&Ce("ok",`☁ ${J.trim()}`)})},ha=()=>{ie(""),xe(""),ve(!1),ye(!0)},ba=n=>{te(null),Me(n),de(n)},da=()=>{if(l===void 0||Se===null)return;const n=Se,Q=Ee.trim();if(Q===""||Q===n){de(null);return}_e("branch-rename",async()=>{await d(`${F}/branch-rename`,{session:l,name:n,newName:Q}),de(null),Ye(),await i(),Ce("ok",`✎ ${n} → ${Q}`)})},ma=()=>{Ge(),He(!0)},Qe=()=>{if(l===void 0)return;const n=oe.trim();if(n==="")return;const Q=Oe.trim();_e("tag-create",async()=>{await d(`${F}/tag-create`,{session:l,name:n,...Q!==""?{message:Q}:{}}),ke(""),qe(""),Ge(),Ce("ok",`🏷 ${n}`)})},ga=(n,Q)=>{le(""),Ne(""),Ae({ref:n,hash:Q})},ea=()=>{if(l===void 0||ze===null)return;const n=_.trim();if(n==="")return;const Q=he.trim();_e("tag-create",async()=>{await d(`${F}/tag-create`,{session:l,name:n,ref:ze.ref,...Q!==""?{message:Q}:{}}),Ae(null),Ge(),aa(),Ce("ok",`🏷 ${n}`)})},fa=n=>{l!==void 0&&_e("tag-push",async()=>{await d(`${F}/tag-push`,{session:l,name:n}),Ce("ok",`☁ ${n}`)})},xa=n=>{l!==void 0&&($e===n?(De(null),_e("tag-delete",async()=>{await d(`${F}/tag-delete`,{session:l,name:n}),Ge(),Ce("ok",`🗑 ${n}`)})):(De(n),window.setTimeout(()=>{De(Q=>Q===n?null:Q)},3e3)))},va=n=>{l!==void 0&&(ge===n?(te(null),_e("branch-delete",async()=>{await d(`${F}/branch-delete`,{session:l,name:n}),Ye(),await i(),Ce("ok",`🗑 ${n}`)})):(te(n),window.setTimeout(()=>{te(Q=>Q===n?null:Q)},3e3)))},wa=n=>{l!==void 0&&(ge===n?(te(null),_e("remote-delete",async()=>{await d(`${F}/remote-delete`,{session:l,name:n}),Ye(),await i(),Ce("ok",`🗑 ${n}`)})):(te(n),window.setTimeout(()=>{te(Q=>Q===n?null:Q)},3e3)))},aa=()=>{l!==void 0&&(We(!0),f(`${F}/graph?session=${encodeURIComponent(l)}&limit=150`).then(Ke).catch(n=>{Ce("err",n instanceof Error?n.message:String(n))}).finally(()=>{We(!1)}))},ya=()=>{Ie(!0),aa()};if((0,o.useEffect)(()=>{if(!b)return;const n=me=>{const ta=me.target;ta!==null&&(na.current?.contains(ta)||ia.current?.contains(ta)||v(!1))},Q=me=>{me.key==="Escape"&&v(!1)};return document.addEventListener("mousedown",n),document.addEventListener("keydown",Q),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",Q)}},[b]),!T||l===void 0||r!==null&&r.unresolved!==!0&&!r.isRepo)return null;if(r===null||r.unresolved===!0)return u===void 0||u===""?null:(0,e.jsx)("span",{className:"gbar","data-slot-plugin":"dsh-ui-tweaks-gitbar",children:(0,e.jsxs)("span",{className:"gbar-fchip",title:u,children:[(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z"})}),(0,e.jsx)("span",{className:"gbar-folder",children:k(u)})]})});const Ue=!r.clean;return(0,e.jsxs)("span",{className:"gbar","data-slot-plugin":"dsh-ui-tweaks-gitbar",children:[(0,e.jsxs)("span",{className:"gbar-fchip",title:u??r.cwd,children:[(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z"})}),(0,e.jsx)("span",{className:"gbar-folder",children:k(u??r.cwd)})]}),(0,e.jsxs)("span",{className:"gbar-bwrap",children:[(0,e.jsxs)("button",{type:"button",ref:na,className:"gbar-chip"+(b?" gbar-open":""),onClick:ua,title:a(Ue?"dirty":"clean"),"aria-expanded":b,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{className:"gbar-bname",children:r.branch??r.detachedHead??"—"}),Ue?(0,e.jsx)("span",{className:"gbar-chip-dot","aria-hidden":!0}):null]}),b?(0,e.jsxs)("div",{className:"gbar-pop",role:"menu","aria-label":r.branch??"git",ref:ia,children:[(0,e.jsxs)("div",{className:"gbar-pop-head",children:[(0,e.jsxs)("span",{className:"gbar-curname",title:a(Ue?"dirty":"clean"),children:[(0,e.jsxs)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{children:r.branch??r.detachedHead??"—"})]}),(0,e.jsxs)("span",{className:"gbar-state",children:[(0,e.jsx)("span",{className:"gbar-dot "+(Ue?"gbar-dirty":"gbar-clean"),"aria-hidden":!0}),r.ahead>0?(0,e.jsxs)("span",{children:["↑",r.ahead]}):null,r.behind>0?(0,e.jsxs)("span",{children:["↓",r.behind]}):null]}),r.branch!==null&&r.upstream!==void 0?(0,e.jsx)("button",{type:"button",className:"gbar-pull",onClick:pa,disabled:fe!==null,title:a("branchPull"),"aria-label":a("branchPull"),children:fe==="pull"?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M8 2.5v7.5"}),(0,e.jsx)("path",{d:"M4.6 6.9 8 10.3l3.4-3.4"}),(0,e.jsx)("path",{d:"M2.5 13.5h11"})]})}):null]}),(0,e.jsxs)("div",{className:"gbar-pop-body",children:[(0,e.jsxs)("div",{className:"gbar-sec",children:[a("branchLocal"),M!==null?(0,e.jsx)("span",{className:"gbar-count",children:M.local.length}):null]}),M===null?(0,e.jsxs)("div",{className:"gbar-loading",children:[(0,e.jsx)("span",{className:"gbar-spin"}),a("loading")]}):M.local.map(n=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row"+(n===M.current?" gbar-cur":""),onClick:()=>{oa(n)},children:[(0,e.jsxs)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M11.5 3.7v3a2.6 2.6 0 0 1-2.6 2.6H4.5"})]}),(0,e.jsx)("span",{children:n}),n===M.current?(0,e.jsx)("span",{className:"gbar-check","aria-hidden":!0,children:"✓"}):null]}),w(n)?null:(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{ba(n)},title:a("branchRename"),children:(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M11.3 2a1.9 1.9 0 0 1 2.7 2.7L6.4 12.3l-3.9 1.2 1.2-3.9L11.3 2Z"})})}),n!==M.current&&!w(n)?(0,e.jsx)("button",{type:"button",className:"gbar-del"+(ge===n?" gbar-arm":""),onClick:()=>{va(n)},title:a("branchDelete"),children:ge===n?a("branchDeleteConfirm"):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 4.5h11"}),(0,e.jsx)("path",{d:"M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2"}),(0,e.jsx)("path",{d:"M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2"})]})}):null]},n)),(0,e.jsxs)("div",{className:"gbar-sec",children:[a("branchRemote"),M!==null?(0,e.jsx)("span",{className:"gbar-count",children:M.remote.length}):null]}),M?.remote.map(n=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row"+(n===M.current?" gbar-cur":""),onClick:()=>{oa(n)},children:[(0,e.jsx)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M5.2 13a3.2 3.2 0 1 1 .5-6.36 4 4 0 0 1 7.75 1.06 2.65 2.65 0 0 1-.55 5.3H5.2Z"})}),(0,e.jsx)("span",{children:R(n)}),(0,e.jsx)("span",{className:"gbar-rm",children:n.split("/")[0]})]}),w(R(n))?null:(0,e.jsx)("button",{type:"button",className:"gbar-del"+(ge===n?" gbar-arm":""),onClick:()=>{wa(n)},title:a("branchRemoteDelete"),children:ge===n?a("branchDeleteConfirm"):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 4.5h11"}),(0,e.jsx)("path",{d:"M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2"}),(0,e.jsx)("path",{d:"M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2"})]})})]},n))]}),(0,e.jsxs)("div",{className:"gbar-actions",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-act",onClick:ha,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M4 2v8"}),(0,e.jsx)("circle",{cx:"12",cy:"4",r:"2"}),(0,e.jsx)("circle",{cx:"4",cy:"12",r:"2"}),(0,e.jsx)("path",{d:"M12 6a6 6 0 0 1-6 6"}),(0,e.jsx)("path",{d:"M12.5 10.5v4"}),(0,e.jsx)("path",{d:"M10.5 12.5h4"})]}),a("branchNew")]}),(0,e.jsxs)("button",{type:"button",className:"gbar-act",onClick:ya,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M4 2v12"}),(0,e.jsx)("path",{d:"M12 5.2C12 8.4 4 8.4 4 11.5"}),(0,e.jsx)("circle",{cx:"4",cy:"5",r:"1.7",fill:"currentColor",stroke:"none"}),(0,e.jsx)("circle",{cx:"12",cy:"3.5",r:"1.7",fill:"currentColor",stroke:"none"})]}),a("branchGraph")]}),(0,e.jsxs)("button",{type:"button",className:"gbar-act",onClick:ma,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 6.8V3.5a1 1 0 0 1 1-1h3.3c.27 0 .52.1.71.3l5.9 5.9a1 1 0 0 1 0 1.4l-3.9 3.9a1 1 0 0 1-1.4 0l-5.9-5.9a1 1 0 0 1-.3-.71Z"}),(0,e.jsx)("circle",{cx:"5.4",cy:"5.4",r:"0.5",fill:"currentColor",stroke:"none"})]}),a("tagsTitle")]})]})]}):null]}),Te?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&ye(!1)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":a("branchNew"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("branchNew")}),(0,e.jsx)("span",{className:"gbar-branch",children:r.branch??r.detachedHead??"—"}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{ye(!1)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:J,onChange:n=>{ie(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&la()},placeholder:a("branchNewPlaceholder"),"aria-label":a("branchNew"),autoFocus:!0}),(0,e.jsxs)("div",{className:"gbar-baserow",children:[(0,e.jsx)("label",{className:"gbar-baselabel",htmlFor:"gbar-base-dlg",children:a("branchFrom")}),(0,e.jsxs)("select",{id:"gbar-base-dlg",className:"gbar-base",value:we,onChange:n=>{xe(n.target.value)},"aria-label":a("branchFrom"),children:[(0,e.jsx)("option",{value:"",children:a("branchFromHead")}),M?.local.map(n=>(0,e.jsx)("option",{value:n,children:n},n)),M?.remote.map(n=>(0,e.jsx)("option",{value:n,children:n},n))]})]}),(0,e.jsxs)("div",{className:"gbar-pushrow",children:[(0,e.jsx)("button",{type:"button",className:"gbar-chk"+(pe?"":" gbar-off"),onClick:()=>{ve(n=>!n)},"aria-label":a("branchPushRemote"),children:pe?"✓":"✕"}),(0,e.jsx)("span",{className:"gbar-pushlabel",children:a("branchPushRemote")})]}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{ye(!1)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:la,disabled:fe!==null||J.trim()==="",children:[fe==="create"||fe==="create-push"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("branchCreate")]})]})]})}),document.body):null,Se!==null?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&de(null)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":a("branchRename"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("branchRename")}),(0,e.jsx)("span",{className:"gbar-branch",children:Se}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{de(null)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:Ee,onChange:n=>{Me(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&da()},placeholder:a("branchNewPlaceholder"),"aria-label":a("branchRename"),autoFocus:!0,onFocus:n=>{n.target.select()}}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{de(null)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:da,disabled:fe!==null||Ee.trim()===""||Ee.trim()===Se,children:[fe==="branch-rename"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("branchRename")]})]})]})}),document.body):null,Xe?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&He(!1)},children:(0,e.jsxs)("div",{className:"gbar-modal gbar-tags-modal",role:"dialog","aria-label":a("tagsTitle"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("tagsTitle")}),(0,e.jsx)("span",{className:"gbar-branch",children:r.branch??r.detachedHead??"—"}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{He(!1)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("div",{className:"gbar-tags-list",children:I===null?(0,e.jsxs)("div",{className:"gbar-loading",children:[(0,e.jsx)("span",{className:"gbar-spin"}),a("loading")]}):I.tags.length===0?(0,e.jsx)("div",{className:"gbar-graph-empty",children:a("noChanges")}):I.tags.map(n=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("div",{className:"gbar-row",title:n.subject!==""?`${n.hash} ${n.subject}`:n.hash,children:[(0,e.jsxs)("svg",{className:"gbar-bicon",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 6.8V3.5a1 1 0 0 1 1-1h3.3c.27 0 .52.1.71.3l5.9 5.9a1 1 0 0 1 0 1.4l-3.9 3.9a1 1 0 0 1-1.4 0l-5.9-5.9a1 1 0 0 1-.3-.71Z"}),(0,e.jsx)("circle",{cx:"5.4",cy:"5.4",r:"0.5",fill:"currentColor",stroke:"none"})]}),(0,e.jsx)("span",{children:n.name}),(0,e.jsx)("span",{className:"gbar-rm",children:n.hash})]}),(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{fa(n.name)},title:a("tagPush"),children:(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M5.2 13a3.2 3.2 0 1 1 .5-6.36 4 4 0 0 1 7.75 1.06 2.65 2.65 0 0 1-.55 5.3H5.2Z"}),(0,e.jsx)("path",{d:"M8 9.5V3"}),(0,e.jsx)("path",{d:"M5.4 5.1 8 2.5l2.6 2.6"})]})}),(0,e.jsx)("button",{type:"button",className:"gbar-del"+($e===n.name?" gbar-arm":""),onClick:()=>{xa(n.name)},title:a("tagDelete"),children:$e===n.name?a("branchDeleteConfirm"):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 4.5h11"}),(0,e.jsx)("path",{d:"M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2"}),(0,e.jsx)("path",{d:"M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2"})]})})]},n.name))}),(0,e.jsx)("input",{value:oe,onChange:n=>{ke(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&Qe()},placeholder:a("tagCreatePlaceholder"),"aria-label":a("tagCreate")}),(0,e.jsx)("input",{value:Oe,onChange:n=>{qe(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&Qe()},placeholder:a("tagMessagePlaceholder"),"aria-label":a("tagMessagePlaceholder")}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{He(!1)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:Qe,disabled:fe!==null||oe.trim()==="",children:[fe==="tag-create"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("tagCreate")]})]})]})}),document.body):null,ze!==null?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&Ae(null)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":a("tagCreate"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("tagCreate")}),(0,e.jsxs)("span",{className:"gbar-branch",children:["#",ze.hash]}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{Ae(null)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:_,onChange:n=>{le(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&ea()},placeholder:a("tagCreatePlaceholder"),"aria-label":a("tagCreate"),autoFocus:!0}),(0,e.jsx)("input",{value:he,onChange:n=>{Ne(n.target.value)},onKeyDown:n=>{n.key==="Enter"&&ea()},placeholder:a("tagMessagePlaceholder"),"aria-label":a("tagMessagePlaceholder")}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{Ae(null)},children:a("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:ea,disabled:fe!==null||_.trim()==="",children:[fe==="tag-create"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("tagCreate")]})]})]})}),document.body):null,Pe?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:n=>{n.target===n.currentTarget&&Ie(!1)},children:(0,e.jsxs)("div",{className:"gbar-modal gbar-graph-modal",role:"dialog","aria-label":a("graphTitle"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("graphTitle")}),(0,e.jsx)("span",{className:"gbar-branch",children:r.branch??r.detachedHead??"—"}),(0,e.jsx)("span",{className:"gbar-spacer"}),(0,e.jsx)("button",{type:"button",className:"gbar-x gbar-refresh",onClick:aa,"aria-label":a("branchRefresh"),title:a("branchRefresh"),disabled:Le,children:Le?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M13.4 8a5.4 5.4 0 1 1-1.6-3.8"}),(0,e.jsx)("path",{d:"M13.4 1.5v3h-3"})]})}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{Ie(!1)},"aria-label":"✕",children:"✕"})]}),Re===null?(0,e.jsx)("div",{className:"gbar-graph-empty",children:a(Le?"loading":"noChanges")}):Fe===null||Fe.rows.length===0?(0,e.jsx)("div",{className:"gbar-graph-empty",children:a("noChanges")}):(0,e.jsxs)("div",{className:"gbar-graph-table",role:"table","aria-label":a("graphTitle"),children:[(0,e.jsxs)("div",{className:"gbar-graph-row gbar-graph-head",role:"row",children:[(0,e.jsx)("span",{className:"gbar-c-graph",role:"columnheader",children:a("graphColGraph")}),(0,e.jsx)("span",{className:"gbar-c-hash",role:"columnheader",children:a("graphColCommit")}),(0,e.jsx)("span",{className:"gbar-c-subject",role:"columnheader",children:a("graphColSubject")}),(0,e.jsx)("span",{className:"gbar-c-author",role:"columnheader",children:a("graphColAuthor")}),(0,e.jsx)("span",{className:"gbar-c-date",role:"columnheader",children:a("graphColDate")}),(0,e.jsx)("span",{className:"gbar-c-tag",role:"columnheader"})]}),Fe.rows.map((n,Q)=>{const me=Re.commits[Q];return me===void 0?null:(0,e.jsxs)("div",{className:"gbar-graph-row",role:"row",children:[(0,e.jsx)("span",{className:"gbar-c-graph",role:"cell",children:(0,e.jsx)(E,{row:n,lanes:Fe.lanes})}),(0,e.jsx)("span",{className:"gbar-c-hash",role:"cell",children:(0,e.jsx)("code",{className:"gbar-hash",children:me.hash})}),(0,e.jsxs)("span",{className:"gbar-c-subject",role:"cell",children:[(0,e.jsx)("span",{className:"gbar-subject",children:me.subject}),me.refs!==""?(0,e.jsx)("span",{className:"gbar-refs",children:me.refs}):null]}),(0,e.jsx)("span",{className:"gbar-c-author",role:"cell",children:me.author}),(0,e.jsx)("span",{className:"gbar-c-date",role:"cell",title:me.date,children:me.dateRelative}),(0,e.jsx)("span",{className:"gbar-c-tag",role:"cell",children:(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{ga(me.fullHash,me.hash)},title:a("tagCreate"),children:(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M2.5 6.8V3.5a1 1 0 0 1 1-1h3.3c.27 0 .52.1.71.3l5.9 5.9a1 1 0 0 1 0 1.4l-3.9 3.9a1 1 0 0 1-1.4 0l-5.9-5.9a1 1 0 0 1-.3-.71Z"}),(0,e.jsx)("circle",{cx:"5.4",cy:"5.4",r:"0.5",fill:"currentColor",stroke:"none"})]})})})]},me.fullHash)})]})]})}),document.body):null,Je!==null?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-notice gbar-"+Je.kind,role:"status",children:Je.text}),document.body):null]})}function X({sessionId:c,useSession:x,controller:m,t:a}){const T=(0,o.useSyncExternalStore)(m.subscribe,m.getSnapshot,m.getSnapshot).value?.gitBarEnabled??!0,l=String(c),S=x(_=>_.running)??!1,[s,t]=V(T,{session:l}),[u,r]=(0,o.useState)(null),[i,b]=(0,o.useState)("hunk"),[v,M]=(0,o.useState)(null),[O,J]=(0,o.useState)(0),[ie,pe]=(0,o.useState)(""),[ve,ge]=(0,o.useState)(""),[te,we]=(0,o.useState)(null),[xe,Te]=(0,o.useState)(null),[ye,Se]=(0,o.useState)(new Set),[de,Ee]=(0,o.useState)(null),[Me,I]=(0,o.useState)(null),[N,oe]=(0,o.useState)(null),ke=(_,le)=>{Te({kind:_,text:le}),window.setTimeout(()=>Te(null),4e3)},Oe=async(_,le)=>{if(te!==null)return!1;we(_);try{return await le(),!0}catch(he){return ke("err",he instanceof Error?he.message:String(he)),!1}finally{we(null)}},qe=_=>{Se(le=>{const he=new Set(le);return he.has(_)?he.delete(_):he.add(_),he})};(0,o.useEffect)(()=>{t()},[]),(0,o.useEffect)(()=>{M(_=>_??s?.files[0]?.path??null)},[s]);const Xe=_=>{M(_)},He=_=>{b(_)},$e=()=>{Oe("refresh",async()=>{await t(),J(_=>_+1)})};(0,o.useEffect)(()=>{if(l===void 0||v===null)return;let _=!1;return r(null),f(`${F}/diff?${g({session:l})}&file=${encodeURIComponent(v)}&mode=${i}`).then(le=>{_||r(le)}).catch(le=>{_||ke("err",le instanceof Error?le.message:String(le))}),()=>{_=!0}},[l,v,i,O]);const De=_=>{S||Oe(_?"commit-push":"commit",async()=>{const le=ie.trim();if(le===""){ke("err",a("commitEmpty"));return}const he=ve.trim(),Ne=await d(`${F}/commit`,{session:l,message:le,push:_,exclude:[...ye],...he!==""?{tag:he}:{}});pe(""),ge(""),Se(new Set),await t();const Pe=Ne.tag!==void 0?` · 🏷 ${Ne.tag}`:"";ke("ok",_?`✓ ${Ne.hash??"committed"} · pushed${Pe}`:`✓ ${Ne.hash??"committed"}${Pe}`)})},ze=(_,le)=>{le.preventDefault();const he=document.querySelector(".gbar-view"),Ne=Fe=>{const fe=he?.querySelector(Fe)??null;return fe===null?0:fe.getBoundingClientRect().height},Pe=le.clientY,Ie=Ne(".gbar-files"),Re=Ne(".gbar-side-commit"),Ke=Ne(".gbar-diff");oe(_);const Le=Fe=>{const fe=Fe.clientY-Pe;if(_==="files"){const Be=Math.max(ee,Ie+Ke-$);Ee(Math.round(Math.min(Be,Math.max(ee,Ie+fe))))}else{const Be=Math.max(p,Re+Ke-$);I(Math.round(Math.min(Be,Math.max(p,Re-fe))))}},We=()=>{oe(null),window.removeEventListener("pointermove",Le),window.removeEventListener("pointerup",We)};window.addEventListener("pointermove",Le),window.addEventListener("pointerup",We)};if(!T||l===void 0)return null;if(s!==null&&!s.isRepo)return(0,e.jsx)("div",{className:"gbar-view",children:(0,e.jsx)("div",{className:"gbar-view-empty",children:a("notRepo")})});if(s===null)return(0,e.jsxs)("div",{className:"gbar-view",children:[(0,e.jsxs)("div",{className:"gbar-side-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:a("diffView")}),(0,e.jsx)("span",{className:"gbar-spacer"})]}),(0,e.jsx)("div",{className:"gbar-side-body",children:(0,e.jsx)("div",{className:"gbar-diff",children:(0,e.jsxs)("div",{className:"gbar-empty",children:[(0,e.jsx)("span",{className:"gbar-spin"})," ",a("loading")]})})})]});const Ae=!s.clean;return(0,e.jsxs)("div",{className:"gbar-view",children:[(0,e.jsxs)("div",{className:"gbar-side-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:v??a("diffView")}),(0,e.jsxs)("span",{className:"gbar-sub",children:[s.files.length," ",a("diffFiles")," · ",(0,e.jsxs)("span",{className:"gbar-a",children:["+",s.totalAdded]})," ",(0,e.jsxs)("span",{className:"gbar-d",children:["−",s.totalDeleted]})]}),(0,e.jsx)("span",{className:"gbar-spacer"}),(0,e.jsxs)("div",{className:"gbar-seg",role:"group",children:[(0,e.jsx)("button",{type:"button",className:i==="hunk"?"gbar-on":"",onClick:()=>{He("hunk")},children:a("diffOnly")}),(0,e.jsx)("button",{type:"button",className:i==="full"?"gbar-on":"",onClick:()=>{He("full")},children:a("diffFull")})]}),(0,e.jsx)("button",{type:"button",className:"gbar-side-half",onClick:$e,disabled:te!==null,title:a("branchRefresh"),"aria-label":a("branchRefresh"),children:te==="refresh"?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M13.4 8a5.4 5.4 0 1 1-1.6-3.8"}),(0,e.jsx)("path",{d:"M13.4 1.5v3h-3"})]})})]}),(0,e.jsxs)("div",{className:"gbar-side-body",children:[(0,e.jsx)("div",{className:"gbar-files",style:de===null?{maxHeight:se}:{height:de,maxHeight:y},children:s.files.map(_=>{const le=ye.has(_.path),he=_.path.lastIndexOf("/"),Ne=he>=0?_.path.slice(0,he+1):"",Pe=he>=0?_.path.slice(he+1):_.path;return(0,e.jsxs)("div",{className:"gbar-file"+(v===_.path?" gbar-on":"")+(le?" gbar-excl":""),children:[(0,e.jsx)("button",{type:"button",className:"gbar-chk"+(le?" gbar-off":""),onClick:()=>{qe(_.path)},"aria-label":a(le?"excludeFile":"includeFile"),children:le?"✕":"✓"}),(0,e.jsxs)("button",{type:"button",className:"gbar-file-main",onClick:()=>{Xe(_.path)},title:_.path,children:[(0,e.jsx)("span",{className:"gbar-st "+H(_.status),children:P(_.status)}),(0,e.jsxs)("span",{className:"gbar-path",children:[Ne!==""?(0,e.jsx)("span",{className:"gbar-dir",children:Ne}):null,(0,e.jsx)("span",{children:Pe})]}),(0,e.jsxs)("span",{className:"gbar-nums",children:[(0,e.jsxs)("span",{className:"gbar-a",children:["+",_.added]})," ",(0,e.jsxs)("span",{className:"gbar-d",children:["−",_.deleted]})]})]})]},_.path)})}),(0,e.jsx)("div",{className:"gbar-vsplit"+(N==="files"?" gbar-dragging":""),role:"separator","aria-orientation":"horizontal",title:"拖动调整文件列表高度(双击复位)",onPointerDown:_=>{ze("files",_)},onDoubleClick:()=>{Ee(null)}}),u===null?(0,e.jsx)("div",{className:"gbar-diff",children:(0,e.jsx)("div",{className:"gbar-empty",children:s.clean||s.files.length===0?a("clean"):a("loading")})}):u.lines.length===0?(0,e.jsx)("div",{className:"gbar-diff",children:(0,e.jsx)("div",{className:"gbar-empty",children:a("noChanges")})}):(0,e.jsxs)("div",{className:"gbar-diff",children:[u.lines.map((_,le)=>(0,e.jsxs)("div",{className:"gbar-line gbar-"+_.type,children:[(0,e.jsx)("span",{className:"gbar-ln",children:_.old??""}),(0,e.jsx)("span",{className:"gbar-ln",children:_.new??""}),(0,e.jsx)("span",{className:"gbar-code",children:_.text})]},le)),u.truncated?(0,e.jsx)("div",{className:"gbar-empty",children:"…"}):null]}),Ae?(0,e.jsx)("div",{className:"gbar-vsplit"+(N==="commit"?" gbar-dragging":""),role:"separator","aria-orientation":"horizontal",title:"拖动调整提交区高度(双击复位)",onPointerDown:_=>{ze("commit",_)},onDoubleClick:()=>{I(null)}}):null]}),(0,e.jsxs)("div",{className:"gbar-side-foot",children:[(0,e.jsx)("span",{className:"gbar-dot"}),s.branch??"—"," · ",a(Ae?"dirty":"clean")]}),Ae?(0,e.jsxs)("div",{className:"gbar-side-commit",style:Me===null?void 0:{height:Me,maxHeight:y},children:[(0,e.jsx)("div",{className:"gbar-crow",children:(0,e.jsx)("textarea",{value:ie,onChange:_=>{pe(_.target.value)},onKeyDown:_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),De(!1))},placeholder:a("commitPlaceholder"),"aria-label":a("commitMessage"),rows:1})}),(0,e.jsxs)("div",{className:"gbar-actions",children:[(0,e.jsx)("input",{className:"gbar-taginput",value:ve,onChange:_=>{ge(_.target.value)},onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),De(!1))},placeholder:a("tagCommitPlaceholder"),"aria-label":a("tagCommitPlaceholder")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-soft",onClick:()=>{De(!1)},disabled:te!==null||S,title:S?a("commitBusy"):void 0,children:[te==="commit"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("commitSubmit")]}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:()=>{De(!0)},disabled:te!==null||S,title:S?a("commitBusy"):void 0,children:[te==="commit-push"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",a("commitSubmitPush")]})]})]}):null,xe!==null?(0,e.jsx)("div",{className:"gbar-notice gbar-"+xe.kind,role:"status",children:xe.text}):null]})}function ue({sessionId:c,controller:x,t:m}){const h=(0,o.useSyncExternalStore)(x.subscribe,x.getSnapshot,x.getSnapshot).value?.gitBarEnabled??!0,[T]=V(h,{session:String(c)}),l=T!==null&&T.isRepo&&!T.clean;return(0,e.jsxs)("span",{children:[m("diffView"),l?(0,e.jsx)("span",{className:"gbar-tab-dot","aria-hidden":!0}):null]})}const ae='[class$="_workspace"]';function ce({t:c,right:x,top:m}){const a=(0,o.useMemo)(()=>document.querySelector(ae)?.textContent?.trim()??"",[]),[h,T]=V(!0,{ws:a}),[l,S]=(0,o.useState)(!1),[s,t]=(0,o.useState)(null),[u,r]=(0,o.useState)(null),[i,b]=(0,o.useState)(null),[v,M]=(0,o.useState)(""),[O,J]=(0,o.useState)(null),[ie,pe]=(0,o.useState)(null),ve=(0,o.useRef)(null),ge=(0,o.useRef)(null),te=(N,oe)=>{pe({kind:N,text:oe}),window.setTimeout(()=>pe(null),4e3)},we=async(N,oe)=>{if(O!==null)return!1;J(N);try{return await oe(),!0}catch(ke){return te("err",ke instanceof Error?ke.message:String(ke)),!1}finally{J(null)}},xe=()=>{f(`${F}/branches?${g({ws:a})}`).then(t).catch(N=>{te("err",N instanceof Error?N.message:String(N))})},Te=N=>{N!==s?.current&&we("checkout",async()=>{await d(`${F}/checkout`,{ws:a,branch:N}),S(!1),await T(),xe(),te("ok",`→ ${N}`)})},ye=()=>{const N=h?.upstream??h?.branch??"";we("pull",async()=>{await d(`${F}/pull`,{ws:a}),S(!1),await T(),te("ok",`⬇ ${N}`)})},Se=N=>{u===N?(r(null),we("branch-delete",async()=>{await d(`${F}/branch-delete`,{ws:a,name:N}),xe(),te("ok",`🗑 ${N}`)})):(r(N),window.setTimeout(()=>{r(oe=>oe===N?null:oe)},3e3))},de=N=>{u===N?(r(null),we("remote-delete",async()=>{await d(`${F}/remote-delete`,{ws:a,name:N}),xe(),te("ok",`🗑 ${N}`)})):(r(N),window.setTimeout(()=>{r(oe=>oe===N?null:oe)},3e3))},Ee=N=>{r(null),M(N),b(N)},Me=()=>{if(i===null)return;const N=i,oe=v.trim();if(oe===""||oe===N){b(null);return}we("branch-rename",async()=>{await d(`${F}/branch-rename`,{ws:a,name:N,newName:oe}),b(null),xe(),await T(),te("ok",`✎ ${N} → ${oe}`)})};if((0,o.useEffect)(()=>{if(!l)return;const N=ke=>{const Oe=ke.target;Oe!==null&&(ve.current?.contains(Oe)||ge.current?.contains(Oe)||S(!1))},oe=ke=>{ke.key==="Escape"&&S(!1)};return document.addEventListener("mousedown",N),document.addEventListener("keydown",oe),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",oe)}},[l]),h===null||!h.isRepo)return null;const I=!h.clean;return(0,e.jsxs)("div",{className:"gbar-hero",style:{top:m,right:x},children:[(0,e.jsxs)("span",{className:"gbar-fchip",title:h.cwd,children:[(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z"})}),(0,e.jsx)("span",{className:"gbar-folder",children:k(h.cwd)})]}),(0,e.jsxs)("span",{className:"gbar-bwrap",children:[(0,e.jsxs)("button",{type:"button",ref:ve,className:"gbar-chip"+(l?" gbar-open":""),onClick:()=>{S(N=>(N||xe(),!N))},title:c(I?"dirty":"clean"),"aria-expanded":l,children:[(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{className:"gbar-bname",children:h.branch??h.detachedHead??"—"})]}),l?(0,e.jsxs)("div",{className:"gbar-pop",ref:ge,role:"menu",children:[(0,e.jsxs)("div",{className:"gbar-pop-head",children:[(0,e.jsxs)("svg",{style:{width:14,height:14,color:"var(--dsw-alias-state-business-primary)",flex:"none"},viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",children:[(0,e.jsx)("circle",{cx:"4.5",cy:"3.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"4.5",cy:"12.5",r:"1.8"}),(0,e.jsx)("circle",{cx:"12",cy:"5.5",r:"1.8"}),(0,e.jsx)("path",{d:"M4.5 5.3v5.4"}),(0,e.jsx)("path",{d:"M12 7.3c0 3-3.5 4.8-7.5 3.4"})]}),(0,e.jsx)("span",{className:"cname",children:h.branch??h.detachedHead??"—"}),(0,e.jsxs)("span",{className:"state",children:[(0,e.jsx)("span",{style:{width:6,height:6,borderRadius:999,background:I?"var(--dsw-alias-state-warn-primary)":"var(--dsw-alias-state-success-primary)"}}),h.ahead>0?(0,e.jsxs)("span",{children:["↑",h.ahead]}):null,h.behind>0?(0,e.jsxs)("span",{children:["↓",h.behind]}):null]}),h.branch!==null&&h.upstream!==void 0?(0,e.jsx)("button",{type:"button",className:"gbar-pull",style:{marginLeft:"auto"},onClick:ye,disabled:O!==null,title:c("branchPull"),"aria-label":c("branchPull"),children:O==="pull"?(0,e.jsx)("span",{className:"gbar-spin"}):(0,e.jsxs)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,e.jsx)("path",{d:"M8 2.5v7.5"}),(0,e.jsx)("path",{d:"M4.6 6.9 8 10.3l3.4-3.4"}),(0,e.jsx)("path",{d:"M2.5 13.5h11"})]})}):null]}),(0,e.jsxs)("div",{className:"gbar-pop-body",children:[(0,e.jsxs)("div",{className:"gbar-sec",children:[c("branchLocal"),s!==null?(0,e.jsx)("span",{className:"gbar-count",children:s.local.length}):null]}),s===null?(0,e.jsxs)("div",{className:"gbar-loading",children:[(0,e.jsx)("span",{className:"gbar-spin"}),c("loading")]}):s.local.map(N=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row"+(N===s.current?" gbar-cur":""),onClick:()=>{Te(N)},children:[(0,e.jsx)("span",{children:N}),N===s.current?(0,e.jsx)("span",{className:"gbar-check","aria-hidden":!0,children:"✓"}):null]}),w(N)?null:(0,e.jsx)("button",{type:"button",className:"gbar-ren",onClick:()=>{Ee(N)},title:c("branchRename"),children:(0,e.jsx)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,e.jsx)("path",{d:"M11.3 2a1.9 1.9 0 0 1 2.7 2.7L6.4 12.3l-3.9 1.2 1.2-3.9L11.3 2Z"})})}),N!==s.current&&!w(N)?(0,e.jsx)("button",{type:"button",className:"gbar-del"+(u===N?" gbar-arm":""),onClick:()=>{Se(N)},title:c("branchDelete"),children:u===N?c("branchDeleteConfirm"):"🗑"}):null]},N)),(0,e.jsxs)("div",{className:"gbar-sec",children:[c("branchRemote"),s!==null?(0,e.jsx)("span",{className:"gbar-count",children:s.remote.length}):null]}),s?.remote.map(N=>(0,e.jsxs)("div",{className:"gbar-rowwrap",children:[(0,e.jsxs)("button",{type:"button",className:"gbar-row",onClick:()=>{Te(R(N))},children:[(0,e.jsx)("span",{children:R(N)}),(0,e.jsx)("span",{className:"gbar-rm",children:N.split("/")[0]})]}),w(R(N))?null:(0,e.jsx)("button",{type:"button",className:"gbar-del"+(u===N?" gbar-arm":""),onClick:()=>{de(N)},title:c("branchRemoteDelete"),children:u===N?c("branchDeleteConfirm"):"🗑"})]},N))]})]}):null]}),ie!==null?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-notice gbar-"+ie.kind,role:"status",children:ie.text}),document.body):null,i!==null?(0,L.createPortal)((0,e.jsx)("div",{className:"gbar-modal-wrap",onMouseDown:N=>{N.target===N.currentTarget&&b(null)},children:(0,e.jsxs)("div",{className:"gbar-modal",role:"dialog","aria-label":c("branchRename"),children:[(0,e.jsxs)("div",{className:"gbar-head",children:[(0,e.jsx)("span",{className:"gbar-title",children:c("branchRename")}),(0,e.jsx)("span",{className:"gbar-branch",children:i}),(0,e.jsx)("button",{type:"button",className:"gbar-x",onClick:()=>{b(null)},"aria-label":"✕",children:"✕"})]}),(0,e.jsx)("input",{value:v,onChange:N=>{M(N.target.value)},onKeyDown:N=>{N.key==="Enter"&&Me()},placeholder:c("branchNewPlaceholder"),"aria-label":c("branchRename"),autoFocus:!0,onFocus:N=>{N.target.select()}}),(0,e.jsxs)("div",{className:"gbar-foot",children:[(0,e.jsx)("button",{type:"button",className:"gbar-btn gbar-ghost",onClick:()=>{b(null)},children:c("branchCancel")}),(0,e.jsxs)("button",{type:"button",className:"gbar-btn gbar-primary",onClick:Me,disabled:O!==null||v.trim()===""||v.trim()===i,children:[O==="branch-rename"?(0,e.jsx)("span",{className:"gbar-spin"}):null," ",c("branchRename")]})]})]})}),document.body):null]})}function q(c,x){const m=document.createElement("div");m.dataset.plugin="dsh-ui-tweaks-gitbar-hero",document.body.appendChild(m);const a=(0,z.createRoot)(m);let h=null;const T=()=>{const u=c.getSnapshot().value?.gitBarEnabled??!0;a.render(h===null||!u?null:(0,e.jsx)(ce,{t:x,right:h.right,top:h.top}))},l=()=>{const u=document.querySelector(ae);h=u===null?null:(()=>{const r=u.getBoundingClientRect();return{right:Math.max(0,Math.round(window.innerWidth-r.left+8)),top:Math.round(r.top+r.height/2)}})(),T()};let S=0;const s=new MutationObserver(()=>{cancelAnimationFrame(S),S=requestAnimationFrame(l)});s.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("resize",l);const t=c.subscribe(T);return l(),()=>{s.disconnect(),cancelAnimationFrame(S),window.removeEventListener("resize",l),t(),a.render(null),m.remove()}}},je["./graphlayout.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.GRAPH_ROW_H=j.GRAPH_LANE_W=j.GRAPH_PALETTE=void 0,j.layoutCommitGraph=e,j.GRAPH_PALETTE=["#4c8dff","#8b5cf6","#10b981","#f59e0b","#ec4899","#06b6d4","#f97316","#84cc16"],j.GRAPH_LANE_W=13,j.GRAPH_ROW_H=28;function e(o){const L=[],z=[];let Y=0;const F=()=>j.GRAPH_PALETTE[Y++%j.GRAPH_PALETTE.length],U=[];let se=0;for(const ee of o){const $=[];let p=L.indexOf(ee.fullHash),y;const E=p!==-1;p===-1?(p=L.indexOf(null),p===-1&&(p=L.length,L.push(null),z.push(null)),y=F(),z[p]=y):y=z[p]??F(),L[p]=null,E&&$.push({from:p,to:p,color:y,kind:"in"});for(let f=0;f<L.length;f++)f!==p&&L[f]!==null&&$.push({from:f,to:f,color:z[f]??F(),kind:"pass"});for(const[f,d]of(ee.parents??[]).entries()){let g=L.indexOf(d),k;g!==-1?k=z[g]??F():f===0&&L[p]===null?(g=p,k=y,z[g]=y):(g=L.indexOf(null),g===-1&&(g=L.length,L.push(null),z.push(null)),k=g===p?y:F(),z[g]=k),L[g]=d,$.push({from:p,to:g,color:k,kind:"out"})}se=Math.max(se,L.length),U.push({dot:p,color:y,edges:$})}return{rows:U,lanes:se}}},je["./icons.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.DiffIcon=o;const e=K("react/jsx-runtime");function o({size:L=16,className:z}){return(0,e.jsxs)("svg",{width:L,height:L,className:z,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)("path",{d:"M9.5 1.5H4A1.5 1.5 0 0 0 2.5 3v10A1.5 1.5 0 0 0 4 14.5h8A1.5 1.5 0 0 0 13.5 13V5.5l-4-4Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M9.5 1.5V5.5h4",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M5.75 10h4.5M5.75 7.5h2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}},je["./index.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.inject=j.SettingsClient=void 0,j.apply=S;const e=K("react/jsx-runtime"),o=K("react"),L=K("react-dom"),z=re("./gitbar.js"),Y=re("./icons.js"),F=re("./archive.js"),U=re("./mcp.js"),se=re("./search.js"),ee=re("./timeline.js"),$=re("./cachehit.js"),p=re("./effort.js"),y=re("./notifier.js"),E="ui-tweaks",f="/_dsh/ui-tweaks/settings",d=81,g=11,k=8,C=32,R=12/11,w=1,P=19,H=16,D="dsh-ui-tweaks-code-font-scope",A={nav:"UI Tweaks",settingsTitle:"UI Tweaks",settingsIntro:"Tune the conversation UI — code size, tables and layout, plus optional features: git bar, archive & MCP managers and the /init command. Changes apply live.",sectionText:"Text",sectionLayout:"Layout",sectionFeatures:"Features",codeFontSize:"Code font size",codeFontSizeHint:`Absolute code size in px (${k}–${C}); ${g}px is DSH's default at a 14px body. Applies to code blocks; inline code follows proportionally.`,timeline:"Timeline",timelineHint:"Native: DSH’s built-in turn rail at the right edge (stock). Web (classic): the v0.11 right-side navigation rail — hover to preview, click to jump; auto-hidden in short conversations.",timelineNative:"Native",timelineWeb:"Web (classic)",theme:"Theme",themeHint:"Conversation skin. Default keeps DSH’s stock look; Minimal leaves the stock look alone and only tints markdown inline code with the Anthropic red (#c15f3c in light, #d97757 in dark); Neon poster is a two-scheme skin — paper-white with ink-black hairlines in light mode, near-black with light hairlines in dark mode, lime highlights and an Anthropic-red action accent, applied live.",themeDefault:"Default",themeMinimal:"Minimal",themeNeonLime:"Neon poster",sectionSearch:"Web search",searchOn:"On",searchOff:"Off",searchEnabled:"Web search",searchEnabledHint:'Takes over the built-in web_search tool with this plugin’s multi-engine provider, and adds a "搜索" settings page for the engine picker and per-platform API keys. Off restores the stock backend.',searchNav:"Search",searchTitle:"Web search",searchIntro:"Pick the preferred engine for the built-in web_search tool; any engine that fails falls through to the next one automatically.",sectionKeys:"API keys",keyFree:"FREE",keyOptional:"KEY OPTIONAL",keyRequired:"KEY REQUIRED",keyConfigured:"Configured",keyNotConfigured:"Not configured",keySave:"Save",keyClear:"Clear",keySaved:"Key saved.",keyCleared:"Key cleared.",keyEnvHint:"Keys are stored in the credentials center, one per line:",searchTest:"Test engine",searchTesting:"Testing…",searchTestOk:"Engine works",searchTestFail:"Engine failed",searchEngine:"Search engine",searchEngineHint:"Backend for the built-in web_search tool. Free engines (Bing, DuckDuckGo) need no key; Exa / Tavily / Keenable use their keyless anonymous quota without one; Perplexity and DeepSeek require a key.",searchEngineBing:"Bing (free)",searchEngineDdg:"DuckDuckGo (free)",searchEngineExa:"Exa",searchEngineTavily:"Tavily",searchEngineKeenable:"Keenable",searchEnginePerplexity:"Perplexity",searchEngineDeepseek:"DeepSeek",bingMarket:"Bing market",bingMarketHint:"Market code for Bing results, e.g. zh-CN or en-US.",searchKeysHint:"API keys live in ~/.dsh/.credentials.yaml, one per line: EXA_API_KEY / TAVILY_API_KEY / KEENABLE_API_KEY / PERPLEXITY_API_KEY / DEEPSEEK_API_KEY: sk-.... Keys resolve from the credentials center first, then environment variables.",gitBar:"Git bar",gitBarHint:"Branch / diff pills above the input inside git repos, with branch management and commit & push; auto-hidden outside git.",gitBarOn:"On",gitBarOff:"Off",archiveManager:"Archive manager",archiveManagerHint:"An Archive settings page to restore or permanently delete archived sessions.",archiveManagerOn:"On",archiveManagerOff:"Off",mcpManager:"MCP manager",mcpManagerHint:"An MCP settings page listing servers with status and tools; edit and restart them.",mcpManagerOn:"On",mcpManagerOff:"Off",mcpNav:"MCP",mcpTitle:"MCP servers",mcpEmpty:"No MCP servers configured.",mcpStatusActive:"Running",mcpStatusFailed:"Failed",mcpStatusLoading:"Loading",mcpStatusStopped:"Stopped",mcpStatusDisabled:"Disabled",mcpTools:"tools",mcpEnv:"Env",mcpAdd:"Add server",mcpAddTitle:"Add MCP server",mcpEditTitle:"Edit MCP server",mcpEdit:"Edit",mcpDelete:"Delete",mcpEnabledAction:"Enable",mcpDisabledAction:"Disable",mcpSaved:"Saved.",mcpRemoved:"Removed.",mcpFormTab:"Form",mcpYamlTab:"YAML",mcpYamlHint:"Fill in the MCP config directly (serverName / transport / command / args / env / toolCallTimeoutMs / url / headers …). It is validated before saving.",mcpYamlPlaceholder:`serverName: my-server
505
505
  transport: stdio
506
506
  command: npx
507
507
  args:
@@ -509,7 +509,7 @@ args:
509
509
  - "@some/mcp-server"
510
510
  env:
511
511
  KEY: value
512
- toolCallTimeoutMs: 60000`,mcpFieldId:"Instance ID",mcpFieldIdHint:"Loader entry id (letters, digits, - and _ only); it must be unique.",mcpFieldName:"Name",mcpFieldNameHint:"Tool namespace `mcp__<name>__*`; letters, digits, - and _ (1–32).",mcpFieldType:"Type",mcpFieldTimeout:"Timeout (ms)",mcpFieldCommand:"Command",mcpFieldCommandPlaceholder:"e.g. npx",mcpFieldArgs:"Arguments (one per line)",mcpFieldEnv:"Environment vars (optional, KEY=value per line)",mcpFieldUrl:"URL",mcpFieldHeaders:"Headers (optional, Key: value per line)",mcpFieldEnabled:"Enabled",mcpSave:"Save",mcpCancel:"Cancel",mcpInvalidId:"Instance ID may only contain letters, digits, - and _.",mcpInvalidName:"Name may only contain letters, digits, - and _ (1–32 chars).",mcpInvalidTimeout:"Timeout must be a positive integer (ms).",mcpInvalidUrl:"URL must start with http:// or https://.",mcpInvalidCommand:"Command is required.",mcpUnavailable:"MCP manager unavailable.",mcpDisabledHint:"MCP management is off. Turn it on in 界面调整 (UI Tweaks) to view and restart MCP servers here.",mcpEnable:"Enable MCP manager",initCommand:"/init command",initCommandHint:"The /init slash command: pick a prompt language and the agent analyzes the project and writes AGENTS.md.",initCommandOn:"On",initCommandOff:"Off",preciseCacheHit:"Precise cache hit",preciseCacheHitHint:"Rewrites the cache-hit figure in the stats line under the input box to two decimal places (e.g. 96.35%), computed from the raw cached-read / cached-write / uncached-input token buckets instead of the stock rounded integer.",preciseCacheHitOn:"On",preciseCacheHitOff:"Off",sectionNotifications:"Task alerts",notifications:"Enable alerts",notificationsHint:"Call you back while the tab is in the background: a session finishes its turn, or one starts waiting for your approval, plan review or answer. The switches below apply only while this is on.",notifyOn:"On",notifyOff:"Off",notifyOnComplete:"Alert on finish",notifyOnCompleteHint:"Fire when a session ends its turn — completed, interrupted or failed; the notification says which.",notifyOnInteraction:"Alert on interaction",notifyOnInteractionHint:"Fire when a session waits on you: an approval, a plan review, or a question from the agent.",notifyOnlyWhenHidden:"Only when hidden",notifyOnlyWhenHiddenHint:"Stay quiet while you are looking at this page; alert only once the tab is hidden or unfocused.",notifyTitleFlash:"Tab title flash",notifyTitleFlashHint:"Blink an unread counter into the tab title until you come back.",notifySystemNotification:"System notifications",notifySystemNotificationHint:"Desktop-level notifications; click one to jump straight to that session. Permission is requested when enabled.",notifySound:"Chime",notifySoundHint:"A soft two-note motif — rising when work finishes, falling when it needs you.",notifyTest:"Test",notifyTitleDone:"Task finished",notifyTitleAborted:"Task interrupted",notifyTitleFailed:"Request failed",notifyTitlePending:"Needs you",bodyComplete:"✅ {title} finished its turn.",bodyAborted:"⏹ {title} was interrupted before finishing.",bodyFailed:"❌ {title} failed: {error}",bodyApproval:"⏸ {title} is waiting for your approval.",bodyPlan:"📋 {title} has a plan awaiting your review.",bodyQuestion:"❓ {title} asked you a question.",mcpServerDetail:"Configured in the profile cordis.patch.yml as @deepseek-ai/dsh-mcp-client instances; add / edit / disable / delete write to that file and apply live.",archiveNav:"Archive",archiveTitle:"Archived sessions",archiveEmpty:"No archived sessions.",archiveRestore:"Restore",archiveRestoring:"Working…",archiveDelete:"Delete",archiveDeleteAll:"Delete all",archiveRestoreAll:"Restore all",archiveCount:"sessions",archiveUnavailable:"Archive unavailable.",archiveLiveError:"This session is running; close it before permanently deleting it.",archiveDisabledHint:"Archive management is off. Turn it on in 界面调整 (UI Tweaks) to restore or permanently delete archived sessions here.",archiveEnable:"Enable archive management",archiveRestored:"Restored.",railLabel:"Chat timeline",roleUser:"User",noText:"(no text)",defaultAction:"Default",reset:"Reset",resetDone:"Reset to default.",applied:"Applied",unavailable:"Settings unavailable.",loading:"Loading…",readOnly:"The active Settings provider is read-only.",saved:"Saved.",commitMessage:"Commit",diffFiles:"files",branchLocal:"Local branches",branchRemote:"Remote branches",branchNew:"New branch",branchNewPlaceholder:"Branch name, e.g. fix/typo",branchRename:"Rename",tagsTitle:"Tag",tagCreate:"New Tag",tagCreatePlaceholder:"Tag name, e.g. v1.2.0",tagMessagePlaceholder:"Message (optional, makes it annotated)",tagPush:"Push Tag",tagDelete:"Delete Tag",tagCommitPlaceholder:"Tag (optional)",branchCreate:"Create",diffView:"Code diff",diffOnly:"Hunks",diffFull:"Full file",commitTitle:"Commit changes",commitPlaceholder:"Describe your changes…",commitHint:"Committing stages the checked files (untracked included) and commits; unchecked files are excluded from this commit. “Commit & push” also pushes; a new branch gets an -u upstream.",commitWillCommit:"To commit",commitViewDiff:"View",commitEmpty:"Write a commit message first",commitCancel:"Cancel",commitSubmit:"Commit",commitSubmitPush:"Commit & push",commitBusy:"Task in progress — commit is unavailable while the agent is working.",dirty:"Uncommitted changes",clean:"Working tree clean",noChanges:"No changes here.",branchDelete:"Delete branch",branchDeleteConfirm:"Confirm?",branchRemoteDelete:"Delete remote branch",branchFrom:"From branch",branchFromHead:"Current HEAD (default)",branchGraph:"Graph",branchCancel:"Cancel",branchRefresh:"Refresh",graphTitle:"Commit graph",graphColGraph:"Graph",graphColCommit:"Commit",graphColSubject:"Description",graphColAuthor:"Author",graphColDate:"Date",branchPushRemote:"Push to remote",branchPull:"Pull",includeFile:"Include in commit",excludeFile:"Exclude from commit",diffGuide:"Review working-tree changes and commit.",notRepo:"Not a git repository.",initDesc:"Analyze this project and generate an AGENTS.md for future coding agents",initOptionZh:"AGENTS.md — Chinese prompt",initOptionZhDetail:"Submit a Chinese prompt asking the agent to analyze the project and write or improve AGENTS.md.",initOptionEn:"AGENTS.md — English prompt",initOptionEnDetail:"Submit an English prompt asking the agent to analyze the project and write or improve AGENTS.md.",initFailed:"/init failed to send the prompt"},I={nav:"界面调整",settingsTitle:"界面调整",settingsIntro:"调整对话界面——代码字号、表格与布局,以及时间线、Git 状态栏、归档 / MCP 管理、/init 命令等功能开关,修改即时生效。",sectionText:"文本",sectionLayout:"布局",sectionFeatures:"功能",codeFontSize:"代码字号",codeFontSizeHint:`代码绝对字号,取值 ${k}–${S}px;${m}px 为 DSH 默认(正文 14 时)。作用于代码块,行内代码按比例跟随。`,timeline:"时间线",timelineHint:"原生:DSH 自带的回合导航轨(消息右侧小圆点,默认)。网页(经典):找回 v0.11 的右侧导航轨——悬停预览、点击跳转;会话较短时自动隐藏。",timelineNative:"原生",timelineWeb:"网页(经典)",theme:"主题",themeHint:"对话皮肤。默认保持 DSH 原生外观;简约同样保持原生外观,只把 Markdown 行内代码染成 Anthropic 红(浅色 #c15f3c / 深色 #d97757);荧光海报是海报风双方案——浅色下纸白底黑粗线,深色下近黑底浅粗线,都配荧光黄高亮 + Anthropic 红点缀,切换即时生效。",themeDefault:"默认",themeMinimal:"简约",themeNeonLime:"荧光海报",sectionSearch:"网络搜索",searchOn:"开",searchOff:"关",searchEnabled:"网络搜索",searchEnabledHint:"用本插件的多引擎 provider 接管内置 web_search 工具,并新增「搜索」设置页:选择引擎、按平台填写 API key。关闭后恢复官方搜索后端。",searchNav:"搜索",searchTitle:"网络搜索",searchIntro:"为内置 web_search 工具选择首选引擎;任一引擎失败会自动回退到下一个。",sectionKeys:"API 密钥",keyFree:"免费",keyOptional:"可选",keyRequired:"必填",keyConfigured:"已配置",keyNotConfigured:"未配置",keySave:"保存",keyClear:"清除",keySaved:"已保存。",keyCleared:"已清除。",keyEnvHint:"密钥保存在凭据中心文件中,每行一个:",searchTest:"测试引擎",searchTesting:"测试中…",searchTestOk:"引擎可用",searchTestFail:"引擎失败",searchEngine:"搜索引擎",searchEngineHint:"内置 web_search 工具的后端。免费引擎(Bing、DuckDuckGo)无需 key;Exa / Tavily / Keenable 无 key 时走匿名免费额度;Perplexity 和 DeepSeek 需要配置 key。",searchEngineBing:"Bing(免费)",searchEngineDdg:"DuckDuckGo(免费)",searchEngineExa:"Exa",searchEngineTavily:"Tavily",searchEngineKeenable:"Keenable",searchEnginePerplexity:"Perplexity",searchEngineDeepseek:"DeepSeek",bingMarket:"Bing 市场",bingMarketHint:"Bing 结果的市场代码,如 zh-CN 或 en-US。",searchKeysHint:"API key 存放在 ~/.dsh/.credentials.yaml,每行一个:EXA_API_KEY / TAVILY_API_KEY / KEENABLE_API_KEY / PERPLEXITY_API_KEY / DEEPSEEK_API_KEY: sk-...。解析优先级:凭据中心 → 环境变量。",gitBar:"Git 状态栏",gitBarHint:"git 仓库内时在输入框上方显示 分支 / 差异 胶囊,支持分支管理与提交推送;非 git 目录自动隐藏。",gitBarOn:"开启",gitBarOff:"关闭",archiveManager:"归档管理",archiveManagerHint:"在设置中显示「归档」页面:恢复或彻底删除已归档会话。",archiveManagerOn:"开启",archiveManagerOff:"关闭",mcpManager:"MCP 管理",mcpManagerHint:"在设置中显示「MCP 管理」页面:查看服务器状态与工具,可编辑并重启。",mcpManagerOn:"开启",mcpManagerOff:"关闭",mcpNav:"MCP 管理",mcpTitle:"MCP 服务器",mcpEmpty:"未配置任何 MCP 服务器。",mcpStatusActive:"运行中",mcpStatusFailed:"错误",mcpStatusLoading:"加载中",mcpStatusStopped:"未运行",mcpStatusDisabled:"已停用",mcpTools:"个工具",mcpEnv:"环境变量",mcpAdd:"添加服务器",mcpAddTitle:"添加 MCP 服务器",mcpEditTitle:"编辑 MCP 服务器",mcpEdit:"编辑",mcpDelete:"删除",mcpEnabledAction:"启用",mcpDisabledAction:"停用",mcpSaved:"已保存。",mcpRemoved:"已删除。",mcpFormTab:"表单",mcpYamlTab:"YAML",mcpYamlHint:"直接填写 MCP 配置(serverName / transport / command / args / env / toolCallTimeoutMs / url / headers …),保存前会校验格式。",mcpYamlPlaceholder:`serverName: my-server
512
+ toolCallTimeoutMs: 60000`,mcpFieldId:"Instance ID",mcpFieldIdHint:"Loader entry id (letters, digits, - and _ only); it must be unique.",mcpFieldName:"Name",mcpFieldNameHint:"Tool namespace `mcp__<name>__*`; letters, digits, - and _ (1–32).",mcpFieldType:"Type",mcpFieldTimeout:"Timeout (ms)",mcpFieldCommand:"Command",mcpFieldCommandPlaceholder:"e.g. npx",mcpFieldArgs:"Arguments (one per line)",mcpFieldEnv:"Environment vars (optional, KEY=value per line)",mcpFieldUrl:"URL",mcpFieldHeaders:"Headers (optional, Key: value per line)",mcpFieldEnabled:"Enabled",mcpSave:"Save",mcpCancel:"Cancel",mcpInvalidId:"Instance ID may only contain letters, digits, - and _.",mcpInvalidName:"Name may only contain letters, digits, - and _ (1–32 chars).",mcpInvalidTimeout:"Timeout must be a positive integer (ms).",mcpInvalidUrl:"URL must start with http:// or https://.",mcpInvalidCommand:"Command is required.",mcpUnavailable:"MCP manager unavailable.",mcpDisabledHint:"MCP management is off. Turn it on in 界面调整 (UI Tweaks) to view and restart MCP servers here.",mcpEnable:"Enable MCP manager",initCommand:"/init command",initCommandHint:"The /init slash command: pick a prompt language and the agent analyzes the project and writes AGENTS.md.",initCommandOn:"On",initCommandOff:"Off",preciseCacheHit:"Precise cache hit",preciseCacheHitHint:"Rewrites the cache-hit figure in the stats line under the input box to two decimal places (e.g. 96.35%), computed from the raw cached-read / cached-write / uncached-input token buckets instead of the stock rounded integer.",preciseCacheHitOn:"On",preciseCacheHitOff:"Off",sectionNotifications:"Task alerts",notifications:"Enable alerts",notificationsHint:"Call you back while the tab is in the background: a session finishes its turn, or one starts waiting for your approval, plan review or answer. The switches below apply only while this is on.",notifyOn:"On",notifyOff:"Off",notifyOnComplete:"Alert on finish",notifyOnCompleteHint:"Fire when a session ends its turn — completed, interrupted or failed; the notification says which.",notifyOnInteraction:"Alert on interaction",notifyOnInteractionHint:"Fire when a session waits on you: an approval, a plan review, or a question from the agent.",notifyOnlyWhenHidden:"Only when hidden",notifyOnlyWhenHiddenHint:"Stay quiet while you are looking at this page; alert only once the tab is hidden or unfocused.",notifyTitleFlash:"Tab title flash",notifyTitleFlashHint:"Blink an unread counter into the tab title until you come back.",notifySystemNotification:"System notifications",notifySystemNotificationHint:"Desktop-level notifications; click one to jump straight to that session. Permission is requested when enabled.",notifySound:"Chime",notifySoundHint:"A soft two-note motif — rising when work finishes, falling when it needs you.",notifyTest:"Test",notifyTitleDone:"Task finished",notifyTitleAborted:"Task interrupted",notifyTitleFailed:"Request failed",notifyTitlePending:"Needs you",bodyComplete:"✅ {title} finished its turn.",bodyAborted:"⏹ {title} was interrupted before finishing.",bodyFailed:"❌ {title} failed: {error}",bodyApproval:"⏸ {title} is waiting for your approval.",bodyPlan:"📋 {title} has a plan awaiting your review.",bodyQuestion:"❓ {title} asked you a question.",mcpServerDetail:"Configured in the profile cordis.patch.yml as @deepseek-ai/dsh-mcp-client instances; add / edit / disable / delete write to that file and apply live.",archiveNav:"Archive",archiveTitle:"Archived sessions",archiveEmpty:"No archived sessions.",archiveRestore:"Restore",archiveRestoring:"Working…",archiveDelete:"Delete",archiveDeleteAll:"Delete all",archiveRestoreAll:"Restore all",archiveCount:"sessions",archiveUnavailable:"Archive unavailable.",archiveLiveError:"This session is running; close it before permanently deleting it.",archiveDisabledHint:"Archive management is off. Turn it on in 界面调整 (UI Tweaks) to restore or permanently delete archived sessions here.",archiveEnable:"Enable archive management",archiveRestored:"Restored.",railLabel:"Chat timeline",roleUser:"User",noText:"(no text)",defaultAction:"Default",reset:"Reset",resetDone:"Reset to default.",applied:"Applied",unavailable:"Settings unavailable.",loading:"Loading…",readOnly:"The active Settings provider is read-only.",saved:"Saved.",commitMessage:"Commit",diffFiles:"files",branchLocal:"Local branches",branchRemote:"Remote branches",branchNew:"New branch",branchNewPlaceholder:"Branch name, e.g. fix/typo",branchRename:"Rename",tagsTitle:"Tag",tagCreate:"New Tag",tagCreatePlaceholder:"Tag name, e.g. v1.2.0",tagMessagePlaceholder:"Message (optional, makes it annotated)",tagPush:"Push Tag",tagDelete:"Delete Tag",tagCommitPlaceholder:"Tag (optional)",branchCreate:"Create",diffView:"Code diff",diffOnly:"Hunks",diffFull:"Full file",commitTitle:"Commit changes",commitPlaceholder:"Describe your changes…",commitHint:"Committing stages the checked files (untracked included) and commits; unchecked files are excluded from this commit. “Commit & push” also pushes; a new branch gets an -u upstream.",commitWillCommit:"To commit",commitViewDiff:"View",commitEmpty:"Write a commit message first",commitCancel:"Cancel",commitSubmit:"Commit",commitSubmitPush:"Commit & push",commitBusy:"Task in progress — commit is unavailable while the agent is working.",dirty:"Uncommitted changes",clean:"Working tree clean",noChanges:"No changes here.",branchDelete:"Delete branch",branchDeleteConfirm:"Confirm?",branchRemoteDelete:"Delete remote branch",branchFrom:"From branch",branchFromHead:"Current HEAD (default)",branchGraph:"Graph",branchCancel:"Cancel",branchRefresh:"Refresh",graphTitle:"Commit graph",graphColGraph:"Graph",graphColCommit:"Commit",graphColSubject:"Description",graphColAuthor:"Author",graphColDate:"Date",branchPushRemote:"Push to remote",branchPull:"Pull",includeFile:"Include in commit",excludeFile:"Exclude from commit",diffGuide:"Review working-tree changes and commit.",notRepo:"Not a git repository.",initDesc:"Analyze this project and generate an AGENTS.md for future coding agents",initOptionZh:"AGENTS.md — Chinese prompt",initOptionZhDetail:"Submit a Chinese prompt asking the agent to analyze the project and write or improve AGENTS.md.",initOptionEn:"AGENTS.md — English prompt",initOptionEnDetail:"Submit an English prompt asking the agent to analyze the project and write or improve AGENTS.md.",initFailed:"/init failed to send the prompt"},B={nav:"界面调整",settingsTitle:"界面调整",settingsIntro:"调整对话界面——代码字号、表格与布局,以及时间线、Git 状态栏、归档 / MCP 管理、/init 命令等功能开关,修改即时生效。",sectionText:"文本",sectionLayout:"布局",sectionFeatures:"功能",codeFontSize:"代码字号",codeFontSizeHint:`代码绝对字号,取值 ${k}–${C}px;${g}px 为 DSH 默认(正文 14 时)。作用于代码块,行内代码按比例跟随。`,timeline:"时间线",timelineHint:"原生:DSH 自带的回合导航轨(消息右侧小圆点,默认)。网页(经典):找回 v0.11 的右侧导航轨——悬停预览、点击跳转;会话较短时自动隐藏。",timelineNative:"原生",timelineWeb:"网页(经典)",theme:"主题",themeHint:"对话皮肤。默认保持 DSH 原生外观;简约同样保持原生外观,只把 Markdown 行内代码染成 Anthropic 红(浅色 #c15f3c / 深色 #d97757);荧光海报是海报风双方案——浅色下纸白底黑粗线,深色下近黑底浅粗线,都配荧光黄高亮 + Anthropic 红点缀,切换即时生效。",themeDefault:"默认",themeMinimal:"简约",themeNeonLime:"荧光海报",sectionSearch:"网络搜索",searchOn:"开",searchOff:"关",searchEnabled:"网络搜索",searchEnabledHint:"用本插件的多引擎 provider 接管内置 web_search 工具,并新增「搜索」设置页:选择引擎、按平台填写 API key。关闭后恢复官方搜索后端。",searchNav:"搜索",searchTitle:"网络搜索",searchIntro:"为内置 web_search 工具选择首选引擎;任一引擎失败会自动回退到下一个。",sectionKeys:"API 密钥",keyFree:"免费",keyOptional:"可选",keyRequired:"必填",keyConfigured:"已配置",keyNotConfigured:"未配置",keySave:"保存",keyClear:"清除",keySaved:"已保存。",keyCleared:"已清除。",keyEnvHint:"密钥保存在凭据中心文件中,每行一个:",searchTest:"测试引擎",searchTesting:"测试中…",searchTestOk:"引擎可用",searchTestFail:"引擎失败",searchEngine:"搜索引擎",searchEngineHint:"内置 web_search 工具的后端。免费引擎(Bing、DuckDuckGo)无需 key;Exa / Tavily / Keenable 无 key 时走匿名免费额度;Perplexity 和 DeepSeek 需要配置 key。",searchEngineBing:"Bing(免费)",searchEngineDdg:"DuckDuckGo(免费)",searchEngineExa:"Exa",searchEngineTavily:"Tavily",searchEngineKeenable:"Keenable",searchEnginePerplexity:"Perplexity",searchEngineDeepseek:"DeepSeek",bingMarket:"Bing 市场",bingMarketHint:"Bing 结果的市场代码,如 zh-CN 或 en-US。",searchKeysHint:"API key 存放在 ~/.dsh/.credentials.yaml,每行一个:EXA_API_KEY / TAVILY_API_KEY / KEENABLE_API_KEY / PERPLEXITY_API_KEY / DEEPSEEK_API_KEY: sk-...。解析优先级:凭据中心 → 环境变量。",gitBar:"Git 状态栏",gitBarHint:"git 仓库内时在输入框上方显示 分支 / 差异 胶囊,支持分支管理与提交推送;非 git 目录自动隐藏。",gitBarOn:"开启",gitBarOff:"关闭",archiveManager:"归档管理",archiveManagerHint:"在设置中显示「归档」页面:恢复或彻底删除已归档会话。",archiveManagerOn:"开启",archiveManagerOff:"关闭",mcpManager:"MCP 管理",mcpManagerHint:"在设置中显示「MCP 管理」页面:查看服务器状态与工具,可编辑并重启。",mcpManagerOn:"开启",mcpManagerOff:"关闭",mcpNav:"MCP 管理",mcpTitle:"MCP 服务器",mcpEmpty:"未配置任何 MCP 服务器。",mcpStatusActive:"运行中",mcpStatusFailed:"错误",mcpStatusLoading:"加载中",mcpStatusStopped:"未运行",mcpStatusDisabled:"已停用",mcpTools:"个工具",mcpEnv:"环境变量",mcpAdd:"添加服务器",mcpAddTitle:"添加 MCP 服务器",mcpEditTitle:"编辑 MCP 服务器",mcpEdit:"编辑",mcpDelete:"删除",mcpEnabledAction:"启用",mcpDisabledAction:"停用",mcpSaved:"已保存。",mcpRemoved:"已删除。",mcpFormTab:"表单",mcpYamlTab:"YAML",mcpYamlHint:"直接填写 MCP 配置(serverName / transport / command / args / env / toolCallTimeoutMs / url / headers …),保存前会校验格式。",mcpYamlPlaceholder:`serverName: my-server
513
513
  transport: stdio
514
514
  command: npx
515
515
  args:
@@ -517,7 +517,7 @@ args:
517
517
  - "@some/mcp-server"
518
518
  env:
519
519
  KEY: value
520
- toolCallTimeoutMs: 60000`,mcpFieldId:"实例 ID",mcpFieldIdHint:"加载器条目 ID(仅字母、数字、- 和 _),需唯一。",mcpFieldName:"名称",mcpFieldNameHint:"工具命名空间 `mcp__<名称>__*`;字母、数字、- 和 _(1–32 字符)。",mcpFieldType:"类型",mcpFieldTimeout:"超时时间 (ms)",mcpFieldCommand:"命令",mcpFieldCommandPlaceholder:"如 npx",mcpFieldArgs:"参数(每行一个)",mcpFieldEnv:"环境变量(可选,每行 KEY=值)",mcpFieldUrl:"URL",mcpFieldHeaders:"请求头(可选,每行 Key: 值)",mcpFieldEnabled:"启用",mcpSave:"保存",mcpCancel:"取消",mcpInvalidId:"实例 ID 只能包含字母、数字、- 和 _。",mcpInvalidName:"名称只能包含字母、数字、- 和 _(1–32 字符)。",mcpInvalidTimeout:"超时时间必须是正整数(毫秒)。",mcpInvalidUrl:"URL 必须以 http:// 或 https:// 开头。",mcpInvalidCommand:"命令不能为空。",mcpUnavailable:"MCP 管理暂不可用。",mcpDisabledHint:"MCP 管理尚未开启。在「界面调整」中开启“MCP 管理”后,可在此查看并重启 MCP 服务器。",mcpEnable:"开启 MCP 管理",initCommand:"/init 命令",initCommandHint:"注册 /init 斜杠命令:选择提示词语言后,让代理分析项目并生成 AGENTS.md。",initCommandOn:"开启",initCommandOff:"关闭",preciseCacheHit:"缓存命中率两位小数",preciseCacheHitHint:"把输入框下方统计条里的缓存命中百分比改写为两位小数(如 96.35%)——用原始 token 数(缓存读取 ÷ 计费输入)计算,而不是 DSH 取整后的整数。",preciseCacheHitOn:"开启",preciseCacheHitOff:"关闭",sectionNotifications:"任务提醒",notifications:"启用提醒",notificationsHint:"标签页在后台时唤你回来:会话完成了任务,或开始等待你的审批、计划确认或回答。下方开关仅在总开关开启时生效。",notifyOn:"开启",notifyOff:"关闭",notifyOnComplete:"完成提醒",notifyOnCompleteHint:"会话结束一轮任务时提醒——完成、被中断或出错都会通知,并注明是哪种情况。",notifyOnInteraction:"交互提醒",notifyOnInteractionHint:"会话等待你操作时提醒:审批、计划确认,或模型向你提问。",notifyOnlyWhenHidden:"仅页面不可见时",notifyOnlyWhenHiddenHint:"你正盯着本页时保持安静;切走标签页或最小化窗口后才开始提醒。",notifyTitleFlash:"标题闪烁",notifyTitleFlashHint:"在浏览器标签页标题中闪烁未读计数,直到你回到页面。",notifySystemNotification:"系统通知",notifySystemNotificationHint:"桌面级通知;点击通知可直达对应会话。开启时会向浏览器申请通知权限。",notifySound:"提示音",notifySoundHint:"轻柔的双音提示——上行表示完成,下行表示需要你处理。",notifyTest:"测试",notifyTitleDone:"任务完成",notifyTitleAborted:"任务已中断",notifyTitleFailed:"请求失败",notifyTitlePending:"需要你处理",bodyComplete:"✅ 「{title}」的任务已完成。",bodyAborted:"⏹ 「{title}」的任务被中断了。",bodyFailed:"❌ 「{title}」的任务出错了:{error}",bodyApproval:"⏸ 「{title}」正在等待你的审批。",bodyPlan:"📋 「{title}」有计划待确认。",bodyQuestion:"❓ 「{title}」向你提问了。",mcpServerDetail:"MCP 服务器配置在 profile 的 cordis.patch.yml(@deepseek-ai/dsh-mcp-client 实例);添加 / 编辑 / 停用 / 删除会写入该文件,改动实时生效。",archiveNav:"归档",archiveTitle:"已归档会话",archiveEmpty:"暂无归档会话。",archiveRestore:"恢复",archiveRestoring:"处理中…",archiveDelete:"删除",archiveDeleteAll:"全部删除",archiveRestoreAll:"全部恢复",archiveCount:"个会话",archiveUnavailable:"归档暂不可用。",archiveLiveError:"该会话正在运行,无法彻底删除,请先关闭该会话。",archiveDisabledHint:"归档管理尚未开启。在「界面调整」中开启“归档管理”后,可在此查看、恢复或彻底删除已归档会话。",archiveEnable:"开启归档管理",archiveRestored:"已恢复。",railLabel:"对话时间线",roleUser:"用户",noText:"(无文本内容)",defaultAction:"默认",reset:"重置",resetDone:"已重置为默认。",applied:"已应用",unavailable:"设置暂不可用。",loading:"加载中…",readOnly:"当前设置提供方为只读。",saved:"已保存。",commitMessage:"Commit",diffFiles:"个文件",branchLocal:"本地分支",branchRemote:"远程分支",branchNew:"新建分支",branchNewPlaceholder:"分支名,如 fix/typo",branchRename:"重命名",tagsTitle:"Tag",tagCreate:"新建 Tag",tagCreatePlaceholder:"Tag 名,如 v1.2.0",tagMessagePlaceholder:"说明(可选,填写即 annotated tag)",tagPush:"推送 Tag",tagDelete:"删除 Tag",tagCommitPlaceholder:"Tag(可选)",branchCreate:"创建",diffView:"代码差异",diffOnly:"仅差异",diffFull:"完整文件",commitTitle:"提交变更",commitPlaceholder:"描述你的改动…",commitHint:"提交会暂存勾选的文件(含未跟踪新文件);取消勾选的文件将不包含在本次提交中。「提交并推送」提交后自动 push,新分支自动 -u 设上游。",commitWillCommit:"将提交",commitViewDiff:"查看",commitEmpty:"请先填写提交说明",commitCancel:"取消",commitSubmit:"提交",commitSubmitPush:"提交并推送",commitBusy:"任务进行中,暂不能提交。",dirty:"有未提交改动",clean:"工作区干净",noChanges:"这里没有差异。",branchDelete:"删除分支",branchDeleteConfirm:"确认删除?",branchRemoteDelete:"删除远程分支",branchFrom:"基于分支",branchFromHead:"当前 HEAD(默认)",branchGraph:"图谱",branchCancel:"取消",branchRefresh:"刷新",graphTitle:"提交图谱",graphColGraph:"图",graphColCommit:"提交",graphColSubject:"描述",graphColAuthor:"作者",graphColDate:"日期",branchPushRemote:"推送到远程",branchPull:"拉取",includeFile:"提交包含此文件",excludeFile:"提交排除此文件",diffGuide:"查看工作区改动并提交。",notRepo:"当前目录不是 git 仓库。",initDesc:"分析当前项目并生成 AGENTS.md,供未来的 AI 编码代理使用",initOptionZh:"AGENTS.md(中文提示词)",initOptionZhDetail:"向会话提交中文提示词,让代理分析项目并生成或改进 AGENTS.md。",initOptionEn:"AGENTS.md(英文提示词)",initOptionEnDetail:"向会话提交英文提示词,让代理分析项目并生成或改进 AGENTS.md。",initFailed:"/init 提示词发送失败"};function $(r){return{codeFontSize:typeof r?.codeFontSize=="number"?Math.min(S,Math.max(k,r.codeFontSize)):Math.max(8,Math.round(m*((r?.codeFontScale??c)/c))),timelineStyle:r?.timelineStyle==="web"?"web":"native",themeStyle:r?.themeStyle==="neon-lime"?"neon-lime":r?.themeStyle==="minimal"?"minimal":"default",searchEngine:r?.searchEngine??"bing",bingMarket:r?.bingMarket??"zh-CN",gitBarEnabled:r?.gitBarEnabled??!1,archiveManagerEnabled:r?.archiveManagerEnabled??!1,mcpManagerEnabled:r?.mcpManagerEnabled??!1,searchEnabled:r?.searchEnabled??!1,initCommandEnabled:r?.initCommandEnabled??!1,preciseCacheHitEnabled:r?.preciseCacheHitEnabled??!1,notificationsEnabled:r?.notificationsEnabled??!1,notifyOnlyWhenHidden:r?.notifyOnlyWhenHidden??!0,notifyOnComplete:r?.notifyOnComplete??!0,notifyOnInteraction:r?.notifyOnInteraction??!0,notifyTitleFlash:r?.notifyTitleFlash??!0,notifySystemNotification:r?.notifySystemNotification??!0,notifySound:r?.notifySound??!1}}function W(r){if(r===m)return"";const t=getComputedStyle(document.body),u=(C,V)=>{const Y=t.getPropertyValue(C).trim();return Y.length>0?Y:V},s=u("--dsw-font-markdown-code-font-family",'"SF Mono", Consolas, monospace'),i=u("--dsw-font-markdown-code-block-font-family",'"SF Mono", Consolas, monospace'),v=[],g=(C,V,Y,be)=>{v.push(`--${C}:${V}px/${Y}px ${be}`),v.push(`--${C}-font-size:${V}px`),v.push(`--${C}-line-height:${Y}px`)},w=C=>Math.max(8,Math.round(r*C));return g("dsw-font-markdown-code",w(P),H,s),g("dsw-font-markdown-code-block",w(1),H,i),g("dsw-font-markdown-code-block-small",w(x),D,i),`body:not(#${O}){${v.join(";")}}`}const ne=`
520
+ toolCallTimeoutMs: 60000`,mcpFieldId:"实例 ID",mcpFieldIdHint:"加载器条目 ID(仅字母、数字、- 和 _),需唯一。",mcpFieldName:"名称",mcpFieldNameHint:"工具命名空间 `mcp__<名称>__*`;字母、数字、- 和 _(1–32 字符)。",mcpFieldType:"类型",mcpFieldTimeout:"超时时间 (ms)",mcpFieldCommand:"命令",mcpFieldCommandPlaceholder:"如 npx",mcpFieldArgs:"参数(每行一个)",mcpFieldEnv:"环境变量(可选,每行 KEY=值)",mcpFieldUrl:"URL",mcpFieldHeaders:"请求头(可选,每行 Key: 值)",mcpFieldEnabled:"启用",mcpSave:"保存",mcpCancel:"取消",mcpInvalidId:"实例 ID 只能包含字母、数字、- 和 _。",mcpInvalidName:"名称只能包含字母、数字、- 和 _(1–32 字符)。",mcpInvalidTimeout:"超时时间必须是正整数(毫秒)。",mcpInvalidUrl:"URL 必须以 http:// 或 https:// 开头。",mcpInvalidCommand:"命令不能为空。",mcpUnavailable:"MCP 管理暂不可用。",mcpDisabledHint:"MCP 管理尚未开启。在「界面调整」中开启“MCP 管理”后,可在此查看并重启 MCP 服务器。",mcpEnable:"开启 MCP 管理",initCommand:"/init 命令",initCommandHint:"注册 /init 斜杠命令:选择提示词语言后,让代理分析项目并生成 AGENTS.md。",initCommandOn:"开启",initCommandOff:"关闭",preciseCacheHit:"缓存命中率两位小数",preciseCacheHitHint:"把输入框下方统计条里的缓存命中百分比改写为两位小数(如 96.35%)——用原始 token 数(缓存读取 ÷ 计费输入)计算,而不是 DSH 取整后的整数。",preciseCacheHitOn:"开启",preciseCacheHitOff:"关闭",sectionNotifications:"任务提醒",notifications:"启用提醒",notificationsHint:"标签页在后台时唤你回来:会话完成了任务,或开始等待你的审批、计划确认或回答。下方开关仅在总开关开启时生效。",notifyOn:"开启",notifyOff:"关闭",notifyOnComplete:"完成提醒",notifyOnCompleteHint:"会话结束一轮任务时提醒——完成、被中断或出错都会通知,并注明是哪种情况。",notifyOnInteraction:"交互提醒",notifyOnInteractionHint:"会话等待你操作时提醒:审批、计划确认,或模型向你提问。",notifyOnlyWhenHidden:"仅页面不可见时",notifyOnlyWhenHiddenHint:"你正盯着本页时保持安静;切走标签页或最小化窗口后才开始提醒。",notifyTitleFlash:"标题闪烁",notifyTitleFlashHint:"在浏览器标签页标题中闪烁未读计数,直到你回到页面。",notifySystemNotification:"系统通知",notifySystemNotificationHint:"桌面级通知;点击通知可直达对应会话。开启时会向浏览器申请通知权限。",notifySound:"提示音",notifySoundHint:"轻柔的双音提示——上行表示完成,下行表示需要你处理。",notifyTest:"测试",notifyTitleDone:"任务完成",notifyTitleAborted:"任务已中断",notifyTitleFailed:"请求失败",notifyTitlePending:"需要你处理",bodyComplete:"✅ 「{title}」的任务已完成。",bodyAborted:"⏹ 「{title}」的任务被中断了。",bodyFailed:"❌ 「{title}」的任务出错了:{error}",bodyApproval:"⏸ 「{title}」正在等待你的审批。",bodyPlan:"📋 「{title}」有计划待确认。",bodyQuestion:"❓ 「{title}」向你提问了。",mcpServerDetail:"MCP 服务器配置在 profile 的 cordis.patch.yml(@deepseek-ai/dsh-mcp-client 实例);添加 / 编辑 / 停用 / 删除会写入该文件,改动实时生效。",archiveNav:"归档",archiveTitle:"已归档会话",archiveEmpty:"暂无归档会话。",archiveRestore:"恢复",archiveRestoring:"处理中…",archiveDelete:"删除",archiveDeleteAll:"全部删除",archiveRestoreAll:"全部恢复",archiveCount:"个会话",archiveUnavailable:"归档暂不可用。",archiveLiveError:"该会话正在运行,无法彻底删除,请先关闭该会话。",archiveDisabledHint:"归档管理尚未开启。在「界面调整」中开启“归档管理”后,可在此查看、恢复或彻底删除已归档会话。",archiveEnable:"开启归档管理",archiveRestored:"已恢复。",railLabel:"对话时间线",roleUser:"用户",noText:"(无文本内容)",defaultAction:"默认",reset:"重置",resetDone:"已重置为默认。",applied:"已应用",unavailable:"设置暂不可用。",loading:"加载中…",readOnly:"当前设置提供方为只读。",saved:"已保存。",commitMessage:"Commit",diffFiles:"个文件",branchLocal:"本地分支",branchRemote:"远程分支",branchNew:"新建分支",branchNewPlaceholder:"分支名,如 fix/typo",branchRename:"重命名",tagsTitle:"Tag",tagCreate:"新建 Tag",tagCreatePlaceholder:"Tag 名,如 v1.2.0",tagMessagePlaceholder:"说明(可选,填写即 annotated tag)",tagPush:"推送 Tag",tagDelete:"删除 Tag",tagCommitPlaceholder:"Tag(可选)",branchCreate:"创建",diffView:"代码差异",diffOnly:"仅差异",diffFull:"完整文件",commitTitle:"提交变更",commitPlaceholder:"描述你的改动…",commitHint:"提交会暂存勾选的文件(含未跟踪新文件);取消勾选的文件将不包含在本次提交中。「提交并推送」提交后自动 push,新分支自动 -u 设上游。",commitWillCommit:"将提交",commitViewDiff:"查看",commitEmpty:"请先填写提交说明",commitCancel:"取消",commitSubmit:"提交",commitSubmitPush:"提交并推送",commitBusy:"任务进行中,暂不能提交。",dirty:"有未提交改动",clean:"工作区干净",noChanges:"这里没有差异。",branchDelete:"删除分支",branchDeleteConfirm:"确认删除?",branchRemoteDelete:"删除远程分支",branchFrom:"基于分支",branchFromHead:"当前 HEAD(默认)",branchGraph:"图谱",branchCancel:"取消",branchRefresh:"刷新",graphTitle:"提交图谱",graphColGraph:"图",graphColCommit:"提交",graphColSubject:"描述",graphColAuthor:"作者",graphColDate:"日期",branchPushRemote:"推送到远程",branchPull:"拉取",includeFile:"提交包含此文件",excludeFile:"提交排除此文件",diffGuide:"查看工作区改动并提交。",notRepo:"当前目录不是 git 仓库。",initDesc:"分析当前项目并生成 AGENTS.md,供未来的 AI 编码代理使用",initOptionZh:"AGENTS.md(中文提示词)",initOptionZhDetail:"向会话提交中文提示词,让代理分析项目并生成或改进 AGENTS.md。",initOptionEn:"AGENTS.md(英文提示词)",initOptionEnDetail:"向会话提交英文提示词,让代理分析项目并生成或改进 AGENTS.md。",initFailed:"/init 提示词发送失败"};function W(s){return{codeFontSize:typeof s?.codeFontSize=="number"?Math.min(C,Math.max(k,s.codeFontSize)):Math.max(8,Math.round(g*((s?.codeFontScale??d)/d))),timelineStyle:s?.timelineStyle==="web"?"web":"native",themeStyle:s?.themeStyle==="neon-lime"?"neon-lime":s?.themeStyle==="minimal"?"minimal":"default",searchEngine:s?.searchEngine??"bing",bingMarket:s?.bingMarket??"zh-CN",gitBarEnabled:s?.gitBarEnabled??!1,archiveManagerEnabled:s?.archiveManagerEnabled??!1,mcpManagerEnabled:s?.mcpManagerEnabled??!1,searchEnabled:s?.searchEnabled??!1,initCommandEnabled:s?.initCommandEnabled??!1,preciseCacheHitEnabled:s?.preciseCacheHitEnabled??!1,notificationsEnabled:s?.notificationsEnabled??!1,notifyOnlyWhenHidden:s?.notifyOnlyWhenHidden??!0,notifyOnComplete:s?.notifyOnComplete??!0,notifyOnInteraction:s?.notifyOnInteraction??!0,notifyTitleFlash:s?.notifyTitleFlash??!0,notifySystemNotification:s?.notifySystemNotification??!0,notifySound:s?.notifySound??!1}}function G(s){if(s===g)return"";const t=getComputedStyle(document.body),u=(O,J)=>{const ie=t.getPropertyValue(O).trim();return ie.length>0?ie:J},r=u("--dsw-font-markdown-code-font-family",'"SF Mono", Consolas, monospace'),i=u("--dsw-font-markdown-code-block-font-family",'"SF Mono", Consolas, monospace'),b=[],v=(O,J,ie,pe)=>{b.push(`--${O}:${J}px/${ie}px ${pe}`),b.push(`--${O}-font-size:${J}px`),b.push(`--${O}-line-height:${ie}px`)},M=O=>Math.max(8,Math.round(s*O));return v("dsw-font-markdown-code",M(R),P,r),v("dsw-font-markdown-code-block",M(1),P,i),v("dsw-font-markdown-code-block-small",M(w),H,i),`body:not(#${D}){${b.join(";")}}`}const ne=`
521
521
  /* The host injects its theme sheets at runtime, so their <style> order against
522
522
  this one is not guaranteed; the id in :not() lifts the skin above the host's
523
523
  body[data-ds-dark-theme] palette (same specificity, later wins) without
@@ -838,11 +838,11 @@ body:not(#dsh-ui-tweaks-theme-scope)[data-ds-dark-theme] button[class*="newSessi
838
838
  .dut-panel{border-color:var(--dut-ink) !important;box-shadow:inset 0 0 0 1px var(--dut-ink),5px 5px 0 var(--dut-shadow) !important}
839
839
  .dut-seg button.dut-seg-active{background:var(--dut-lime) !important;color:#101418 !important}
840
840
  .dut-btn.dut-btn-active{background:var(--dut-lime) !important;color:#101418 !important;border-color:var(--dut-ink) !important}
841
- `,Z=`
841
+ `,V=`
842
842
  div[data-slot="conversation.chat.node"] [class*="_markdown_"] :not(pre)>code{color:#c15f3c}
843
843
  body[data-ds-dark-theme] div[data-slot="conversation.chat.node"] [class*="_markdown_"] :not(pre)>code{color:#d97757}
844
- `;function X(r){const t=[],u=W(r.codeFontSize);if(u!==""&&t.push(u),Math.abs(r.codeFontSize-m)>.5){const s=(.875*(r.codeFontSize/m)).toFixed(3);t.push(`div[data-slot="conversation.chat.node"] div[class*="_markdown_"] :not(pre)>code{font-size:${s}em !important}`)}return r.timelineStyle==="web"&&t.push('nav[style*="--turn-natural-height"]{display:none !important}'),r.themeStyle==="neon-lime"&&t.push(ne),r.themeStyle==="minimal"&&t.push(Z),t.join(`
845
- `)}function J(){const r="dsh-ui-tweaks-runtime";let t=document.querySelector(`style[data-plugin-css="${r}"]`);return t===null&&(t=document.createElement("style"),t.dataset.plugin="dsh-ui-tweaks",t.dataset.pluginCss=r,document.head.appendChild(t)),t}const le=`
844
+ `;function Z(s){const t=[],u=G(s.codeFontSize);if(u!==""&&t.push(u),Math.abs(s.codeFontSize-g)>.5){const r=(.875*(s.codeFontSize/g)).toFixed(3);t.push(`div[data-slot="conversation.chat.node"] div[class*="_markdown_"] :not(pre)>code{font-size:${r}em !important}`)}return s.timelineStyle==="web"&&t.push('nav[style*="--turn-natural-height"]{display:none !important}'),s.themeStyle==="neon-lime"&&t.push(ne),s.themeStyle==="minimal"&&t.push(V),t.join(`
845
+ `)}function X(){const s="dsh-ui-tweaks-runtime";let t=document.querySelector(`style[data-plugin-css="${s}"]`);return t===null&&(t=document.createElement("style"),t.dataset.plugin="dsh-ui-tweaks",t.dataset.pluginCss=s,document.head.appendChild(t)),t}const ue=`
846
846
  .dut-settings{display:grid;gap:8px;max-width:680px;padding:4px 2px 24px;color:var(--dsw-alias-label-primary)}
847
847
  .dut-settings-header{display:flex;align-items:flex-start;gap:10px;padding:2px 2px 0}
848
848
  .dut-logo{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:9px;border:1px solid var(--dsw-alias-border-l1);background-image:linear-gradient(135deg,color-mix(in srgb,var(--dsw-alias-state-business-primary) 16%,transparent),transparent);font-size:15px;line-height:1}
@@ -909,9 +909,9 @@ body[data-ds-dark-theme] div[data-slot="conversation.chat.node"] [class*="_markd
909
909
  .dut-alert{padding:10px 12px;border-radius:10px;font-size:12px;line-height:1.5}
910
910
  .dut-alert.warning{background:color-mix(in srgb,var(--dsw-alias-state-warn-primary) 12%,transparent);color:var(--dsw-alias-state-warn-label)}
911
911
  .dut-alert.error{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);color:var(--dsw-alias-state-error-primary)}
912
- `;function ae(){const r="dsh-ui-tweaks-base";if(document.querySelector(`style[data-plugin-css="${r}"]`)!==null)return()=>{};const u=document.createElement("style");return u.dataset.plugin="dsh-ui-tweaks",u.dataset.pluginCss=r,u.textContent=le,document.head.appendChild(u),()=>{u.remove()}}async function de(r){let t;for(let u=1;u<=6;u++){try{const s=await fetch(f,{credentials:"same-origin",...r}),i=await s.json();if(s.ok&&i.ok)return i.value;const v=i,g=s.status===502||s.status===503;if(t=new Error(v.error?.message??`UI Tweaks request failed with HTTP ${s.status}`),!g)throw t}catch(s){t=s}await new Promise(s=>setTimeout(s,u*250))}throw t??new Error("UI Tweaks request failed")}class G{state={status:"loading",writable:!1,value:void 0,revision:void 0};listeners=new Set;generation=0;subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;publish(t){this.state=t;for(const u of this.listeners)u()}async load(){const t=++this.generation;this.state.status==="loading"&&this.publish({...this.state,status:"loading"});try{const u=await de();if(t!==this.generation)return;this.publish({status:"ready",writable:u.writable,value:u.value,revision:u.revision})}catch(u){if(t!==this.generation)return;this.publish({...this.state,status:"error",error:u instanceof Error?u.message:String(u)})}}async post(t){const u=++this.generation,s=await de({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});u===this.generation&&this.publish({status:"ready",writable:s.writable,value:s.value,revision:s.revision})}async set(t,u){await this.post({action:"set",field:t,value:u,expectedRevision:this.state.revision??0})}async unset(t){await this.post({action:"unset",field:t,expectedRevision:this.state.revision??0})}}j.SettingsClient=G,j.inject=["slots","locale","sessions","commandUi","conversation","uiSession","uiWorkspace"];function l({text:r}){const t=(0,o.useRef)(null),u=(0,o.useRef)(null),[s,i]=(0,o.useState)(!1),[v,g]=(0,o.useState)({top:-9999,left:-9999});return(0,o.useLayoutEffect)(()=>{if(!s)return;const w=t.current?.getBoundingClientRect(),C=u.current;if(w===void 0||C===null)return;let V=Math.min(Math.max(8,w.left),window.innerWidth-C.offsetWidth-8),Y=w.top-C.offsetHeight-8;Y<8&&(Y=w.bottom+8),g({top:Y,left:V})},[s]),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{ref:t,className:"dut-hint",role:"note","aria-label":r,tabIndex:0,onMouseEnter:()=>{i(!0)},onMouseLeave:()=>{i(!1)},onFocus:()=>{i(!0)},onBlur:()=>{i(!1)},children:"i"}),s&&(0,z.createPortal)((0,e.jsx)("div",{ref:u,className:"dut-hint-pop",style:{top:v.top,left:v.left},children:r}),document.body)]})}function N({controller:r,t}){const u=(0,o.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),s=$(u.value),i=u.writable,[v,g]=(0,o.useState)(String(s.codeFontSize)),[w,C]=(0,o.useState)(void 0);(0,o.useEffect)(()=>{u.status==="loading"&&u.value===void 0&&r.load()},[r,u.status,u.value]),(0,o.useEffect)(()=>{g(String(s.codeFontSize))},[s.codeFontSize]),(0,o.useEffect)(()=>{if(w===void 0)return;const L=setTimeout(()=>{C(void 0)},1800);return()=>{clearTimeout(L)}},[w]);const V=L=>{g(L);const fe=Number(L);if(!Number.isFinite(fe))return;const E=Math.min(S,Math.max(k,Math.round(fe)));g(String(E)),r.set("codeFontSize",E).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},Y=L=>{const fe=Math.min(S,Math.max(k,s.codeFontSize+L));g(String(fe)),r.set("codeFontSize",fe).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},be=L=>{r.set("gitBarEnabled",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},ue=L=>{r.set("archiveManagerEnabled",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},we=L=>{r.set("mcpManagerEnabled",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},me=L=>{r.set("searchEnabled",L).then(()=>{C("applied"),fetch("/_dsh/ui-tweaks/search",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"sync-patch",enabled:L})}).catch(()=>{})}).catch(()=>{C("unavailable")})},te=L=>{r.set("initCommandEnabled",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},ye=L=>{r.set("timelineStyle",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},ve=L=>{r.set("preciseCacheHitEnabled",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},Te=L=>{r.set("themeStyle",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},Ne=L=>{L&&(0,y.requestNotifyPermission)(),r.set("notificationsEnabled",L).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},ce=(L,fe)=>{L==="notifySystemNotification"&&fe&&(0,y.requestNotifyPermission)(),r.set(L,fe).then(()=>{C("applied")}).catch(()=>{C("unavailable")})},Ce=()=>{(0,y.requestNotifyPermission)(),(0,y.previewAlerts)({titleFlash:s.notifyTitleFlash,systemNotification:s.notifySystemNotification,sound:s.notifySound},{notifyTitleDone:t("notifyTitleDone"),notifyTitleAborted:t("notifyTitleAborted"),notifyTitleFailed:t("notifyTitleFailed"),notifyTitlePending:t("notifyTitlePending"),bodyComplete:t("bodyComplete"),bodyAborted:t("bodyAborted"),bodyFailed:t("bodyFailed"),bodyApproval:t("bodyApproval"),bodyPlan:t("bodyPlan"),bodyQuestion:t("bodyQuestion")})},Me=()=>{(async()=>{try{await r.unset("codeFontSize"),await r.unset("codeFontScale"),C("resetDone")}catch{C("unavailable")}})()};return u.status==="loading"&&u.value===void 0?(0,e.jsx)("div",{className:"dut-settings",children:(0,e.jsx)("div",{className:"dut-loading",children:t("loading")})}):u.status==="error"?(0,e.jsx)("div",{className:"dut-settings",children:(0,e.jsx)("div",{className:"dut-alert error",children:t("unavailable")})}):(0,e.jsxs)("div",{className:"dut-settings",children:[(0,e.jsxs)("header",{className:"dut-settings-header",children:[(0,e.jsx)("div",{className:"dut-logo",children:"🎨"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{children:t("settingsTitle")}),(0,e.jsx)("p",{children:t("settingsIntro")})]})]}),i?null:(0,e.jsx)("div",{className:"dut-alert warning",children:t("readOnly")}),w===void 0?null:(0,e.jsx)("div",{className:"dut-status",children:t(w)}),(0,e.jsxs)("section",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionText")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("codeFontSize"),(0,e.jsx)(l,{text:t("codeFontSizeHint")})]}),(0,e.jsxs)("div",{className:"dut-controls",children:[(0,e.jsxs)("div",{className:"dut-stepper",children:[(0,e.jsx)("button",{type:"button","aria-label":"−",disabled:!i||s.codeFontSize<=k,onClick:()=>{Y(-1)},children:"−"}),(0,e.jsx)("input",{type:"number",min:k,max:S,step:1,value:v,disabled:!i,onChange:L=>{g(L.target.value)},onBlur:L=>{V(L.target.value)},onKeyDown:L=>{L.key==="Enter"&&V(L.target.value)}}),(0,e.jsx)("button",{type:"button","aria-label":"+",disabled:!i||s.codeFontSize>=S,onClick:()=>{Y(1)},children:"+"})]}),(0,e.jsx)("button",{type:"button",className:"dut-btn"+(s.codeFontSize===m?" dut-btn-active":""),disabled:!i,onClick:()=>{Me()},children:t("defaultAction")})]})]})})]}),(0,e.jsxs)("section",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionLayout")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("theme"),(0,e.jsx)(l,{text:t("themeHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.themeStyle==="default"?"dut-seg-active":"",disabled:!i,onClick:()=>{Te("default")},children:t("themeDefault")}),(0,e.jsx)("button",{type:"button",className:s.themeStyle==="minimal"?"dut-seg-active":"",disabled:!i,onClick:()=>{Te("minimal")},children:t("themeMinimal")}),(0,e.jsx)("button",{type:"button",className:s.themeStyle==="neon-lime"?"dut-seg-active":"",disabled:!i,onClick:()=>{Te("neon-lime")},children:t("themeNeonLime")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("preciseCacheHit"),(0,e.jsx)(l,{text:t("preciseCacheHitHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.preciseCacheHitEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{ve(!0)},children:t("preciseCacheHitOn")}),(0,e.jsx)("button",{type:"button",className:s.preciseCacheHitEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{ve(!1)},children:t("preciseCacheHitOff")})]})})]})})]}),(0,e.jsxs)("section",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionSearch")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("searchEnabled"),(0,e.jsx)(l,{text:t("searchEnabledHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.searchEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{me(!0)},children:t("searchOn")}),(0,e.jsx)("button",{type:"button",className:s.searchEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{me(!1)},children:t("searchOff")})]})})]})})]}),(0,e.jsxs)("section",{className:"dut-panel dut-grid",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionFeatures")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("timeline"),(0,e.jsx)(l,{text:t("timelineHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.timelineStyle==="native"?"dut-seg-active":"",disabled:!i,onClick:()=>{ye("native")},children:t("timelineNative")}),(0,e.jsx)("button",{type:"button",className:s.timelineStyle==="web"?"dut-seg-active":"",disabled:!i,onClick:()=>{ye("web")},children:t("timelineWeb")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("gitBar"),(0,e.jsx)(l,{text:t("gitBarHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.gitBarEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{be(!0)},children:t("gitBarOn")}),(0,e.jsx)("button",{type:"button",className:s.gitBarEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{be(!1)},children:t("gitBarOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("archiveManager"),(0,e.jsx)(l,{text:t("archiveManagerHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.archiveManagerEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{ue(!0)},children:t("archiveManagerOn")}),(0,e.jsx)("button",{type:"button",className:s.archiveManagerEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{ue(!1)},children:t("archiveManagerOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("mcpManager"),(0,e.jsx)(l,{text:t("mcpManagerHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.mcpManagerEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{we(!0)},children:t("mcpManagerOn")}),(0,e.jsx)("button",{type:"button",className:s.mcpManagerEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{we(!1)},children:t("mcpManagerOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("initCommand"),(0,e.jsx)(l,{text:t("initCommandHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.initCommandEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{te(!0)},children:t("initCommandOn")}),(0,e.jsx)("button",{type:"button",className:s.initCommandEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{te(!1)},children:t("initCommandOff")})]})})]})})]}),(0,e.jsxs)("section",{className:"dut-panel dut-grid dut-grid-half",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionNotifications")}),(0,e.jsx)("div",{className:"dut-field dut-span-all",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifications"),(0,e.jsx)(l,{text:t("notificationsHint")})]}),(0,e.jsxs)("div",{className:"dut-controls",children:[(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notificationsEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{Ne(!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notificationsEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{Ne(!1)},children:t("notifyOff")})]}),(0,e.jsx)("button",{type:"button",className:"dut-btn",disabled:!s.notificationsEnabled,onClick:()=>{Ce()},children:t("notifyTest")})]})]})}),(0,e.jsx)("div",{className:"dut-field"+(s.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyOnComplete"),(0,e.jsx)(l,{text:t("notifyOnCompleteHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notifyOnComplete?"dut-seg-active":"",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyOnComplete",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notifyOnComplete?"":"dut-seg-active",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyOnComplete",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(s.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyOnInteraction"),(0,e.jsx)(l,{text:t("notifyOnInteractionHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notifyOnInteraction?"dut-seg-active":"",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyOnInteraction",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notifyOnInteraction?"":"dut-seg-active",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyOnInteraction",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(s.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyOnlyWhenHidden"),(0,e.jsx)(l,{text:t("notifyOnlyWhenHiddenHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notifyOnlyWhenHidden?"dut-seg-active":"",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyOnlyWhenHidden",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notifyOnlyWhenHidden?"":"dut-seg-active",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyOnlyWhenHidden",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(s.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyTitleFlash"),(0,e.jsx)(l,{text:t("notifyTitleFlashHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notifyTitleFlash?"dut-seg-active":"",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyTitleFlash",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notifyTitleFlash?"":"dut-seg-active",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifyTitleFlash",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(s.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifySystemNotification"),(0,e.jsx)(l,{text:t("notifySystemNotificationHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notifySystemNotification?"dut-seg-active":"",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifySystemNotification",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notifySystemNotification?"":"dut-seg-active",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifySystemNotification",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(s.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifySound"),(0,e.jsx)(l,{text:t("notifySoundHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:s.notifySound?"dut-seg-active":"",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifySound",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:s.notifySound?"":"dut-seg-active",disabled:!i||!s.notificationsEnabled,onClick:()=>{ce("notifySound",!1)},children:t("notifyOff")})]})})]})})]})]})}const b=["请为本项目生成一份面向 AI 编码代理的 AGENTS.md,放在仓库根目录:","","1. 先自行探索项目——阅读 README、清单文件(package.json / pyproject.toml 等)、构建脚本与关键源码目录,不要向我追问这些信息;","2. AGENTS.md 用中文撰写,包含:项目简介、常用命令(安装 / 构建 / 测试 / 检查)、代码风格与约定、目录结构导览、已知注意事项;","3. 只写从代码中验证过的事实,保持简洁(建议不超过 150 行),不要臆测;","4. 如果已存在 AGENTS.md,在其基础上改进补充,不要丢失已有内容;","5. 完成后简要汇报你写了什么。"].join(`
913
- `),a=["Generate an AGENTS.md for this project at the repository root, addressed to future AI coding agents:","","1. Explore the project first — read the README, manifest files (package.json / pyproject.toml etc.), build scripts and key source directories; do not ask me about them.","2. Write the AGENTS.md in English covering: project overview, common commands (install / build / test / lint), code style and conventions, a directory guide, and known gotchas.","3. Only state facts verified from the code; keep it concise (~150 lines max); no speculation.","4. If an AGENTS.md already exists, improve it in place without losing existing content.","5. Briefly report what you wrote when done."].join(`
914
- `);function h(r){const t=r.locale.bind(M);return r.commandUi.register({name:"init",description:()=>t("initDesc"),available:()=>!0,ui:{kind:"popupSelect",options:()=>Promise.resolve([{id:"zh",label:t("initOptionZh"),detail:t("initOptionZhDetail")},{id:"en",label:t("initOptionEn"),detail:t("initOptionEnDetail")}]),onSelect:async(u,s)=>{const i=u.id==="en"?a:b,v=r.sessions.scope(s.sessionId);if(v===void 0){console.error(`[dsh-ui-tweaks] ${t("initFailed")}: session ${s.sessionId} is not scoped`);return}const g=r.conversation.input.for(v);g.setDraft(i),g.submit()}}})}function T(r,t,u,s){r.slots.inject("settings.section",()=>{let i;const v=()=>{const w=u(t.getSnapshot().value);w&&i===void 0?i=s():!w&&i!==void 0&&(i(),i=void 0)};v();const g=t.subscribe(v);return()=>{g(),i?.()}})}function d(r){r.effect(ae,"dsh-ui-tweaks: base styles"),r.effect(F.installGitBarStyles,"dsh-ui-tweaks: gitbar styles"),r.effect(R.installArchiveStyles,"dsh-ui-tweaks: archive styles"),r.effect(U.installMcpStyles,"dsh-ui-tweaks: mcp styles"),r.effect(()=>r.locale.register(M,{en:A,zh:I}),"dsh-ui-tweaks: locale");const t=r.locale.bind(M),u=new G;r.effect(()=>{const s=()=>{const v=u.getSnapshot();v.status==="ready"&&(J().textContent=X($(v.value)))};s();const i=u.subscribe(s);return u.load(),i},"dsh-ui-tweaks: runtime css"),r.slots.inject("settings.section",()=>r.slots.register({name:"settings.section",id:M,order:40,label:()=>t("nav"),inject:()=>({controller:u,t})},N)),r.slots.inject("conversation.session.header.actions",()=>r.slots.register({name:"conversation.session.header.actions",id:"gitbar-branch",order:10,locale:M,inject:()=>({controller:u,sessionsService:r.sessions})},F.BranchChipEntry)),r.slots.inject("conversation.input.dock",()=>r.slots.register({name:"conversation.input.dock",id:"gitbar-warmup",order:41,inject:()=>({})},F.GitWarmup)),r.effect(()=>{const s=r.get("sidebarRightTabs");if(s===void 0)return()=>{};const i=[],v=()=>{const w=u.getSnapshot().value?.gitBarEnabled===!0;if(w&&i.length===0)i.push(s.register({id:"dsh-ui-tweaks/diff",kind:"ui-tweaks-diff",title:()=>t("diffView"),guide:[{id:"dsh-ui-tweaks/diff",order:30,title:()=>t("diffView"),description:()=>t("diffGuide"),icon:K.DiffIcon}]})),i.push(r.slots.inject("sidebar.right.pane.tab",()=>r.slots.register({name:"sidebar.right.pane.tab",key:"dsh-ui-tweaks/diff",locale:M,inject:()=>({controller:u})},F.DiffPanel))),i.push(r.slots.inject("sidebar.right.pane.tab.title",()=>r.slots.register({name:"sidebar.right.pane.tab.title",key:"dsh-ui-tweaks/diff",locale:M,inject:()=>({controller:u})},F.DiffTabTitle)));else if(!w&&i.length>0)for(const C of i.splice(0).reverse())C()};v();const g=u.subscribe(v);return()=>{g();for(const w of i.splice(0).reverse())w()}},"dsh-ui-tweaks: sidebar tabs"),r.effect(()=>(0,F.installHeroChip)(u,t),"dsh-ui-tweaks: hero branch chip"),T(r,u,s=>s?.archiveManagerEnabled===!0,()=>r.slots.register({name:"settings.section",id:"archive",order:50,label:()=>t("archiveNav"),locale:M,inject:()=>({controller:u,t,sessionsService:r.sessions})},R.ArchiveSection)),T(r,u,s=>s?.mcpManagerEnabled===!0,()=>r.slots.register({name:"settings.section",id:"mcp",order:60,label:()=>t("mcpNav"),locale:M,inject:()=>({controller:u,t})},U.McpSection)),T(r,u,s=>s?.searchEnabled===!0,()=>r.slots.register({name:"settings.section",id:"search",order:70,label:()=>t("searchNav"),locale:M,inject:()=>({controller:u,t})},se.SearchSection)),r.effect(()=>{let s;const i=()=>{const g=u.getSnapshot().value?.initCommandEnabled===!0;g&&s===void 0?s=h(r):!g&&s!==void 0&&(s(),s=void 0)};i();const v=u.subscribe(i);return()=>{v(),s?.(),s=void 0}},"dsh-ui-tweaks: /init command"),r.effect(()=>{let s,i;const v=()=>{const w=u.getSnapshot().value?.timelineStyle==="web";w&&s===void 0?(i=(0,ee.installTimelineStyles)(),s=r.slots.inject("conversation.input.dock",()=>r.slots.register({name:"conversation.input.dock",id:"timeline",order:40,locale:M,inject:()=>({controller:u,sessionsService:r.sessions})},ee.TimelineRail))):!w&&s!==void 0&&(s(),s=void 0,i?.(),i=void 0)};v();const g=u.subscribe(v);return()=>{g(),s?.(),s=void 0,i?.(),i=void 0}},"dsh-ui-tweaks: timeline rail"),r.effect(()=>{let s;const i=()=>{const g=u.getSnapshot().value?.preciseCacheHitEnabled===!0;g&&s===void 0?s=r.slots.inject("conversation.composer.dock",()=>r.slots.register({name:"conversation.composer.dock",id:"precise-cache-hit",order:90,inject:()=>({})},B.PreciseCacheHitEntry)):!g&&s!==void 0&&(s(),s=void 0)};i();const v=u.subscribe(i);return()=>{v(),s?.(),s=void 0}},"dsh-ui-tweaks: precise cache hit"),r.effect(()=>{let s;const i=()=>{const g=u.getSnapshot().value?.themeStyle==="neon-lime";g&&s===void 0?s=(0,p.installEffortTag)():!g&&s!==void 0&&(s(),s=void 0)};i();const v=u.subscribe(i);return()=>{v(),s?.(),s=void 0}},"dsh-ui-tweaks: effort tint"),r.effect(()=>{let s;const i=()=>{const g=u.getSnapshot().value?.notificationsEnabled===!0;g&&s===void 0?s=(0,y.installTaskNotifier)({sessionsService:r.sessions,sessionStatus:r.uiSession.sessionStatus,openSession:w=>{r.uiWorkspace.openSession(w)},text:{notifyTitleDone:t("notifyTitleDone"),notifyTitleAborted:t("notifyTitleAborted"),notifyTitleFailed:t("notifyTitleFailed"),notifyTitlePending:t("notifyTitlePending"),bodyComplete:t("bodyComplete"),bodyAborted:t("bodyAborted"),bodyFailed:t("bodyFailed"),bodyApproval:t("bodyApproval"),bodyPlan:t("bodyPlan"),bodyQuestion:t("bodyQuestion")},readState:()=>{const w=u.getSnapshot().value;return{options:{onlyWhenHidden:w?.notifyOnlyWhenHidden??!0,onComplete:w?.notifyOnComplete??!0,onInteraction:w?.notifyOnInteraction??!0},channels:{titleFlash:w?.notifyTitleFlash??!0,systemNotification:w?.notifySystemNotification??!0,sound:w?.notifySound??!1}}}}):!g&&s!==void 0&&(s(),s=void 0)};i();const v=u.subscribe(i);return()=>{v(),s?.(),s=void 0}},"dsh-ui-tweaks: task notifications")}},je["./mcp.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.MCP_CSS=void 0,j.installMcpStyles=ee,j.McpSection=y;const e=q("react/jsx-runtime"),o=q("react"),z=q("react-dom"),F="/_dsh/ui-tweaks/mcp";async function K(f){const c=await fetch(F,{credentials:"same-origin",...f});let m;try{m=await c.json()}catch{m=void 0}if(!c.ok||m===void 0||!m.ok){const k=m,S=m===void 0?`MCP route unavailable (HTTP ${c.status}; restart DSH to load the plugin server code)`:k?.error?.message??`UI Tweaks MCP request failed with HTTP ${c.status}`,P=new Error(S);throw P.code=k?.error?.code,P}return m.value}function R(f){return f.split(/\r?\n/u).map(c=>c.trim()).filter(c=>c.length>0)}function U(f,c){const m={};for(const k of f.split(/\r?\n/u)){const S=k.trim();if(S.length===0)continue;const P=S.indexOf(c);if(P<=0)throw new Error(`格式不正确:${S}`);const x=S.slice(0,P).trim(),H=S.slice(P+1).trim();if(x.length===0)throw new Error(`格式不正确:${S}`);m[x]=H}return m}function se(f,c){return Object.entries(f).map(([m,k])=>`${m}${c}${k}`).join(`
912
+ `;function ae(){const s="dsh-ui-tweaks-base";if(document.querySelector(`style[data-plugin-css="${s}"]`)!==null)return()=>{};const u=document.createElement("style");return u.dataset.plugin="dsh-ui-tweaks",u.dataset.pluginCss=s,u.textContent=ue,document.head.appendChild(u),()=>{u.remove()}}class ce extends Error{status;code;constructor(t,u,r){super(t),this.status=u,this.code=r,this.name="ApiRequestError"}}async function q(s){let t;for(let u=1;u<=6;u++){try{const r=await fetch(f,{credentials:"same-origin",...s}),i=await r.json();if(r.ok&&i.ok)return i.value;const b=i,v=new ce(b.error?.message??`UI Tweaks request failed with HTTP ${r.status}`,r.status,b.error?.code);if(v.status!==502&&v.status!==503)throw v;t=v}catch(r){if(r instanceof ce)throw r;t=r}u<6&&await new Promise(r=>setTimeout(r,u*250))}throw t??new Error("UI Tweaks request failed")}class c{state={status:"loading",writable:!1,value:void 0,revision:void 0};listeners=new Set;operations=Promise.resolve();subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;publish(t){this.state=t;for(const u of this.listeners)u()}accept(t){this.publish({status:"ready",writable:t.writable,value:t.value,revision:t.revision})}enqueue(t){const u=this.operations.then(t,t);return this.operations=u.then(()=>{},()=>{}),u}fetchSnapshot(){return q()}async load(){await this.enqueue(async()=>{this.state.status==="loading"&&this.publish({...this.state,status:"loading"});try{this.accept(await this.fetchSnapshot())}catch(t){this.publish({...this.state,status:"error",error:t instanceof Error?t.message:String(t)})}})}async write(t){const u=i=>q({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t(i))});let r;try{r=await u(this.state.revision??0)}catch(i){if(!(i instanceof ce)||i.status!==409)throw i;const b=await this.fetchSnapshot();this.accept(b),r=await u(b.revision)}this.accept(r)}async set(t,u){await this.enqueue(()=>this.write(r=>({action:"set",field:t,value:u,expectedRevision:r})))}async unset(t){await this.enqueue(()=>this.write(u=>({action:"unset",field:t,expectedRevision:u})))}}j.SettingsClient=c,j.inject=["slots","locale","sessions","commandUi","conversation","uiSession","uiWorkspace"];function x({text:s}){const t=(0,o.useRef)(null),u=(0,o.useRef)(null),[r,i]=(0,o.useState)(!1),[b,v]=(0,o.useState)({top:-9999,left:-9999});return(0,o.useLayoutEffect)(()=>{if(!r)return;const M=t.current?.getBoundingClientRect(),O=u.current;if(M===void 0||O===null)return;let J=Math.min(Math.max(8,M.left),window.innerWidth-O.offsetWidth-8),ie=M.top-O.offsetHeight-8;ie<8&&(ie=M.bottom+8),v({top:ie,left:J})},[r]),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{ref:t,className:"dut-hint",role:"note","aria-label":s,tabIndex:0,onMouseEnter:()=>{i(!0)},onMouseLeave:()=>{i(!1)},onFocus:()=>{i(!0)},onBlur:()=>{i(!1)},children:"i"}),r&&(0,L.createPortal)((0,e.jsx)("div",{ref:u,className:"dut-hint-pop",style:{top:b.top,left:b.left},children:s}),document.body)]})}function m({controller:s,t}){const u=(0,o.useSyncExternalStore)(s.subscribe,s.getSnapshot,s.getSnapshot),r=W(u.value),i=u.writable,[b,v]=(0,o.useState)(String(r.codeFontSize)),[M,O]=(0,o.useState)(void 0);(0,o.useEffect)(()=>{u.status==="loading"&&u.value===void 0&&s.load()},[s,u.status,u.value]),(0,o.useEffect)(()=>{v(String(r.codeFontSize))},[r.codeFontSize]),(0,o.useEffect)(()=>{if(M===void 0)return;const I=setTimeout(()=>{O(void 0)},1800);return()=>{clearTimeout(I)}},[M]);const J=I=>{v(I);const N=Number(I);if(!Number.isFinite(N))return;const oe=Math.min(C,Math.max(k,Math.round(N)));v(String(oe)),s.set("codeFontSize",oe).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},ie=I=>{const N=Math.min(C,Math.max(k,r.codeFontSize+I));v(String(N)),s.set("codeFontSize",N).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},pe=I=>{s.set("gitBarEnabled",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},ve=I=>{s.set("archiveManagerEnabled",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},ge=I=>{s.set("mcpManagerEnabled",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},te=I=>{s.set("searchEnabled",I).then(()=>{O("applied"),fetch("/_dsh/ui-tweaks/search",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"sync-patch",enabled:I})}).catch(()=>{})}).catch(()=>{O("unavailable")})},we=I=>{s.set("initCommandEnabled",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},xe=I=>{s.set("timelineStyle",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},Te=I=>{s.set("preciseCacheHitEnabled",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},ye=I=>{s.set("themeStyle",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},Se=I=>{I&&(0,y.requestNotifyPermission)(),s.set("notificationsEnabled",I).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},de=(I,N)=>{I==="notifySystemNotification"&&N&&(0,y.requestNotifyPermission)(),s.set(I,N).then(()=>{O("applied")}).catch(()=>{O("unavailable")})},Ee=()=>{(0,y.requestNotifyPermission)(),(0,y.previewAlerts)({titleFlash:r.notifyTitleFlash,systemNotification:r.notifySystemNotification,sound:r.notifySound},{notifyTitleDone:t("notifyTitleDone"),notifyTitleAborted:t("notifyTitleAborted"),notifyTitleFailed:t("notifyTitleFailed"),notifyTitlePending:t("notifyTitlePending"),bodyComplete:t("bodyComplete"),bodyAborted:t("bodyAborted"),bodyFailed:t("bodyFailed"),bodyApproval:t("bodyApproval"),bodyPlan:t("bodyPlan"),bodyQuestion:t("bodyQuestion")})},Me=()=>{(async()=>{try{await s.unset("codeFontSize"),await s.unset("codeFontScale"),O("resetDone")}catch{O("unavailable")}})()};return u.status==="loading"&&u.value===void 0?(0,e.jsx)("div",{className:"dut-settings",children:(0,e.jsx)("div",{className:"dut-loading",children:t("loading")})}):u.status==="error"?(0,e.jsx)("div",{className:"dut-settings",children:(0,e.jsx)("div",{className:"dut-alert error",children:t("unavailable")})}):(0,e.jsxs)("div",{className:"dut-settings",children:[(0,e.jsxs)("header",{className:"dut-settings-header",children:[(0,e.jsx)("div",{className:"dut-logo",children:"🎨"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{children:t("settingsTitle")}),(0,e.jsx)("p",{children:t("settingsIntro")})]})]}),i?null:(0,e.jsx)("div",{className:"dut-alert warning",children:t("readOnly")}),M===void 0?null:(0,e.jsx)("div",{className:"dut-status",children:t(M)}),(0,e.jsxs)("section",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionText")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("codeFontSize"),(0,e.jsx)(x,{text:t("codeFontSizeHint")})]}),(0,e.jsxs)("div",{className:"dut-controls",children:[(0,e.jsxs)("div",{className:"dut-stepper",children:[(0,e.jsx)("button",{type:"button","aria-label":"−",disabled:!i||r.codeFontSize<=k,onClick:()=>{ie(-1)},children:"−"}),(0,e.jsx)("input",{type:"number",min:k,max:C,step:1,value:b,disabled:!i,onChange:I=>{v(I.target.value)},onBlur:I=>{J(I.target.value)},onKeyDown:I=>{I.key==="Enter"&&J(I.target.value)}}),(0,e.jsx)("button",{type:"button","aria-label":"+",disabled:!i||r.codeFontSize>=C,onClick:()=>{ie(1)},children:"+"})]}),(0,e.jsx)("button",{type:"button",className:"dut-btn"+(r.codeFontSize===g?" dut-btn-active":""),disabled:!i,onClick:()=>{Me()},children:t("defaultAction")})]})]})})]}),(0,e.jsxs)("section",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionLayout")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("theme"),(0,e.jsx)(x,{text:t("themeHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.themeStyle==="default"?"dut-seg-active":"",disabled:!i,onClick:()=>{ye("default")},children:t("themeDefault")}),(0,e.jsx)("button",{type:"button",className:r.themeStyle==="minimal"?"dut-seg-active":"",disabled:!i,onClick:()=>{ye("minimal")},children:t("themeMinimal")}),(0,e.jsx)("button",{type:"button",className:r.themeStyle==="neon-lime"?"dut-seg-active":"",disabled:!i,onClick:()=>{ye("neon-lime")},children:t("themeNeonLime")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("preciseCacheHit"),(0,e.jsx)(x,{text:t("preciseCacheHitHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.preciseCacheHitEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{Te(!0)},children:t("preciseCacheHitOn")}),(0,e.jsx)("button",{type:"button",className:r.preciseCacheHitEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{Te(!1)},children:t("preciseCacheHitOff")})]})})]})})]}),(0,e.jsxs)("section",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionSearch")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("searchEnabled"),(0,e.jsx)(x,{text:t("searchEnabledHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.searchEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{te(!0)},children:t("searchOn")}),(0,e.jsx)("button",{type:"button",className:r.searchEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{te(!1)},children:t("searchOff")})]})})]})})]}),(0,e.jsxs)("section",{className:"dut-panel dut-grid",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionFeatures")}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("timeline"),(0,e.jsx)(x,{text:t("timelineHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.timelineStyle==="native"?"dut-seg-active":"",disabled:!i,onClick:()=>{xe("native")},children:t("timelineNative")}),(0,e.jsx)("button",{type:"button",className:r.timelineStyle==="web"?"dut-seg-active":"",disabled:!i,onClick:()=>{xe("web")},children:t("timelineWeb")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("gitBar"),(0,e.jsx)(x,{text:t("gitBarHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.gitBarEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{pe(!0)},children:t("gitBarOn")}),(0,e.jsx)("button",{type:"button",className:r.gitBarEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{pe(!1)},children:t("gitBarOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("archiveManager"),(0,e.jsx)(x,{text:t("archiveManagerHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.archiveManagerEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{ve(!0)},children:t("archiveManagerOn")}),(0,e.jsx)("button",{type:"button",className:r.archiveManagerEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{ve(!1)},children:t("archiveManagerOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("mcpManager"),(0,e.jsx)(x,{text:t("mcpManagerHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.mcpManagerEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{ge(!0)},children:t("mcpManagerOn")}),(0,e.jsx)("button",{type:"button",className:r.mcpManagerEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{ge(!1)},children:t("mcpManagerOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("initCommand"),(0,e.jsx)(x,{text:t("initCommandHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.initCommandEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{we(!0)},children:t("initCommandOn")}),(0,e.jsx)("button",{type:"button",className:r.initCommandEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{we(!1)},children:t("initCommandOff")})]})})]})})]}),(0,e.jsxs)("section",{className:"dut-panel dut-grid dut-grid-half",children:[(0,e.jsx)("div",{className:"dut-section-label",children:t("sectionNotifications")}),(0,e.jsx)("div",{className:"dut-field dut-span-all",children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifications"),(0,e.jsx)(x,{text:t("notificationsHint")})]}),(0,e.jsxs)("div",{className:"dut-controls",children:[(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notificationsEnabled?"dut-seg-active":"",disabled:!i,onClick:()=>{Se(!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notificationsEnabled?"":"dut-seg-active",disabled:!i,onClick:()=>{Se(!1)},children:t("notifyOff")})]}),(0,e.jsx)("button",{type:"button",className:"dut-btn",disabled:!r.notificationsEnabled,onClick:()=>{Ee()},children:t("notifyTest")})]})]})}),(0,e.jsx)("div",{className:"dut-field"+(r.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyOnComplete"),(0,e.jsx)(x,{text:t("notifyOnCompleteHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notifyOnComplete?"dut-seg-active":"",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyOnComplete",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notifyOnComplete?"":"dut-seg-active",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyOnComplete",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(r.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyOnInteraction"),(0,e.jsx)(x,{text:t("notifyOnInteractionHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notifyOnInteraction?"dut-seg-active":"",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyOnInteraction",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notifyOnInteraction?"":"dut-seg-active",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyOnInteraction",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(r.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyOnlyWhenHidden"),(0,e.jsx)(x,{text:t("notifyOnlyWhenHiddenHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notifyOnlyWhenHidden?"dut-seg-active":"",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyOnlyWhenHidden",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notifyOnlyWhenHidden?"":"dut-seg-active",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyOnlyWhenHidden",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(r.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifyTitleFlash"),(0,e.jsx)(x,{text:t("notifyTitleFlashHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notifyTitleFlash?"dut-seg-active":"",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyTitleFlash",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notifyTitleFlash?"":"dut-seg-active",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifyTitleFlash",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(r.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifySystemNotification"),(0,e.jsx)(x,{text:t("notifySystemNotificationHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notifySystemNotification?"dut-seg-active":"",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifySystemNotification",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notifySystemNotification?"":"dut-seg-active",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifySystemNotification",!1)},children:t("notifyOff")})]})})]})}),(0,e.jsx)("div",{className:"dut-field"+(r.notificationsEnabled?"":" dut-sub-off"),children:(0,e.jsxs)("div",{className:"dut-field-top",children:[(0,e.jsxs)("span",{className:"dut-label",children:[t("notifySound"),(0,e.jsx)(x,{text:t("notifySoundHint")})]}),(0,e.jsx)("div",{className:"dut-controls",children:(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:r.notifySound?"dut-seg-active":"",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifySound",!0)},children:t("notifyOn")}),(0,e.jsx)("button",{type:"button",className:r.notifySound?"":"dut-seg-active",disabled:!i||!r.notificationsEnabled,onClick:()=>{de("notifySound",!1)},children:t("notifyOff")})]})})]})})]})]})}const a=["请为本项目生成一份面向 AI 编码代理的 AGENTS.md,放在仓库根目录:","","1. 先自行探索项目——阅读 README、清单文件(package.json / pyproject.toml 等)、构建脚本与关键源码目录,不要向我追问这些信息;","2. AGENTS.md 用中文撰写,包含:项目简介、常用命令(安装 / 构建 / 测试 / 检查)、代码风格与约定、目录结构导览、已知注意事项;","3. 只写从代码中验证过的事实,保持简洁(建议不超过 150 行),不要臆测;","4. 如果已存在 AGENTS.md,在其基础上改进补充,不要丢失已有内容;","5. 完成后简要汇报你写了什么。"].join(`
913
+ `),h=["Generate an AGENTS.md for this project at the repository root, addressed to future AI coding agents:","","1. Explore the project first — read the README, manifest files (package.json / pyproject.toml etc.), build scripts and key source directories; do not ask me about them.","2. Write the AGENTS.md in English covering: project overview, common commands (install / build / test / lint), code style and conventions, a directory guide, and known gotchas.","3. Only state facts verified from the code; keep it concise (~150 lines max); no speculation.","4. If an AGENTS.md already exists, improve it in place without losing existing content.","5. Briefly report what you wrote when done."].join(`
914
+ `);function T(s){const t=s.locale.bind(E);return s.commandUi.register({name:"init",description:()=>t("initDesc"),available:()=>!0,ui:{kind:"popupSelect",options:()=>Promise.resolve([{id:"zh",label:t("initOptionZh"),detail:t("initOptionZhDetail")},{id:"en",label:t("initOptionEn"),detail:t("initOptionEnDetail")}]),onSelect:async(u,r)=>{const i=u.id==="en"?h:a,b=s.sessions.scope(r.sessionId);if(b===void 0){console.error(`[dsh-ui-tweaks] ${t("initFailed")}: session ${r.sessionId} is not scoped`);return}const v=s.conversation.input.for(b);v.setDraft(i),v.submit()}}})}function l(s,t,u,r){s.slots.inject("settings.section",()=>{let i;const b=()=>{const M=u(t.getSnapshot().value);M&&i===void 0?i=r():!M&&i!==void 0&&(i(),i=void 0)};b();const v=t.subscribe(b);return()=>{v(),i?.()}})}function S(s){s.effect(ae,"dsh-ui-tweaks: base styles"),s.effect(z.installGitBarStyles,"dsh-ui-tweaks: gitbar styles"),s.effect(F.installArchiveStyles,"dsh-ui-tweaks: archive styles"),s.effect(U.installMcpStyles,"dsh-ui-tweaks: mcp styles"),s.effect(()=>s.locale.register(E,{en:A,zh:B}),"dsh-ui-tweaks: locale");const t=s.locale.bind(E),u=new c;s.effect(()=>{const r=()=>{const b=u.getSnapshot();b.status==="ready"&&(X().textContent=Z(W(b.value)))};r();const i=u.subscribe(r);return u.load(),i},"dsh-ui-tweaks: runtime css"),s.slots.inject("settings.section",()=>s.slots.register({name:"settings.section",id:E,order:40,label:()=>t("nav"),inject:()=>({controller:u,t})},m)),s.slots.inject("conversation.session.header.actions",()=>s.slots.register({name:"conversation.session.header.actions",id:"gitbar-branch",order:10,locale:E,inject:()=>({controller:u,sessionsService:s.sessions})},z.BranchChipEntry)),s.slots.inject("conversation.input.dock",()=>s.slots.register({name:"conversation.input.dock",id:"gitbar-warmup",order:41,inject:()=>({})},z.GitWarmup)),s.effect(()=>{const r=s.get("sidebarRightTabs");if(r===void 0)return()=>{};const i=[],b=()=>{const M=u.getSnapshot().value?.gitBarEnabled===!0;if(M&&i.length===0)i.push(r.register({id:"dsh-ui-tweaks/diff",kind:"ui-tweaks-diff",title:()=>t("diffView"),guide:[{id:"dsh-ui-tweaks/diff",order:30,title:()=>t("diffView"),description:()=>t("diffGuide"),icon:Y.DiffIcon}]})),i.push(s.slots.inject("sidebar.right.pane.tab",()=>s.slots.register({name:"sidebar.right.pane.tab",key:"dsh-ui-tweaks/diff",locale:E,inject:()=>({controller:u})},z.DiffPanel))),i.push(s.slots.inject("sidebar.right.pane.tab.title",()=>s.slots.register({name:"sidebar.right.pane.tab.title",key:"dsh-ui-tweaks/diff",locale:E,inject:()=>({controller:u})},z.DiffTabTitle)));else if(!M&&i.length>0)for(const O of i.splice(0).reverse())O()};b();const v=u.subscribe(b);return()=>{v();for(const M of i.splice(0).reverse())M()}},"dsh-ui-tweaks: sidebar tabs"),s.effect(()=>(0,z.installHeroChip)(u,t),"dsh-ui-tweaks: hero branch chip"),l(s,u,r=>r?.archiveManagerEnabled===!0,()=>s.slots.register({name:"settings.section",id:"archive",order:50,label:()=>t("archiveNav"),locale:E,inject:()=>({controller:u,t,sessionsService:s.sessions})},F.ArchiveSection)),l(s,u,r=>r?.mcpManagerEnabled===!0,()=>s.slots.register({name:"settings.section",id:"mcp",order:60,label:()=>t("mcpNav"),locale:E,inject:()=>({controller:u,t})},U.McpSection)),l(s,u,r=>r?.searchEnabled===!0,()=>s.slots.register({name:"settings.section",id:"search",order:70,label:()=>t("searchNav"),locale:E,inject:()=>({controller:u,t})},se.SearchSection)),s.effect(()=>{let r;const i=()=>{const v=u.getSnapshot().value?.initCommandEnabled===!0;v&&r===void 0?r=T(s):!v&&r!==void 0&&(r(),r=void 0)};i();const b=u.subscribe(i);return()=>{b(),r?.(),r=void 0}},"dsh-ui-tweaks: /init command"),s.effect(()=>{let r,i;const b=()=>{const M=u.getSnapshot().value?.timelineStyle==="web";M&&r===void 0?(i=(0,ee.installTimelineStyles)(),r=s.slots.inject("conversation.input.dock",()=>s.slots.register({name:"conversation.input.dock",id:"timeline",order:40,locale:E,inject:()=>({controller:u,sessionsService:s.sessions})},ee.TimelineRail))):!M&&r!==void 0&&(r(),r=void 0,i?.(),i=void 0)};b();const v=u.subscribe(b);return()=>{v(),r?.(),r=void 0,i?.(),i=void 0}},"dsh-ui-tweaks: timeline rail"),s.effect(()=>{let r;const i=()=>{const v=u.getSnapshot().value?.preciseCacheHitEnabled===!0;v&&r===void 0?r=s.slots.inject("conversation.composer.dock",()=>s.slots.register({name:"conversation.composer.dock",id:"precise-cache-hit",order:90,inject:()=>({})},$.PreciseCacheHitEntry)):!v&&r!==void 0&&(r(),r=void 0)};i();const b=u.subscribe(i);return()=>{b(),r?.(),r=void 0}},"dsh-ui-tweaks: precise cache hit"),s.effect(()=>{let r;const i=()=>{const v=u.getSnapshot().value?.themeStyle==="neon-lime";v&&r===void 0?r=(0,p.installEffortTag)():!v&&r!==void 0&&(r(),r=void 0)};i();const b=u.subscribe(i);return()=>{b(),r?.(),r=void 0}},"dsh-ui-tweaks: effort tint"),s.effect(()=>{let r;const i=()=>{const v=u.getSnapshot().value?.notificationsEnabled===!0;v&&r===void 0?r=(0,y.installTaskNotifier)({sessionsService:s.sessions,sessionStatus:s.uiSession.sessionStatus,openSession:M=>{s.uiWorkspace.openSession(M)},text:{notifyTitleDone:t("notifyTitleDone"),notifyTitleAborted:t("notifyTitleAborted"),notifyTitleFailed:t("notifyTitleFailed"),notifyTitlePending:t("notifyTitlePending"),bodyComplete:t("bodyComplete"),bodyAborted:t("bodyAborted"),bodyFailed:t("bodyFailed"),bodyApproval:t("bodyApproval"),bodyPlan:t("bodyPlan"),bodyQuestion:t("bodyQuestion")},readState:()=>{const M=u.getSnapshot().value;return{options:{onlyWhenHidden:M?.notifyOnlyWhenHidden??!0,onComplete:M?.notifyOnComplete??!0,onInteraction:M?.notifyOnInteraction??!0},channels:{titleFlash:M?.notifyTitleFlash??!0,systemNotification:M?.notifySystemNotification??!0,sound:M?.notifySound??!1}}}}):!v&&r!==void 0&&(r(),r=void 0)};i();const b=u.subscribe(i);return()=>{b(),r?.(),r=void 0}},"dsh-ui-tweaks: task notifications")}},je["./mcp.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.MCP_CSS=void 0,j.installMcpStyles=ee,j.McpSection=y;const e=K("react/jsx-runtime"),o=K("react"),L=K("react-dom"),z="/_dsh/ui-tweaks/mcp";async function Y(f){const d=await fetch(z,{credentials:"same-origin",...f});let g;try{g=await d.json()}catch{g=void 0}if(!d.ok||g===void 0||!g.ok){const k=g,C=g===void 0?`MCP route unavailable (HTTP ${d.status}; restart DSH to load the plugin server code)`:k?.error?.message??`UI Tweaks MCP request failed with HTTP ${d.status}`,R=new Error(C);throw R.code=k?.error?.code,R}return g.value}function F(f){return f.split(/\r?\n/u).map(d=>d.trim()).filter(d=>d.length>0)}function U(f,d){const g={};for(const k of f.split(/\r?\n/u)){const C=k.trim();if(C.length===0)continue;const R=C.indexOf(d);if(R<=0)throw new Error(`格式不正确:${C}`);const w=C.slice(0,R).trim(),P=C.slice(R+1).trim();if(w.length===0)throw new Error(`格式不正确:${C}`);g[w]=P}return g}function se(f,d){return Object.entries(f).map(([g,k])=>`${g}${d}${k}`).join(`
915
915
  `)}j.MCP_CSS=`
916
916
  .dut-mcp{display:grid;gap:12px;max-width:680px;padding:6px 2px 36px}
917
917
  .dut-mcp-head{display:flex;align-items:center;gap:10px;padding:14px 16px 0}
@@ -969,9 +969,9 @@ textarea.dut-mcp-yaml{min-height:320px}
969
969
  .dut-mcp-row2 .dut-seg button{flex:none;white-space:nowrap;padding:0 16px;height:26px}
970
970
  .dut-mcp-foot{flex:none;display:flex;align-items:center;gap:8px;justify-content:flex-end;padding:12px 20px 16px;border-top:1px solid var(--dsw-alias-border-l1)}
971
971
  .dut-mcp-error{margin:0 20px 10px;padding:8px 12px;border-radius:10px;font-size:12px;line-height:1.5;background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);color:var(--dsw-alias-state-error-primary)}
972
- `;function ee(){const f="dsh-ui-tweaks-mcp";if(document.querySelector(`style[data-plugin-css="${f}"]`)!==null)return()=>{};const m=document.createElement("style");return m.dataset.plugin="dsh-ui-tweaks",m.dataset.pluginCss=f,m.textContent=j.MCP_CSS,document.head.appendChild(m),()=>{m.remove()}}function B(f,c){switch(f){case"active":return c("mcpStatusActive");case"failed":return c("mcpStatusFailed");case"loading":return c("mcpStatusLoading");case"stopped":return c("mcpStatusStopped");case"disabled":return c("mcpStatusDisabled")}}function p(f){switch(f){case"active":return" dut-mcp-ok";case"failed":return" dut-mcp-err";case"loading":return" dut-mcp-warn";default:return""}}function y({controller:f,t:c}){const k=(0,o.useSyncExternalStore)(f.subscribe,f.getSnapshot,f.getSnapshot).value?.mcpManagerEnabled===!0,[S,P]=(0,o.useState)(null),[x,H]=(0,o.useState)(null),[D,O]=(0,o.useState)(null),[A,I]=(0,o.useState)(null),[$,W]=(0,o.useState)(null),[ne,Z]=(0,o.useState)(null),[X,J]=(0,o.useState)(null),le=(0,o.useMemo)(()=>({current:0}),[]),ae=()=>{const a=++le.current;I(null),K().then(h=>{a===le.current&&P(h.servers)}).catch(h=>{a===le.current&&(I(h instanceof Error?h.message:String(h)),P([]))})};(0,o.useEffect)(()=>{k&&ae()},[k]);const de=(a,h,T)=>{H(a),I(null),W(null),K({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).then(()=>{T?.()}).catch(d=>{I(d instanceof Error?d.message:String(d))}).finally(()=>{H(d=>d===a?null:d)})},G=(a,h=12,T=1e3)=>{let d=h;const r=()=>{const t=++le.current;K().then(u=>{t===le.current&&(P(u.servers),d-=1,!(d<=0||a(u.servers))&&window.setTimeout(r,T))}).catch(()=>{d-=1,d>0&&window.setTimeout(r,T)})};r()},l=a=>{if(D!==a){O(a),window.setTimeout(()=>{O(h=>h===a?null:h)},3e3);return}O(null),de(`remove:${a}`,{action:"remove",id:a},()=>{W(c("mcpRemoved")),G(h=>!h.some(T=>T.id===a),10)})},N=(a,h)=>{de(`set-enabled:${a}`,{action:"set-enabled",id:a,enabled:h},()=>{G(T=>{const d=T.find(r=>r.id===a);return d===void 0?!0:h?d.status==="active"||d.status==="failed":d.status==="disabled"},45,1e3)})};if(!k)return(0,e.jsx)("div",{className:"dut-mcp",children:(0,e.jsxs)("div",{className:"dut-panel dut-mcp-off",children:[(0,e.jsx)("p",{children:c("mcpDisabledHint")}),(0,e.jsx)("div",{children:(0,e.jsx)("button",{type:"button",className:"dut-btn dut-btn-active",onClick:()=>{f.set("mcpManagerEnabled",!0).catch(()=>{I(c("unavailable"))})},children:c("mcpEnable")})})]})});const b=S??[];return(0,e.jsxs)("div",{className:"dut-mcp",children:[(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsxs)("div",{className:"dut-mcp-head",children:[(0,e.jsx)("h2",{children:c("mcpTitle")}),(0,e.jsxs)("span",{className:"dut-mcp-count",children:[b.length," · ",b.filter(a=>a.status==="active").length," ",c("mcpStatusActive")]}),(0,e.jsx)("span",{className:"dut-mcp-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",onClick:()=>{J("new")},children:c("mcpAdd")})]}),(0,e.jsx)("div",{className:"dut-mcp-note",children:c("mcpServerDetail")}),A!==null?(0,e.jsx)("div",{className:"dut-mcp-alert",children:A}):null,$!==null?(0,e.jsx)("div",{className:"dut-mcp-notice",children:$}):null,(0,e.jsx)("div",{className:"dut-mcp-body",children:S===null?(0,e.jsx)("div",{className:"dut-mcp-empty",children:c("loading")}):b.length===0?(0,e.jsx)("div",{className:"dut-mcp-empty",children:c("mcpEmpty")}):b.map(a=>{const h=a.url!==void 0?a.url:[a.command,...a.args].filter(Boolean).join(" "),T=ne===a.id;return(0,e.jsxs)("div",{className:"dut-mcp-row",children:[(0,e.jsxs)("div",{className:"dut-mcp-row-main",children:[(0,e.jsx)("span",{className:"dut-mcp-name",children:a.serverName}),(0,e.jsx)("span",{className:"dut-mcp-badge"+p(a.status),children:B(a.status,c)}),(0,e.jsxs)("span",{className:"dut-mcp-sub",children:["· ",a.toolCount," ",c("mcpTools")]}),(0,e.jsx)("span",{className:"dut-mcp-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",disabled:x!==null,onClick:()=>{N(a.id,a.disabled)},children:a.disabled?c("mcpEnabledAction"):c("mcpDisabledAction")}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",disabled:x!==null,onClick:()=>{J(a)},children:c("mcpEdit")}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn dut-mcp-del"+(D===a.id?" dut-mcp-confirm":""),disabled:x!==null,onClick:()=>{l(a.id)},children:D===a.id?c("mcpDelete")+"?":c("mcpDelete")})]}),(0,e.jsxs)("div",{className:"dut-mcp-sub",title:h,children:[a.id," · ",a.transport," · ",h]}),(0,e.jsxs)("button",{type:"button",className:"dut-mcp-toggle",onClick:()=>{Z(T?null:a.id)},children:[T?"▾ ":"▸ ",a.toolCount," ",c("mcpTools"),a.env&&Object.keys(a.env).length>0?` · ${c("mcpEnv")}: ${Object.keys(a.env).join(", ")}`:""]}),T?(0,e.jsx)("div",{className:"dut-mcp-tools",children:a.tools.length===0?(0,e.jsx)("span",{className:"dut-mcp-sub",children:"—"}):a.tools.map(d=>(0,e.jsx)("span",{className:"dut-mcp-tool",children:d},d))}):null]},a.id)})})]}),X!==null?(0,e.jsx)(M,{initial:X==="new"?null:X,t:c,onClose:()=>{J(null)},onSaved:()=>{J(null),W(c("mcpSaved")),G(()=>!1,10)}},X==="new"?"new":X.id):null]})}function M({initial:f,t:c,onClose:m,onSaved:k}){const S=f!==null,[P,x]=(0,o.useState)("form"),[H,D]=(0,o.useState)(f?.id??""),[O,A]=(0,o.useState)(f?.serverName??""),[I,$]=(0,o.useState)(f?.transport==="streamable-http"?"streamable-http":"stdio"),[W,ne]=(0,o.useState)(f?.toolCallTimeoutMs!==void 0?String(f.toolCallTimeoutMs):""),[Z,X]=(0,o.useState)(f?.command??""),[J,le]=(0,o.useState)(f?f.args.join(`
973
- `):""),[ae,de]=(0,o.useState)(f?se(f.env,"="):""),[G,l]=(0,o.useState)(f?.url??""),[N,b]=(0,o.useState)(f?se(f.headers,":"):""),[a,h]=(0,o.useState)(f?.disabled??!1),[T,d]=(0,o.useState)(f?.yaml??""),[r,t]=(0,o.useState)(null),[u,s]=(0,o.useState)(!1);(0,o.useEffect)(()=>{const g=w=>{w.key==="Escape"&&m()};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[m]);const i=()=>{if(!/^[A-Za-z0-9_-]{1,64}$/u.test(H))return c("mcpInvalidId");if(!/^[A-Za-z0-9_-]{1,32}$/u.test(O))return c("mcpInvalidName");if(W!==""&&(!/^\d+$/u.test(W)||Number(W)<=0))return c("mcpInvalidTimeout");if(I==="streamable-http"){if(!/^https?:\/\//u.test(G))return c("mcpInvalidUrl")}else if(Z.trim().length===0)return c("mcpInvalidCommand");return null},v=()=>{t(null),s(!0);let g;if(P==="yaml")g={action:"save",server:{id:H,disabled:a},yaml:T};else{const w=i();if(w!==null){t(w),s(!1);return}let C={},V={};try{C=U(ae,"="),V=U(N,":")}catch(Y){t(Y instanceof Error?Y.message:String(Y)),s(!1);return}g={action:"save",server:{id:H,serverName:O,transport:I,command:Z,args:R(J),env:C,url:G,headers:V,...W!==""?{toolCallTimeoutMs:Number(W)}:{},disabled:a}}}K({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}).then(()=>{k()}).catch(w=>{t(w instanceof Error?w.message:String(w))}).finally(()=>{s(!1)})};return(0,z.createPortal)((0,e.jsxs)("div",{className:"dut-mcp-overlay",role:"presentation",children:[(0,e.jsx)("div",{className:"dut-mcp-mask","aria-hidden":"true",onClick:m}),(0,e.jsxs)("div",{className:"dut-mcp-panel",role:"dialog","aria-modal":"true","aria-label":c(S?"mcpEditTitle":"mcpAddTitle"),children:[(0,e.jsxs)("div",{className:"dut-mcp-panel-head",children:[(0,e.jsx)("h2",{children:c(S?"mcpEditTitle":"mcpAddTitle")}),(0,e.jsx)("span",{className:"dut-mcp-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-panel-close",onClick:m,"aria-label":"✕",children:"✕"})]}),(0,e.jsxs)("div",{className:"dut-mcp-tabs",role:"tablist",children:[(0,e.jsx)("button",{type:"button",role:"tab","aria-selected":P==="form",className:P==="form"?"dut-mcp-tab-on":"",onClick:()=>{x("form")},children:c("mcpFormTab")}),(0,e.jsx)("button",{type:"button",role:"tab","aria-selected":P==="yaml",className:P==="yaml"?"dut-mcp-tab-on":"",onClick:()=>{x("yaml")},children:c("mcpYamlTab")})]}),r!==null?(0,e.jsx)("div",{className:"dut-mcp-error",children:r}):null,P==="yaml"?(0,e.jsxs)("div",{className:"dut-mcp-form",children:[(0,e.jsxs)("div",{className:"dut-mcp-row2",children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldId")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:H,disabled:S,onChange:g=>{D(g.target.value)}}),(0,e.jsx)("small",{children:c("mcpFieldIdHint")})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldEnabled")}),(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:a?"":"dut-seg-active",onClick:()=>{h(!1)},children:c("mcpEnabledAction")}),(0,e.jsx)("button",{type:"button",className:a?"dut-seg-active":"",onClick:()=>{h(!0)},children:c("mcpDisabledAction")})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpYamlTab")}),(0,e.jsx)("textarea",{className:"dut-mcp-input dut-mcp-yaml",value:T,placeholder:c("mcpYamlPlaceholder"),spellCheck:!1,onChange:g=>{d(g.target.value)}}),(0,e.jsx)("small",{children:c("mcpYamlHint")})]})]}):(0,e.jsxs)("div",{className:"dut-mcp-form",children:[(0,e.jsxs)("div",{className:"dut-mcp-row2",children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldId")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:H,disabled:S,onChange:g=>{D(g.target.value)}}),(0,e.jsx)("small",{children:c("mcpFieldIdHint")})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldEnabled")}),(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:a?"":"dut-seg-active",onClick:()=>{h(!1)},children:c("mcpEnabledAction")}),(0,e.jsx)("button",{type:"button",className:a?"dut-seg-active":"",onClick:()=>{h(!0)},children:c("mcpDisabledAction")})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-row2",children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldName")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:O,onChange:g=>{A(g.target.value)}}),(0,e.jsx)("small",{children:c("mcpFieldNameHint")})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldType")}),(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:I==="stdio"?"dut-seg-active":"",onClick:()=>{$("stdio")},children:"stdio"}),(0,e.jsx)("button",{type:"button",className:I==="streamable-http"?"dut-seg-active":"",onClick:()=>{$("streamable-http")},children:"HTTP"})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldTimeout")}),(0,e.jsx)("input",{className:"dut-mcp-input",inputMode:"numeric",value:W,placeholder:"60000",onChange:g=>{ne(g.target.value)}})]}),I==="stdio"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldCommand")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:Z,placeholder:c("mcpFieldCommandPlaceholder"),onChange:g=>{X(g.target.value)}})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldArgs")}),(0,e.jsx)("textarea",{className:"dut-mcp-input",value:J,placeholder:`-y
974
- @some/mcp-server`,spellCheck:!1,onChange:g=>{le(g.target.value)}})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldEnv")}),(0,e.jsx)("textarea",{className:"dut-mcp-input dut-mcp-input-lg",value:ae,placeholder:"KEY=value",spellCheck:!1,onChange:g=>{de(g.target.value)}})]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldUrl")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:G,placeholder:"https://mcp.example.com/sse",onChange:g=>{l(g.target.value)}})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:c("mcpFieldHeaders")}),(0,e.jsx)("textarea",{className:"dut-mcp-input dut-mcp-input-lg",value:N,placeholder:"Authorization: Bearer …",spellCheck:!1,onChange:g=>{b(g.target.value)}})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-foot",children:[(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",disabled:u,onClick:m,children:c("mcpCancel")}),(0,e.jsx)("button",{type:"button",className:"dut-btn dut-btn-active",disabled:u,onClick:v,children:c("mcpSave")})]})]})]}),document.body)}},je["./notifier.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.requestNotifyPermission=se,j.previewTitleFlash=p,j.previewAlerts=y,j.installTaskNotifier=c;const e="dshTurnOutcome",o=["complete","aborted","failed"],z=m=>{switch(m?.kind){case"aborted":case"interrupted":return"aborted";case"error":return"failed";default:return"complete"}},F=2e3,K=3e4,R=900;function U(m,k,S){return m.split("{error}").join(S??"").split("{title}").join(k)}function se(){try{if(typeof Notification>"u")return;Notification.permission==="default"&&Notification.requestPermission()}catch{}}let ee,B;function p(m=6e3){ee!==void 0&&window.clearInterval(ee),B!==void 0&&window.clearTimeout(B);const k=document.title;let S=!1;const P=()=>{S=!S,document.title=S?`(1) 🔔 ${k}`:`(1) ${k}`};P(),ee=window.setInterval(P,R),B=window.setTimeout(()=>{ee!==void 0&&(window.clearInterval(ee),ee=void 0),B=void 0,document.title=k},m)}function y(m,k){if(se(),m.titleFlash&&p(),m.sound&&f("down"),!(!m.systemNotification||typeof Notification>"u")&&Notification.permission==="granted")try{const S=U(k.bodyComplete,"dsh-ui-tweaks",void 0);new Notification(k.notifyTitleDone,{body:S,tag:"dsh-ui-tweaks:preview",silent:!0})}catch{}}let M;function f(m){try{M??=new AudioContext;const k=M;k.state==="suspended"&&k.resume().catch(()=>{});const S=k.currentTime;(m==="up"?[880,1318.51]:[1174.66,783.99]).forEach((x,H)=>{const D=k.createOscillator(),O=k.createGain();D.type="sine",D.frequency.value=x;const A=S+H*.24;O.gain.setValueAtTime(1e-4,A),O.gain.exponentialRampToValueAtTime(.22,A+.03),O.gain.exponentialRampToValueAtTime(1e-4,A+.2),D.connect(O),O.connect(k.destination),D.start(A),D.stop(A+.24)})}catch{}}function c(m){const{sessionsService:k,text:S,readState:P,sessionStatus:x,openSession:H}=m,D=k.list,O=d=>{const r=x.getSnapshot().get(d)?.pendingInteraction?.kind;return r==="approval"||r==="plan-review"||r==="question"?r:void 0},A=d=>x.getSnapshot().get(d)?.completionUnread===!0,I=new Map,$=new Map;let W=null,ne,Z=!1,X=0;const J=()=>document.visibilityState==="visible"&&document.hasFocus(),le=()=>{ne===void 0&&(W=document.title,ne=window.setInterval(()=>{Z=!Z;const d=W??"";document.title=Z?`(${X}) 🔔 ${d}`:`(${X}) ${d}`},R))},ae=()=>{ne!==void 0&&(window.clearInterval(ne),ne=void 0),W!==null&&(document.title=W),W=null,X=0},de=()=>{J()&&ae()},G=()=>{de()};window.addEventListener("focus",de),document.addEventListener("visibilitychange",G);const l=(d,r,t,u,s)=>{if(!(typeof Notification>"u")&&Notification.permission==="granted")try{const i={body:u,tag:`dsh-ui-tweaks:${r}:${d}`,silent:s,renotify:!0},v=new Notification(t,i);v.onclick=()=>{try{window.focus()}catch{}try{H(r)}catch{}v.close()}}catch{}},N=(d,r,t,u,s,i,v)=>{const g=`${d}:${t}`,w=$.get(g);if(w!==void 0&&v-w<F||($.set(g,v),X+=1,i.titleFlash&&le(),!i.systemNotification&&!i.sound))return;const C=t==="complete"?S.notifyTitleDone:t==="aborted"?S.notifyTitleAborted:t==="failed"?S.notifyTitleFailed:S.notifyTitlePending;let V=t==="aborted"?S.bodyAborted:t==="failed"?S.bodyFailed:S.bodyComplete;t==="interaction"&&(V=u==="approval"?S.bodyApproval:u==="plan-review"?S.bodyPlan:S.bodyQuestion),l(t,d,C,U(V,r,s),i.sound),i.sound&&f(t==="complete"?"up":"down")},b=()=>{I.clear();for(const d of Object.values(D.getSnapshot().byId)){if(d.parentId!==void 0||d.blank)continue;const r=d.projectionValues?.[e]??void 0;I.set(d.id,{running:d.running,pending:O(d.id),completed:A(d.id),outcome:r})}},a=()=>{const{options:d,channels:r}=P(),t=!d.onlyWhenHidden||!J(),u=Date.now(),s=D.getSnapshot(),i=new Set;for(const v of Object.values(s.byId)){if(v.parentId!==void 0||v.blank)continue;i.add(v.id);const g=I.get(v.id),w=v.projectionValues?.[e]??void 0;if(I.set(v.id,{running:v.running,pending:O(v.id),completed:A(v.id),outcome:w}),g===void 0)continue;if(g.pending===void 0&&O(v.id)!==void 0){d.onInteraction&&t&&N(v.id,v.displayTitle,"interaction",O(v.id),void 0,r,u);continue}const C=g.running&&!v.running&&O(v.id)===void 0,V=!g.completed&&A(v.id);if(C||V){let Y=C;if(Y||(Y=o.every(be=>{const ue=$.get(`${v.id}:${be}`);return ue===void 0||u-ue>=K})),Y&&d.onComplete&&t){const ue=(g.outcome===void 0||w?.time!==g.outcome.time||w?.kind!==g.outcome.kind)&&w!==void 0?z(w):"complete";N(v.id,v.displayTitle,ue,void 0,w?.errorMessage,r,u)}}}for(const v of I.keys())i.has(v)||I.delete(v)};b();const h=D.subscribe(a),T=x.subscribe(a);return()=>{h(),T(),ae(),window.removeEventListener("focus",de),document.removeEventListener("visibilitychange",G),I.clear(),$.clear(),M!==void 0&&(M.close().catch(()=>{}),M=void 0)}}},je["./search.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.SEARCH_CSS=void 0,j.SearchSection=ee;const e=q("react/jsx-runtime"),o=q("react"),z="/_dsh/ui-tweaks/search";async function F(B){const p=await fetch(z,{credentials:"same-origin",...B});let y;try{y=await p.json()}catch{y=void 0}if(!p.ok||y===void 0||!y.ok){const M=y;throw new Error(M?.error?.message??`UI Tweaks search request failed with HTTP ${p.status}`)}return y.value}j.SEARCH_CSS=`
972
+ `;function ee(){const f="dsh-ui-tweaks-mcp";if(document.querySelector(`style[data-plugin-css="${f}"]`)!==null)return()=>{};const g=document.createElement("style");return g.dataset.plugin="dsh-ui-tweaks",g.dataset.pluginCss=f,g.textContent=j.MCP_CSS,document.head.appendChild(g),()=>{g.remove()}}function $(f,d){switch(f){case"active":return d("mcpStatusActive");case"failed":return d("mcpStatusFailed");case"loading":return d("mcpStatusLoading");case"stopped":return d("mcpStatusStopped");case"disabled":return d("mcpStatusDisabled")}}function p(f){switch(f){case"active":return" dut-mcp-ok";case"failed":return" dut-mcp-err";case"loading":return" dut-mcp-warn";default:return""}}function y({controller:f,t:d}){const k=(0,o.useSyncExternalStore)(f.subscribe,f.getSnapshot,f.getSnapshot).value?.mcpManagerEnabled===!0,[C,R]=(0,o.useState)(null),[w,P]=(0,o.useState)(null),[H,D]=(0,o.useState)(null),[A,B]=(0,o.useState)(null),[W,G]=(0,o.useState)(null),[ne,V]=(0,o.useState)(null),[Z,X]=(0,o.useState)(null),ue=(0,o.useMemo)(()=>({current:0}),[]),ae=()=>{const a=++ue.current;B(null),Y().then(h=>{a===ue.current&&R(h.servers)}).catch(h=>{a===ue.current&&(B(h instanceof Error?h.message:String(h)),R([]))})};(0,o.useEffect)(()=>{k&&ae()},[k]);const ce=(a,h,T)=>{P(a),B(null),G(null),Y({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).then(()=>{T?.()}).catch(l=>{B(l instanceof Error?l.message:String(l))}).finally(()=>{P(l=>l===a?null:l)})},q=(a,h=12,T=1e3)=>{let l=h;const S=()=>{const s=++ue.current;Y().then(t=>{s===ue.current&&(R(t.servers),l-=1,!(l<=0||a(t.servers))&&window.setTimeout(S,T))}).catch(()=>{l-=1,l>0&&window.setTimeout(S,T)})};S()},c=a=>{if(H!==a){D(a),window.setTimeout(()=>{D(h=>h===a?null:h)},3e3);return}D(null),ce(`remove:${a}`,{action:"remove",id:a},()=>{G(d("mcpRemoved")),q(h=>!h.some(T=>T.id===a),10)})},x=(a,h)=>{ce(`set-enabled:${a}`,{action:"set-enabled",id:a,enabled:h},()=>{q(T=>{const l=T.find(S=>S.id===a);return l===void 0?!0:h?l.status==="active"||l.status==="failed":l.status==="disabled"},45,1e3)})};if(!k)return(0,e.jsx)("div",{className:"dut-mcp",children:(0,e.jsxs)("div",{className:"dut-panel dut-mcp-off",children:[(0,e.jsx)("p",{children:d("mcpDisabledHint")}),(0,e.jsx)("div",{children:(0,e.jsx)("button",{type:"button",className:"dut-btn dut-btn-active",onClick:()=>{f.set("mcpManagerEnabled",!0).catch(()=>{B(d("unavailable"))})},children:d("mcpEnable")})})]})});const m=C??[];return(0,e.jsxs)("div",{className:"dut-mcp",children:[(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsxs)("div",{className:"dut-mcp-head",children:[(0,e.jsx)("h2",{children:d("mcpTitle")}),(0,e.jsxs)("span",{className:"dut-mcp-count",children:[m.length," · ",m.filter(a=>a.status==="active").length," ",d("mcpStatusActive")]}),(0,e.jsx)("span",{className:"dut-mcp-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",onClick:()=>{X("new")},children:d("mcpAdd")})]}),(0,e.jsx)("div",{className:"dut-mcp-note",children:d("mcpServerDetail")}),A!==null?(0,e.jsx)("div",{className:"dut-mcp-alert",children:A}):null,W!==null?(0,e.jsx)("div",{className:"dut-mcp-notice",children:W}):null,(0,e.jsx)("div",{className:"dut-mcp-body",children:C===null?(0,e.jsx)("div",{className:"dut-mcp-empty",children:d("loading")}):m.length===0?(0,e.jsx)("div",{className:"dut-mcp-empty",children:d("mcpEmpty")}):m.map(a=>{const h=a.url!==void 0?a.url:[a.command,...a.args].filter(Boolean).join(" "),T=ne===a.id;return(0,e.jsxs)("div",{className:"dut-mcp-row",children:[(0,e.jsxs)("div",{className:"dut-mcp-row-main",children:[(0,e.jsx)("span",{className:"dut-mcp-name",children:a.serverName}),(0,e.jsx)("span",{className:"dut-mcp-badge"+p(a.status),children:$(a.status,d)}),(0,e.jsxs)("span",{className:"dut-mcp-sub",children:["· ",a.toolCount," ",d("mcpTools")]}),(0,e.jsx)("span",{className:"dut-mcp-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",disabled:w!==null,onClick:()=>{x(a.id,a.disabled)},children:a.disabled?d("mcpEnabledAction"):d("mcpDisabledAction")}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",disabled:w!==null,onClick:()=>{X(a)},children:d("mcpEdit")}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn dut-mcp-del"+(H===a.id?" dut-mcp-confirm":""),disabled:w!==null,onClick:()=>{c(a.id)},children:H===a.id?d("mcpDelete")+"?":d("mcpDelete")})]}),(0,e.jsxs)("div",{className:"dut-mcp-sub",title:h,children:[a.id," · ",a.transport," · ",h]}),(0,e.jsxs)("button",{type:"button",className:"dut-mcp-toggle",onClick:()=>{V(T?null:a.id)},children:[T?"▾ ":"▸ ",a.toolCount," ",d("mcpTools"),a.env&&Object.keys(a.env).length>0?` · ${d("mcpEnv")}: ${Object.keys(a.env).join(", ")}`:""]}),T?(0,e.jsx)("div",{className:"dut-mcp-tools",children:a.tools.length===0?(0,e.jsx)("span",{className:"dut-mcp-sub",children:"—"}):a.tools.map(l=>(0,e.jsx)("span",{className:"dut-mcp-tool",children:l},l))}):null]},a.id)})})]}),Z!==null?(0,e.jsx)(E,{initial:Z==="new"?null:Z,t:d,onClose:()=>{X(null)},onSaved:()=>{X(null),G(d("mcpSaved")),q(()=>!1,10)}},Z==="new"?"new":Z.id):null]})}function E({initial:f,t:d,onClose:g,onSaved:k}){const C=f!==null,[R,w]=(0,o.useState)("form"),[P,H]=(0,o.useState)(f?.id??""),[D,A]=(0,o.useState)(f?.serverName??""),[B,W]=(0,o.useState)(f?.transport==="streamable-http"?"streamable-http":"stdio"),[G,ne]=(0,o.useState)(f?.toolCallTimeoutMs!==void 0?String(f.toolCallTimeoutMs):""),[V,Z]=(0,o.useState)(f?.command??""),[X,ue]=(0,o.useState)(f?f.args.join(`
973
+ `):""),[ae,ce]=(0,o.useState)(f?se(f.env,"="):""),[q,c]=(0,o.useState)(f?.url??""),[x,m]=(0,o.useState)(f?se(f.headers,":"):""),[a,h]=(0,o.useState)(f?.disabled??!1),[T,l]=(0,o.useState)(f?.yaml??""),[S,s]=(0,o.useState)(null),[t,u]=(0,o.useState)(!1);(0,o.useEffect)(()=>{const b=v=>{v.key==="Escape"&&g()};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[g]);const r=()=>{if(!/^[A-Za-z0-9_-]{1,64}$/u.test(P))return d("mcpInvalidId");if(!/^[A-Za-z0-9_-]{1,32}$/u.test(D))return d("mcpInvalidName");if(G!==""&&(!/^\d+$/u.test(G)||Number(G)<=0))return d("mcpInvalidTimeout");if(B==="streamable-http"){if(!/^https?:\/\//u.test(q))return d("mcpInvalidUrl")}else if(V.trim().length===0)return d("mcpInvalidCommand");return null},i=()=>{s(null),u(!0);let b;if(R==="yaml")b={action:"save",server:{id:P,disabled:a},yaml:T};else{const v=r();if(v!==null){s(v),u(!1);return}let M={},O={};try{M=U(ae,"="),O=U(x,":")}catch(J){s(J instanceof Error?J.message:String(J)),u(!1);return}b={action:"save",server:{id:P,serverName:D,transport:B,command:V,args:F(X),env:M,url:q,headers:O,...G!==""?{toolCallTimeoutMs:Number(G)}:{},disabled:a}}}Y({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}).then(()=>{k()}).catch(v=>{s(v instanceof Error?v.message:String(v))}).finally(()=>{u(!1)})};return(0,L.createPortal)((0,e.jsxs)("div",{className:"dut-mcp-overlay",role:"presentation",children:[(0,e.jsx)("div",{className:"dut-mcp-mask","aria-hidden":"true",onClick:g}),(0,e.jsxs)("div",{className:"dut-mcp-panel",role:"dialog","aria-modal":"true","aria-label":d(C?"mcpEditTitle":"mcpAddTitle"),children:[(0,e.jsxs)("div",{className:"dut-mcp-panel-head",children:[(0,e.jsx)("h2",{children:d(C?"mcpEditTitle":"mcpAddTitle")}),(0,e.jsx)("span",{className:"dut-mcp-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-mcp-panel-close",onClick:g,"aria-label":"✕",children:"✕"})]}),(0,e.jsxs)("div",{className:"dut-mcp-tabs",role:"tablist",children:[(0,e.jsx)("button",{type:"button",role:"tab","aria-selected":R==="form",className:R==="form"?"dut-mcp-tab-on":"",onClick:()=>{w("form")},children:d("mcpFormTab")}),(0,e.jsx)("button",{type:"button",role:"tab","aria-selected":R==="yaml",className:R==="yaml"?"dut-mcp-tab-on":"",onClick:()=>{w("yaml")},children:d("mcpYamlTab")})]}),S!==null?(0,e.jsx)("div",{className:"dut-mcp-error",children:S}):null,R==="yaml"?(0,e.jsxs)("div",{className:"dut-mcp-form",children:[(0,e.jsxs)("div",{className:"dut-mcp-row2",children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldId")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:P,disabled:C,onChange:b=>{H(b.target.value)}}),(0,e.jsx)("small",{children:d("mcpFieldIdHint")})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldEnabled")}),(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:a?"":"dut-seg-active",onClick:()=>{h(!1)},children:d("mcpEnabledAction")}),(0,e.jsx)("button",{type:"button",className:a?"dut-seg-active":"",onClick:()=>{h(!0)},children:d("mcpDisabledAction")})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpYamlTab")}),(0,e.jsx)("textarea",{className:"dut-mcp-input dut-mcp-yaml",value:T,placeholder:d("mcpYamlPlaceholder"),spellCheck:!1,onChange:b=>{l(b.target.value)}}),(0,e.jsx)("small",{children:d("mcpYamlHint")})]})]}):(0,e.jsxs)("div",{className:"dut-mcp-form",children:[(0,e.jsxs)("div",{className:"dut-mcp-row2",children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldId")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:P,disabled:C,onChange:b=>{H(b.target.value)}}),(0,e.jsx)("small",{children:d("mcpFieldIdHint")})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldEnabled")}),(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:a?"":"dut-seg-active",onClick:()=>{h(!1)},children:d("mcpEnabledAction")}),(0,e.jsx)("button",{type:"button",className:a?"dut-seg-active":"",onClick:()=>{h(!0)},children:d("mcpDisabledAction")})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-row2",children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldName")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:D,onChange:b=>{A(b.target.value)}}),(0,e.jsx)("small",{children:d("mcpFieldNameHint")})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldType")}),(0,e.jsxs)("div",{className:"dut-seg",children:[(0,e.jsx)("button",{type:"button",className:B==="stdio"?"dut-seg-active":"",onClick:()=>{W("stdio")},children:"stdio"}),(0,e.jsx)("button",{type:"button",className:B==="streamable-http"?"dut-seg-active":"",onClick:()=>{W("streamable-http")},children:"HTTP"})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldTimeout")}),(0,e.jsx)("input",{className:"dut-mcp-input",inputMode:"numeric",value:G,placeholder:"60000",onChange:b=>{ne(b.target.value)}})]}),B==="stdio"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldCommand")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:V,placeholder:d("mcpFieldCommandPlaceholder"),onChange:b=>{Z(b.target.value)}})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldArgs")}),(0,e.jsx)("textarea",{className:"dut-mcp-input",value:X,placeholder:`-y
974
+ @some/mcp-server`,spellCheck:!1,onChange:b=>{ue(b.target.value)}})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldEnv")}),(0,e.jsx)("textarea",{className:"dut-mcp-input dut-mcp-input-lg",value:ae,placeholder:"KEY=value",spellCheck:!1,onChange:b=>{ce(b.target.value)}})]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldUrl")}),(0,e.jsx)("input",{className:"dut-mcp-input",value:q,placeholder:"https://mcp.example.com/sse",onChange:b=>{c(b.target.value)}})]}),(0,e.jsxs)("div",{className:"dut-mcp-field",children:[(0,e.jsx)("span",{children:d("mcpFieldHeaders")}),(0,e.jsx)("textarea",{className:"dut-mcp-input dut-mcp-input-lg",value:x,placeholder:"Authorization: Bearer …",spellCheck:!1,onChange:b=>{m(b.target.value)}})]})]})]}),(0,e.jsxs)("div",{className:"dut-mcp-foot",children:[(0,e.jsx)("button",{type:"button",className:"dut-mcp-btn",disabled:t,onClick:g,children:d("mcpCancel")}),(0,e.jsx)("button",{type:"button",className:"dut-btn dut-btn-active",disabled:t,onClick:i,children:d("mcpSave")})]})]})]}),document.body)}},je["./notifier.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.requestNotifyPermission=se,j.previewTitleFlash=p,j.previewAlerts=y,j.installTaskNotifier=d;const e="dshTurnOutcome",o=["complete","aborted","failed"],L=g=>{switch(g?.kind){case"aborted":case"interrupted":return"aborted";case"error":return"failed";default:return"complete"}},z=2e3,Y=3e4,F=900;function U(g,k,C){return g.split("{error}").join(C??"").split("{title}").join(k)}function se(){try{if(typeof Notification>"u")return;Notification.permission==="default"&&Notification.requestPermission()}catch{}}let ee,$;function p(g=6e3){ee!==void 0&&window.clearInterval(ee),$!==void 0&&window.clearTimeout($);const k=document.title;let C=!1;const R=()=>{C=!C,document.title=C?`(1) 🔔 ${k}`:`(1) ${k}`};R(),ee=window.setInterval(R,F),$=window.setTimeout(()=>{ee!==void 0&&(window.clearInterval(ee),ee=void 0),$=void 0,document.title=k},g)}function y(g,k){if(se(),g.titleFlash&&p(),g.sound&&f("down"),!(!g.systemNotification||typeof Notification>"u")&&Notification.permission==="granted")try{const C=U(k.bodyComplete,"dsh-ui-tweaks",void 0);new Notification(k.notifyTitleDone,{body:C,tag:"dsh-ui-tweaks:preview",silent:!0})}catch{}}let E;function f(g){try{E??=new AudioContext;const k=E;k.state==="suspended"&&k.resume().catch(()=>{});const C=k.currentTime;(g==="up"?[880,1318.51]:[1174.66,783.99]).forEach((w,P)=>{const H=k.createOscillator(),D=k.createGain();H.type="sine",H.frequency.value=w;const A=C+P*.24;D.gain.setValueAtTime(1e-4,A),D.gain.exponentialRampToValueAtTime(.22,A+.03),D.gain.exponentialRampToValueAtTime(1e-4,A+.2),H.connect(D),D.connect(k.destination),H.start(A),H.stop(A+.24)})}catch{}}function d(g){const{sessionsService:k,text:C,readState:R,sessionStatus:w,openSession:P}=g,H=k.list,D=l=>{const S=w.getSnapshot().get(l)?.pendingInteraction?.kind;return S==="approval"||S==="plan-review"||S==="question"?S:void 0},A=l=>w.getSnapshot().get(l)?.completionUnread===!0,B=new Map,W=new Map;let G=null,ne,V=!1,Z=0;const X=()=>document.visibilityState==="visible"&&document.hasFocus(),ue=()=>{ne===void 0&&(G=document.title,ne=window.setInterval(()=>{V=!V;const l=G??"";document.title=V?`(${Z}) 🔔 ${l}`:`(${Z}) ${l}`},F))},ae=()=>{ne!==void 0&&(window.clearInterval(ne),ne=void 0),G!==null&&(document.title=G),G=null,Z=0},ce=()=>{X()&&ae()},q=()=>{ce()};window.addEventListener("focus",ce),document.addEventListener("visibilitychange",q);const c=(l,S,s,t,u)=>{if(!(typeof Notification>"u")&&Notification.permission==="granted")try{const r={body:t,tag:`dsh-ui-tweaks:${S}:${l}`,silent:u,renotify:!0},i=new Notification(s,r);i.onclick=()=>{try{window.focus()}catch{}try{P(S)}catch{}i.close()}}catch{}},x=(l,S,s,t,u,r,i)=>{const b=`${l}:${s}`,v=W.get(b);if(v!==void 0&&i-v<z||(W.set(b,i),Z+=1,r.titleFlash&&ue(),!r.systemNotification&&!r.sound))return;const M=s==="complete"?C.notifyTitleDone:s==="aborted"?C.notifyTitleAborted:s==="failed"?C.notifyTitleFailed:C.notifyTitlePending;let O=s==="aborted"?C.bodyAborted:s==="failed"?C.bodyFailed:C.bodyComplete;s==="interaction"&&(O=t==="approval"?C.bodyApproval:t==="plan-review"?C.bodyPlan:C.bodyQuestion),c(s,l,M,U(O,S,u),r.sound),r.sound&&f(s==="complete"?"up":"down")},m=()=>{B.clear();for(const l of Object.values(H.getSnapshot().byId)){if(l.parentId!==void 0||l.blank)continue;const S=l.projectionValues?.[e]??void 0;B.set(l.id,{running:l.running,pending:D(l.id),completed:A(l.id),outcome:S})}},a=()=>{const{options:l,channels:S}=R(),s=!l.onlyWhenHidden||!X(),t=Date.now(),u=H.getSnapshot(),r=new Set;for(const i of Object.values(u.byId)){if(i.parentId!==void 0||i.blank)continue;r.add(i.id);const b=B.get(i.id),v=i.projectionValues?.[e]??void 0;if(B.set(i.id,{running:i.running,pending:D(i.id),completed:A(i.id),outcome:v}),b===void 0)continue;if(b.pending===void 0&&D(i.id)!==void 0){l.onInteraction&&s&&x(i.id,i.displayTitle,"interaction",D(i.id),void 0,S,t);continue}const M=b.running&&!i.running&&D(i.id)===void 0,O=!b.completed&&A(i.id);if(M||O){let J=M;if(J||(J=o.every(ie=>{const pe=W.get(`${i.id}:${ie}`);return pe===void 0||t-pe>=Y})),J&&l.onComplete&&s){const pe=(b.outcome===void 0||v?.time!==b.outcome.time||v?.kind!==b.outcome.kind)&&v!==void 0?L(v):"complete";x(i.id,i.displayTitle,pe,void 0,v?.errorMessage,S,t)}}}for(const i of B.keys())r.has(i)||B.delete(i)};m();const h=H.subscribe(a),T=w.subscribe(a);return()=>{h(),T(),ae(),window.removeEventListener("focus",ce),document.removeEventListener("visibilitychange",q),B.clear(),W.clear(),E!==void 0&&(E.close().catch(()=>{}),E=void 0)}}},je["./search.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.SEARCH_CSS=void 0,j.SearchSection=ee;const e=K("react/jsx-runtime"),o=K("react"),L="/_dsh/ui-tweaks/search";async function z($){const p=await fetch(L,{credentials:"same-origin",...$});let y;try{y=await p.json()}catch{y=void 0}if(!p.ok||y===void 0||!y.ok){const E=y;throw new Error(E?.error?.message??`UI Tweaks search request failed with HTTP ${p.status}`)}return y.value}j.SEARCH_CSS=`
975
975
  .dut-search{display:grid;gap:12px;max-width:680px;padding:6px 2px 36px}
976
976
  .dut-search-head{display:flex;align-items:center;gap:10px;padding:14px 16px 0}
977
977
  .dut-search-head h2{margin:0;font-size:15px;font-weight:600;letter-spacing:-.01em;color:var(--dsw-alias-label-primary)}
@@ -997,7 +997,7 @@ textarea.dut-mcp-yaml{min-height:320px}
997
997
  .dut-search-btn:disabled{opacity:.5;cursor:default}
998
998
  .dut-search-status{padding:3px 10px;border-radius:999px;font-size:11.5px;background:color-mix(in srgb,var(--dsw-alias-state-success-primary) 12%,transparent);color:var(--dsw-alias-state-success-primary)}
999
999
  .dut-search-status.dut-search-err{background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 10%,transparent);color:var(--dsw-alias-state-error-primary)}
1000
- `;let K=!1;function R(){if(K)return;const B=document.createElement("style");B.dataset.plugin="dsh-ui-tweaks",B.dataset.pluginCss="dsh-ui-tweaks-search",B.textContent=j.SEARCH_CSS,document.head.appendChild(B),K=!0}const U=["exa","tavily","keenable","perplexity","deepseek"],se={exa:{env:"EXA_API_KEY",tier:"optional"},tavily:{env:"TAVILY_API_KEY",tier:"optional"},keenable:{env:"KEENABLE_API_KEY",tier:"optional"},perplexity:{env:"PERPLEXITY_API_KEY",tier:"required"},deepseek:{env:"DEEPSEEK_API_KEY",tier:"required"}};function ee({controller:B,t:p}){const y=(0,o.useSyncExternalStore)(B.subscribe,B.getSnapshot,B.getSnapshot),M=y.value??{},f=y.writable,c=typeof M.searchEngine=="string"?M.searchEngine:"bing",[m,k]=(0,o.useState)(null),[S,P]=(0,o.useState)(null),[x,H]=(0,o.useState)({}),[D,O]=(0,o.useState)(null),[A,I]=(0,o.useState)(null),[$,W]=(0,o.useState)(!1),[ne,Z]=(0,o.useState)(null),X=(0,o.useMemo)(()=>({current:0}),[]),J=()=>{const b=++X.current;F().then(a=>{b===X.current&&k(a)}).catch(a=>{b===X.current&&O(a instanceof Error?a.message:String(a))})};(0,o.useEffect)(()=>{J()},[]);const le=(b,a,h)=>{P(b),O(null),I(null),F({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(T=>{k(T),H(d=>{const r={...d},t=a.engine;return t!==void 0&&delete r[t],r}),I(h)}).catch(T=>{O(T instanceof Error?T.message:String(T))}).finally(()=>{P(T=>T===b?null:T)})},ae=b=>{const a=x[b]?.trim();a&&le(`save:${b}`,{action:"save-key",engine:b,value:a},p("keySaved"))},de=b=>{le(`clear:${b}`,{action:"clear-key",engine:b},p("keyCleared"))},G=(b,a)=>{B.set(b,a).then(()=>{I(p("applied"))}).catch(()=>{O(p("unavailable"))})},l=()=>{W(!0),Z(null);const b=Date.now();F({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",engine:c})}).then(()=>{Z({ok:!0,message:`${p("searchTestOk")} (${Date.now()-b}ms)`})}).catch(a=>{Z({ok:!1,message:`${p("searchTestFail")}: ${a instanceof Error?a.message:String(a)}`})}).finally(()=>{W(!1)})},N=b=>b==="free"?"dut-search-ok":b==="required"?"dut-search-req":"dut-search-key";return R(),(0,e.jsxs)("div",{className:"dut-search",children:[(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsxs)("div",{className:"dut-search-head",children:[(0,e.jsx)("h2",{children:p("searchTitle")}),(0,e.jsx)("span",{className:"dut-search-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-search-btn",disabled:$,onClick:()=>{l()},children:p($?"searchTesting":"searchTest")})]}),(0,e.jsx)("p",{className:"dut-search-note",children:p("searchIntro")}),ne!==null?(0,e.jsx)("p",{className:"dut-search-note"+(ne.ok?"":" dut-search-err"),style:{color:ne.ok?"var(--dsw-alias-state-success-primary)":"var(--dsw-alias-state-error-primary)"},children:ne.message}):null,D!==null?(0,e.jsx)("p",{className:"dut-search-note",style:{color:"var(--dsw-alias-state-error-primary)"},children:D}):null,A!==null?(0,e.jsx)("p",{className:"dut-search-note",style:{color:"var(--dsw-alias-state-success-primary)"},children:A}):null,(0,e.jsxs)("div",{className:"dut-search-grid",children:[(0,e.jsx)("div",{className:"dut-search-row",children:(0,e.jsxs)("div",{className:"dut-search-row-main",children:[(0,e.jsx)("span",{className:"dut-search-name",children:p("searchEngine")}),(0,e.jsxs)("select",{className:"dut-search-select",value:c,disabled:!f,onChange:b=>{G("searchEngine",b.target.value)},children:[(0,e.jsx)("option",{value:"bing",children:p("searchEngineBing")}),(0,e.jsx)("option",{value:"ddg",children:p("searchEngineDdg")}),(0,e.jsx)("option",{value:"exa",children:p("searchEngineExa")}),(0,e.jsx)("option",{value:"tavily",children:p("searchEngineTavily")}),(0,e.jsx)("option",{value:"keenable",children:p("searchEngineKeenable")}),(0,e.jsx)("option",{value:"perplexity",children:p("searchEnginePerplexity")}),(0,e.jsx)("option",{value:"deepseek",children:p("searchEngineDeepseek")})]})]})}),(0,e.jsx)("div",{className:"dut-search-row",children:(0,e.jsxs)("div",{className:"dut-search-row-main",children:[(0,e.jsx)("span",{className:"dut-search-name",children:p("bingMarket")}),(0,e.jsxs)("select",{className:"dut-search-select",value:typeof M.bingMarket=="string"?M.bingMarket:"zh-CN",disabled:!f,onChange:b=>{G("bingMarket",b.target.value)},children:[(0,e.jsx)("option",{value:"zh-CN",children:"中国大陆 (zh-CN)"}),(0,e.jsx)("option",{value:"zh-HK",children:"中国香港 (zh-HK)"}),(0,e.jsx)("option",{value:"zh-TW",children:"中国台湾 (zh-TW)"}),(0,e.jsx)("option",{value:"ja-JP",children:"日本 (ja-JP)"}),(0,e.jsx)("option",{value:"en-US",children:"美国 (en-US)"}),(0,e.jsx)("option",{value:"en-GB",children:"英国 (en-GB)"})]})]})})]})]}),(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-search-head",children:(0,e.jsx)("h2",{children:p("sectionKeys")})}),(0,e.jsx)("p",{className:"dut-search-note",children:p("searchIntro")}),(0,e.jsxs)("p",{className:"dut-search-note",children:[p("keyEnvHint")," ",(0,e.jsx)("span",{className:"dut-search-path",children:m?.credentialsPath??"~/.dsh/.credentials.yaml"})]}),(0,e.jsx)("div",{className:"dut-search-grid",children:U.map(b=>{const a=se[b],h=m?.keys?.[b]===!0,T=x[b]??"";return(0,e.jsxs)("div",{className:"dut-search-row",children:[(0,e.jsxs)("div",{className:"dut-search-row-main",children:[(0,e.jsx)("span",{className:"dut-search-name",children:p(`searchEngine${b.charAt(0).toUpperCase()}${b.slice(1)}`)}),(0,e.jsx)("span",{className:"dut-search-badge "+N(a.tier),children:a.tier==="required"?p("keyRequired"):a.tier==="optional"?p("keyOptional"):p("keyFree")}),(0,e.jsx)("span",{className:"dut-search-badge"+(h?" dut-search-ok":""),children:p(h?"keyConfigured":"keyNotConfigured")})]}),(0,e.jsxs)("div",{className:"dut-search-row-main",children:[h?null:(0,e.jsx)("input",{type:"password",className:"dut-search-input",placeholder:`${a.env}...`,value:T,disabled:S!==null||!f,onChange:d=>{H(r=>({...r,[b]:d.target.value}))}}),h?(0,e.jsx)("button",{type:"button",className:"dut-search-btn",disabled:S!==null||!f,onClick:()=>{de(b)},children:p("keyClear")}):(0,e.jsx)("button",{type:"button",className:"dut-search-btn",disabled:S!==null||!f||T.trim().length===0,onClick:()=>{ae(b)},children:p("keySave")})]})]},b)})})]})]})}},je["./timeline.js"]=function(he,j,q,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.TIMELINE_CSS=j.TIMELINE_PROJECTION_KEY=void 0,j.installTimelineStyles=U,j.TimelineRail=c;const e=q("react/jsx-runtime"),o=q("react"),z=q("react-dom");j.TIMELINE_PROJECTION_KEY="dshChatTimeline";const F=12,K=240,R=14;j.TIMELINE_CSS=`
1000
+ `;let Y=!1;function F(){if(Y)return;const $=document.createElement("style");$.dataset.plugin="dsh-ui-tweaks",$.dataset.pluginCss="dsh-ui-tweaks-search",$.textContent=j.SEARCH_CSS,document.head.appendChild($),Y=!0}const U=["exa","tavily","keenable","perplexity","deepseek"],se={exa:{env:"EXA_API_KEY",tier:"optional"},tavily:{env:"TAVILY_API_KEY",tier:"optional"},keenable:{env:"KEENABLE_API_KEY",tier:"optional"},perplexity:{env:"PERPLEXITY_API_KEY",tier:"required"},deepseek:{env:"DEEPSEEK_API_KEY",tier:"required"}};function ee({controller:$,t:p}){const y=(0,o.useSyncExternalStore)($.subscribe,$.getSnapshot,$.getSnapshot),E=y.value??{},f=y.writable,d=typeof E.searchEngine=="string"?E.searchEngine:"bing",[g,k]=(0,o.useState)(null),[C,R]=(0,o.useState)(null),[w,P]=(0,o.useState)({}),[H,D]=(0,o.useState)(null),[A,B]=(0,o.useState)(null),[W,G]=(0,o.useState)(!1),[ne,V]=(0,o.useState)(null),Z=(0,o.useMemo)(()=>({current:0}),[]),X=()=>{const m=++Z.current;z().then(a=>{m===Z.current&&k(a)}).catch(a=>{m===Z.current&&D(a instanceof Error?a.message:String(a))})};(0,o.useEffect)(()=>{X()},[]);const ue=(m,a,h)=>{R(m),D(null),B(null),z({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(T=>{k(T),P(l=>{const S={...l},s=a.engine;return s!==void 0&&delete S[s],S}),B(h)}).catch(T=>{D(T instanceof Error?T.message:String(T))}).finally(()=>{R(T=>T===m?null:T)})},ae=m=>{const a=w[m]?.trim();a&&ue(`save:${m}`,{action:"save-key",engine:m,value:a},p("keySaved"))},ce=m=>{ue(`clear:${m}`,{action:"clear-key",engine:m},p("keyCleared"))},q=(m,a)=>{$.set(m,a).then(()=>{B(p("applied"))}).catch(()=>{D(p("unavailable"))})},c=()=>{G(!0),V(null);const m=Date.now();z({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",engine:d})}).then(()=>{V({ok:!0,message:`${p("searchTestOk")} (${Date.now()-m}ms)`})}).catch(a=>{V({ok:!1,message:`${p("searchTestFail")}: ${a instanceof Error?a.message:String(a)}`})}).finally(()=>{G(!1)})},x=m=>m==="free"?"dut-search-ok":m==="required"?"dut-search-req":"dut-search-key";return F(),(0,e.jsxs)("div",{className:"dut-search",children:[(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsxs)("div",{className:"dut-search-head",children:[(0,e.jsx)("h2",{children:p("searchTitle")}),(0,e.jsx)("span",{className:"dut-search-spacer"}),(0,e.jsx)("button",{type:"button",className:"dut-search-btn",disabled:W,onClick:()=>{c()},children:p(W?"searchTesting":"searchTest")})]}),(0,e.jsx)("p",{className:"dut-search-note",children:p("searchIntro")}),ne!==null?(0,e.jsx)("p",{className:"dut-search-note"+(ne.ok?"":" dut-search-err"),style:{color:ne.ok?"var(--dsw-alias-state-success-primary)":"var(--dsw-alias-state-error-primary)"},children:ne.message}):null,H!==null?(0,e.jsx)("p",{className:"dut-search-note",style:{color:"var(--dsw-alias-state-error-primary)"},children:H}):null,A!==null?(0,e.jsx)("p",{className:"dut-search-note",style:{color:"var(--dsw-alias-state-success-primary)"},children:A}):null,(0,e.jsxs)("div",{className:"dut-search-grid",children:[(0,e.jsx)("div",{className:"dut-search-row",children:(0,e.jsxs)("div",{className:"dut-search-row-main",children:[(0,e.jsx)("span",{className:"dut-search-name",children:p("searchEngine")}),(0,e.jsxs)("select",{className:"dut-search-select",value:d,disabled:!f,onChange:m=>{q("searchEngine",m.target.value)},children:[(0,e.jsx)("option",{value:"bing",children:p("searchEngineBing")}),(0,e.jsx)("option",{value:"ddg",children:p("searchEngineDdg")}),(0,e.jsx)("option",{value:"exa",children:p("searchEngineExa")}),(0,e.jsx)("option",{value:"tavily",children:p("searchEngineTavily")}),(0,e.jsx)("option",{value:"keenable",children:p("searchEngineKeenable")}),(0,e.jsx)("option",{value:"perplexity",children:p("searchEnginePerplexity")}),(0,e.jsx)("option",{value:"deepseek",children:p("searchEngineDeepseek")})]})]})}),(0,e.jsx)("div",{className:"dut-search-row",children:(0,e.jsxs)("div",{className:"dut-search-row-main",children:[(0,e.jsx)("span",{className:"dut-search-name",children:p("bingMarket")}),(0,e.jsxs)("select",{className:"dut-search-select",value:typeof E.bingMarket=="string"?E.bingMarket:"zh-CN",disabled:!f,onChange:m=>{q("bingMarket",m.target.value)},children:[(0,e.jsx)("option",{value:"zh-CN",children:"中国大陆 (zh-CN)"}),(0,e.jsx)("option",{value:"zh-HK",children:"中国香港 (zh-HK)"}),(0,e.jsx)("option",{value:"zh-TW",children:"中国台湾 (zh-TW)"}),(0,e.jsx)("option",{value:"ja-JP",children:"日本 (ja-JP)"}),(0,e.jsx)("option",{value:"en-US",children:"美国 (en-US)"}),(0,e.jsx)("option",{value:"en-GB",children:"英国 (en-GB)"})]})]})})]})]}),(0,e.jsxs)("div",{className:"dut-panel",children:[(0,e.jsx)("div",{className:"dut-search-head",children:(0,e.jsx)("h2",{children:p("sectionKeys")})}),(0,e.jsx)("p",{className:"dut-search-note",children:p("searchIntro")}),(0,e.jsxs)("p",{className:"dut-search-note",children:[p("keyEnvHint")," ",(0,e.jsx)("span",{className:"dut-search-path",children:g?.credentialsPath??"~/.dsh/.credentials.yaml"})]}),(0,e.jsx)("div",{className:"dut-search-grid",children:U.map(m=>{const a=se[m],h=g?.keys?.[m]===!0,T=w[m]??"";return(0,e.jsxs)("div",{className:"dut-search-row",children:[(0,e.jsxs)("div",{className:"dut-search-row-main",children:[(0,e.jsx)("span",{className:"dut-search-name",children:p(`searchEngine${m.charAt(0).toUpperCase()}${m.slice(1)}`)}),(0,e.jsx)("span",{className:"dut-search-badge "+x(a.tier),children:a.tier==="required"?p("keyRequired"):a.tier==="optional"?p("keyOptional"):p("keyFree")}),(0,e.jsx)("span",{className:"dut-search-badge"+(h?" dut-search-ok":""),children:p(h?"keyConfigured":"keyNotConfigured")})]}),(0,e.jsxs)("div",{className:"dut-search-row-main",children:[h?null:(0,e.jsx)("input",{type:"password",className:"dut-search-input",placeholder:`${a.env}...`,value:T,disabled:C!==null||!f,onChange:l=>{P(S=>({...S,[m]:l.target.value}))}}),h?(0,e.jsx)("button",{type:"button",className:"dut-search-btn",disabled:C!==null||!f,onClick:()=>{ce(m)},children:p("keyClear")}):(0,e.jsx)("button",{type:"button",className:"dut-search-btn",disabled:C!==null||!f||T.trim().length===0,onClick:()=>{ae(m)},children:p("keySave")})]})]},m)})})]})]})}},je["./timeline.js"]=function(be,j,K,re){"use strict";Object.defineProperty(j,"__esModule",{value:!0}),j.TIMELINE_CSS=j.TIMELINE_PROJECTION_KEY=void 0,j.installTimelineStyles=U,j.TimelineRail=d;const e=K("react/jsx-runtime"),o=K("react"),L=K("react-dom");j.TIMELINE_PROJECTION_KEY="dshChatTimeline";const z=12,Y=240,F=14;j.TIMELINE_CSS=`
1001
1001
  .dutl-nav{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:100;display:flex;position:fixed;align-items:center;justify-content:flex-end;pointer-events:auto}
1002
1002
  .dutl-wrap{position:relative;z-index:2;border-radius:16px;width:24px;max-width:240px;transition:width .28s cubic-bezier(0.32,0.72,0,1),background-color .22s ease,box-shadow .22s ease,border-color .22s ease;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;border:1px solid transparent;background:transparent}
1003
1003
  .dutl-wrap.dutl-show{width:240px;background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 88%,transparent);-webkit-backdrop-filter:blur(18px) saturate(1.35);backdrop-filter:blur(18px) saturate(1.35);border:1px solid var(--dsw-alias-border-l1);box-shadow:var(--dsw-shadow-lv1),0 0 0 1px color-mix(in srgb,var(--dsw-alias-border-l1) 55%,transparent)}
@@ -1033,6 +1033,6 @@ textarea.dut-mcp-yaml{min-height:320px}
1033
1033
  .dutl-bubble-text::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--dsw-alias-label-tertiary) 35%,transparent);border-radius:4px}
1034
1034
  @keyframes dutl-bubble-in{from{opacity:0;transform:translateY(-50%) translateX(6px)}to{opacity:1;transform:translateY(-50%) translateX(0)}}
1035
1035
  @media (prefers-reduced-motion:reduce){.dutl-wrap,.dutl-title,.dutl-line,.dutl-bubble{transition:none;animation:none}}
1036
- `;function U(){const m="dsh-ui-tweaks-timeline";if(document.querySelector(`style[data-plugin-css="${m}"]`)!==null)return()=>{};const S=document.createElement("style");return S.dataset.plugin="dsh-ui-tweaks",S.dataset.pluginCss=m,S.textContent=j.TIMELINE_CSS,document.head.appendChild(S),()=>{S.remove()}}function se(m){if(m===null||typeof m!="object")return null;const k=m;return typeof k.seq!="number"?null:{seq:k.seq,time:typeof k.time=="number"?k.time:0,text:typeof k.text=="string"?k.text:"",...typeof k.id=="string"?{id:k.id}:{}}}function ee(m){if(typeof m.id=="string"&&m.id!=="")return`13:input-message${m.id}`}const B=m=>new Promise(k=>setTimeout(k,m)),p=()=>typeof requestAnimationFrame=="function"?new Promise(m=>requestAnimationFrame(()=>m())):B(16);function y(m){const k=new Date(m),S=new Date,P=k.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return k.toDateString()===S.toDateString()?P:`${k.toLocaleDateString([],{month:"short",day:"numeric"})} ${P}`}function M(m,k,S){const P=m.binding(k)?.eventSource;if(P===void 0)return!1;const x=P.getSnapshot().entries;for(let H=x.length-1;H>=0;H--){const D=x[H];if(D!==void 0&&D.type==="event"&&D.event.seq===S)return!0}return!1}async function f(m,k,S){const P=m.binding(k)?.session;if(P===void 0||typeof document>"u")return!1;const x=!!window.__dutTimelineDebug,H=(...G)=>{x&&console.debug("[dsh-ui-tweaks timeline]",...G)},D=Date.now()+15e4,O=S.key;if(O===void 0)return console.info("[dsh-ui-tweaks timeline] jump aborted: entry has no durable message id",{seq:S.seq}),!1;let A=0;for(;Date.now()<D&&A<2500&&!(S.seq===void 0||M(m,k,S.seq));){const G=P.getSnapshot();if(G.openState==="error")return!1;if(G.hasMore!==!0)return H("no more history",{loads:A}),!1;if(G.loadingOlder===!0){await B(60);continue}A+=1,await P.loadOlder(),H("loadOlder resolved",{loads:A})}if(S.seq!==void 0&&!M(m,k,S.seq))return console.info("[dsh-ui-tweaks timeline] jump aborted: target still outside loaded window",{seq:S.seq,loads:A}),!1;let I=0,$=null,W=null,ne=-1,Z=null,X=0,J=!1;for(;I++<360;){if($=document.querySelector("[data-conversation-scroll]"),W=$===null?null:$.querySelector(`[data-chat-anchor-key="${CSS.escape(O)}"]`),$===null||W===null){X=0,await p();continue}const G=$.getBoundingClientRect(),l=W.getBoundingClientRect(),N=Math.min(Math.max($.scrollTop+(l.top-G.top)-(G.height-l.height)/2,0),Math.max(0,$.scrollHeight-$.clientHeight));if(Z!==null&&Math.abs(N-Z)<=1?X+=1:X=0,ne=N,Z=N,X>=2){J=!0;break}await p()}if(J||console.info("[dsh-ui-tweaks timeline] jump: layout did not settle in time, applying best effort",{frames:I}),W===null||$===null||ne<0)return console.info("[dsh-ui-tweaks timeline] jump aborted: layout never revealed the target row",{key:O,frames:I}),!1;const le=Math.abs(W.getBoundingClientRect().top-$.getBoundingClientRect().top)>$.clientHeight*2;$.scrollTo({top:ne,behavior:"auto"}),await p(),await p();const ae=document.querySelector("[data-conversation-scroll]"),de=ae===null?null:ae.querySelector(`[data-chat-anchor-key="${CSS.escape(O)}"]`);if(ae!==null&&de!==null){const G=ae.getBoundingClientRect(),l=de.getBoundingClientRect();if(Math.abs(l.top+l.height/2-(G.top+G.height/2))>G.height*.5){const b=Math.min(Math.max(ae.scrollTop+(l.top-G.top)-(G.height-l.height)/2,0),Math.max(0,ae.scrollHeight-ae.clientHeight));ae.scrollTo({top:b,behavior:"auto"}),H("self-check corrected",{top:b})}}return H("jump applied",{far:le,loads:A,frames:I,top:ne}),!0}function c({useProjection:m,sessionId:k,sessionsService:S,controller:P,t:x}){const D=(0,o.useSyncExternalStore)(P.subscribe,P.getSnapshot,P.getSnapshot).value?.timelineStyle==="web",O=m(j.TIMELINE_PROJECTION_KEY),A=(0,o.useMemo)(()=>Array.isArray(O?.messages)?O.messages.map(se).filter(a=>a!==null):[],[O]),[I,$]=(0,o.useState)(-1),[W,ne]=(0,o.useState)(!1),[Z,X]=(0,o.useState)(null),[J,le]=(0,o.useState)(null),ae=(0,o.useRef)(null),de=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(I<0)return;const a=requestAnimationFrame(()=>{const h=ae.current;if(h===null||h.scrollHeight<=h.clientHeight+1)return;const T=h.children[I];if(T===void 0)return;const d=h.getBoundingClientRect(),r=T.getBoundingClientRect();r.bottom>d.bottom?h.scrollTop+=r.bottom-d.bottom:r.top<d.top&&(h.scrollTop-=d.top-r.top)});return()=>{cancelAnimationFrame(a)}},[W,I]);const G=D&&k!==void 0&&A.length>=2;if((0,o.useEffect)(()=>{const a=de.current;if(!G||a===null)return;const h=T=>{const d=ae.current;if(d===null||T.deltaY===0)return;const r=d.scrollHeight-d.clientHeight;if(r<=0)return;const t=d.scrollTop,u=Math.min(r,Math.max(0,t+T.deltaY));u!==t&&(T.preventDefault(),T.stopPropagation(),d.scrollTop=u)};return a.addEventListener("wheel",h,{passive:!1}),()=>{a.removeEventListener("wheel",h)}},[G]),(0,o.useEffect)(()=>{if(!D)return;const a=()=>{const r=document.querySelector("[data-conversation-scroll]");if(r===null)return;const t=r.getBoundingClientRect();if(t.width===0||t.height===0)return;const u=Math.round(t.top+t.height/2),s=Math.max(0,Math.round(window.innerWidth-t.right+F));X(i=>i!==null&&Math.abs(i.top-u)<2&&Math.abs(i.right-s)<2?i:{top:u,right:s})};a();let h=0;const T=document.querySelector("[data-conversation-scroll]"),d=new ResizeObserver(()=>{cancelAnimationFrame(h),h=requestAnimationFrame(a)});return T!==null&&d.observe(T),d.observe(document.body),window.addEventListener("resize",a),()=>{cancelAnimationFrame(h),d.disconnect(),window.removeEventListener("resize",a)}},[D,k]),(0,o.useEffect)(()=>{if(A.length===0)return;const a=new Map;for(let g=0;g<A.length;g++){const w=A[g];if(w===void 0)continue;const C=ee(w);C!==void 0&&a.set(C,g)}let h=null,T=new Map;const d=()=>{const g=document.querySelector("[data-conversation-scroll]");h=g;const w=new Map;if(g!==null)for(const C of g.querySelectorAll('[data-chat-anchor-key^="13:input-message"]')){const V=C.getAttribute("data-chat-anchor-key");V!==null&&w.set(V,C)}T=w},r=()=>{const g=document.querySelector("[data-conversation-scroll]");if(g===null||((g!==h||T.size===0)&&d(),g===null||g!==h||T.size===0))return;const w=g.getBoundingClientRect();if(w.height===0)return;const C=w.top+w.height*.4;let V=-1,Y=1/0;for(const[be,ue]of T){const we=a.get(be)??-1;if(we===-1)continue;const me=ue.getBoundingClientRect(),te=Math.abs(me.top+me.height/2-C);te<Y&&(Y=te,V=we)}$(V)};let t=0;const u=()=>{if(T.size===0&&++t<=120){requestAnimationFrame(()=>{d(),u()});return}r()};u();let s=0;const i=()=>{s===0&&(s=requestAnimationFrame(()=>{s=0,r()}))};document.addEventListener("scroll",i,{passive:!0,capture:!0});const v=new ResizeObserver(()=>{r()});return v.observe(document.body),()=>{s!==0&&cancelAnimationFrame(s),document.removeEventListener("scroll",i,{capture:!0}),v.disconnect()}},[k,A.length]),!D||k===void 0||A.length<2)return null;const l=Z===null?F:Z.right,N=Z===null?{top:"50%",right:F,transform:"translateY(-50%)"}:{top:Z.top,right:Z.right,transform:"translateY(-50%)"},b={top:J===null?0:J.top,right:l+K+R};return(0,z.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"dutl-nav",role:"navigation","aria-label":x("railLabel"),ref:de,onMouseEnter:()=>{ne(!0)},onMouseLeave:()=>{ne(!1)},style:N,children:(0,e.jsx)("div",{className:"dutl-wrap"+(W?" dutl-show":""),children:(0,e.jsx)("div",{className:"dutl-page",ref:ae,children:A.map((a,h)=>(0,e.jsxs)("button",{type:"button",className:"dutl-item"+(I===h?" dutl-active":""),"aria-label":`${x("roleUser")}: ${a.text.slice(0,60)||x("noText")}`,"aria-current":I===h?"location":void 0,onClick:()=>{f(S,k,{key:ee(a),seq:a.seq}).catch(()=>{})},onMouseEnter:T=>{const d=T.currentTarget.getBoundingClientRect(),r=Math.min(Math.max(d.top+d.height/2,150),window.innerHeight-150);le({top:r,entry:a})},onMouseLeave:()=>{le(null)},children:[(0,e.jsx)("span",{className:"dutl-title"+(W?" dutl-show":""),children:a.text===""?x("noText"):a.text}),(0,e.jsx)("span",{className:"dutl-ind","aria-hidden":!0,children:(0,e.jsx)("span",{className:"dutl-line"})})]},a.seq))})})}),J!==null&&W?(0,e.jsxs)("div",{className:"dutl-bubble",style:b,role:"tooltip",children:[(0,e.jsxs)("div",{className:"dutl-bubble-head",children:[(0,e.jsxs)("span",{className:"dutl-bubble-user",children:[(0,e.jsx)("span",{className:"dutl-bubble-dot"}),x("roleUser")]}),(0,e.jsx)("span",{className:"dutl-bubble-time",children:y(J.entry.time)})]}),(0,e.jsx)("div",{className:"dutl-bubble-text",children:J.entry.text===""?x("noText"):J.entry.text})]}):null]}),document.body)}};function ca(he,j){if(!j.startsWith("."))return j;var q=he.slice(2).split("/");q.pop();for(var re of j.split("/"))re==="."||re===""||(re===".."?q.pop():q.push(re));return"./"+q.join("/")}function ra(he){if(je[he]===void 0)return Ve(he);if(Ze[he]!==void 0)return Ze[he].exports;var j=Ze[he]={exports:{}};return je[he](j,j.exports,Ve,function(q){var re=ca(he,q);return je[re]===void 0?Ve(q):ra(re)}),j.exports}return ra("./index.js")}});
1036
+ `;function U(){const g="dsh-ui-tweaks-timeline";if(document.querySelector(`style[data-plugin-css="${g}"]`)!==null)return()=>{};const C=document.createElement("style");return C.dataset.plugin="dsh-ui-tweaks",C.dataset.pluginCss=g,C.textContent=j.TIMELINE_CSS,document.head.appendChild(C),()=>{C.remove()}}function se(g){if(g===null||typeof g!="object")return null;const k=g;return typeof k.seq!="number"?null:{seq:k.seq,time:typeof k.time=="number"?k.time:0,text:typeof k.text=="string"?k.text:"",...typeof k.id=="string"?{id:k.id}:{}}}function ee(g){if(typeof g.id=="string"&&g.id!=="")return`13:input-message${g.id}`}const $=g=>new Promise(k=>setTimeout(k,g)),p=()=>typeof requestAnimationFrame=="function"?new Promise(g=>requestAnimationFrame(()=>g())):$(16);function y(g){const k=new Date(g),C=new Date,R=k.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return k.toDateString()===C.toDateString()?R:`${k.toLocaleDateString([],{month:"short",day:"numeric"})} ${R}`}function E(g,k,C){const R=g.binding(k)?.eventSource;if(R===void 0)return!1;const w=R.getSnapshot().entries;for(let P=w.length-1;P>=0;P--){const H=w[P];if(H!==void 0&&H.type==="event"&&H.event.seq===C)return!0}return!1}async function f(g,k,C){const R=g.binding(k)?.session;if(R===void 0||typeof document>"u")return!1;const w=!!window.__dutTimelineDebug,P=(...q)=>{w&&console.debug("[dsh-ui-tweaks timeline]",...q)},H=Date.now()+15e4,D=C.key;if(D===void 0)return console.info("[dsh-ui-tweaks timeline] jump aborted: entry has no durable message id",{seq:C.seq}),!1;let A=0;for(;Date.now()<H&&A<2500&&!(C.seq===void 0||E(g,k,C.seq));){const q=R.getSnapshot();if(q.openState==="error")return!1;if(q.hasMore!==!0)return P("no more history",{loads:A}),!1;if(q.loadingOlder===!0){await $(60);continue}A+=1,await R.loadOlder(),P("loadOlder resolved",{loads:A})}if(C.seq!==void 0&&!E(g,k,C.seq))return console.info("[dsh-ui-tweaks timeline] jump aborted: target still outside loaded window",{seq:C.seq,loads:A}),!1;let B=0,W=null,G=null,ne=-1,V=null,Z=0,X=!1;for(;B++<360;){if(W=document.querySelector("[data-conversation-scroll]"),G=W===null?null:W.querySelector(`[data-chat-anchor-key="${CSS.escape(D)}"]`),W===null||G===null){Z=0,await p();continue}const q=W.getBoundingClientRect(),c=G.getBoundingClientRect(),x=Math.min(Math.max(W.scrollTop+(c.top-q.top)-(q.height-c.height)/2,0),Math.max(0,W.scrollHeight-W.clientHeight));if(V!==null&&Math.abs(x-V)<=1?Z+=1:Z=0,ne=x,V=x,Z>=2){X=!0;break}await p()}if(X||console.info("[dsh-ui-tweaks timeline] jump: layout did not settle in time, applying best effort",{frames:B}),G===null||W===null||ne<0)return console.info("[dsh-ui-tweaks timeline] jump aborted: layout never revealed the target row",{key:D,frames:B}),!1;const ue=Math.abs(G.getBoundingClientRect().top-W.getBoundingClientRect().top)>W.clientHeight*2;W.scrollTo({top:ne,behavior:"auto"}),await p(),await p();const ae=document.querySelector("[data-conversation-scroll]"),ce=ae===null?null:ae.querySelector(`[data-chat-anchor-key="${CSS.escape(D)}"]`);if(ae!==null&&ce!==null){const q=ae.getBoundingClientRect(),c=ce.getBoundingClientRect();if(Math.abs(c.top+c.height/2-(q.top+q.height/2))>q.height*.5){const m=Math.min(Math.max(ae.scrollTop+(c.top-q.top)-(q.height-c.height)/2,0),Math.max(0,ae.scrollHeight-ae.clientHeight));ae.scrollTo({top:m,behavior:"auto"}),P("self-check corrected",{top:m})}}return P("jump applied",{far:ue,loads:A,frames:B,top:ne}),!0}function d({useProjection:g,sessionId:k,sessionsService:C,controller:R,t:w}){const H=(0,o.useSyncExternalStore)(R.subscribe,R.getSnapshot,R.getSnapshot).value?.timelineStyle==="web",D=g(j.TIMELINE_PROJECTION_KEY),A=(0,o.useMemo)(()=>Array.isArray(D?.messages)?D.messages.map(se).filter(a=>a!==null):[],[D]),[B,W]=(0,o.useState)(-1),[G,ne]=(0,o.useState)(!1),[V,Z]=(0,o.useState)(null),[X,ue]=(0,o.useState)(null),ae=(0,o.useRef)(null),ce=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(B<0)return;const a=requestAnimationFrame(()=>{const h=ae.current;if(h===null||h.scrollHeight<=h.clientHeight+1)return;const T=h.children[B];if(T===void 0)return;const l=h.getBoundingClientRect(),S=T.getBoundingClientRect();S.bottom>l.bottom?h.scrollTop+=S.bottom-l.bottom:S.top<l.top&&(h.scrollTop-=l.top-S.top)});return()=>{cancelAnimationFrame(a)}},[G,B]);const q=H&&k!==void 0&&A.length>=2;if((0,o.useEffect)(()=>{const a=ce.current;if(!q||a===null)return;const h=T=>{const l=ae.current;if(l===null||T.deltaY===0)return;const S=l.scrollHeight-l.clientHeight;if(S<=0)return;const s=l.scrollTop,t=Math.min(S,Math.max(0,s+T.deltaY));t!==s&&(T.preventDefault(),T.stopPropagation(),l.scrollTop=t)};return a.addEventListener("wheel",h,{passive:!1}),()=>{a.removeEventListener("wheel",h)}},[q]),(0,o.useEffect)(()=>{if(!H)return;const a=()=>{const S=document.querySelector("[data-conversation-scroll]");if(S===null)return;const s=S.getBoundingClientRect();if(s.width===0||s.height===0)return;const t=Math.round(s.top+s.height/2),u=Math.max(0,Math.round(window.innerWidth-s.right+z));Z(r=>r!==null&&Math.abs(r.top-t)<2&&Math.abs(r.right-u)<2?r:{top:t,right:u})};a();let h=0;const T=document.querySelector("[data-conversation-scroll]"),l=new ResizeObserver(()=>{cancelAnimationFrame(h),h=requestAnimationFrame(a)});return T!==null&&l.observe(T),l.observe(document.body),window.addEventListener("resize",a),()=>{cancelAnimationFrame(h),l.disconnect(),window.removeEventListener("resize",a)}},[H,k]),(0,o.useEffect)(()=>{if(A.length===0)return;const a=new Map;for(let b=0;b<A.length;b++){const v=A[b];if(v===void 0)continue;const M=ee(v);M!==void 0&&a.set(M,b)}let h=null,T=new Map;const l=()=>{const b=document.querySelector("[data-conversation-scroll]");h=b;const v=new Map;if(b!==null)for(const M of b.querySelectorAll('[data-chat-anchor-key^="13:input-message"]')){const O=M.getAttribute("data-chat-anchor-key");O!==null&&v.set(O,M)}T=v},S=()=>{const b=document.querySelector("[data-conversation-scroll]");if(b===null||((b!==h||T.size===0)&&l(),b===null||b!==h||T.size===0))return;const v=b.getBoundingClientRect();if(v.height===0)return;const M=v.top+v.height*.4;let O=-1,J=1/0;for(const[ie,pe]of T){const ve=a.get(ie)??-1;if(ve===-1)continue;const ge=pe.getBoundingClientRect(),te=Math.abs(ge.top+ge.height/2-M);te<J&&(J=te,O=ve)}W(O)};let s=0;const t=()=>{if(T.size===0&&++s<=120){requestAnimationFrame(()=>{l(),t()});return}S()};t();let u=0;const r=()=>{u===0&&(u=requestAnimationFrame(()=>{u=0,S()}))};document.addEventListener("scroll",r,{passive:!0,capture:!0});const i=new ResizeObserver(()=>{S()});return i.observe(document.body),()=>{u!==0&&cancelAnimationFrame(u),document.removeEventListener("scroll",r,{capture:!0}),i.disconnect()}},[k,A.length]),!H||k===void 0||A.length<2)return null;const c=V===null?z:V.right,x=V===null?{top:"50%",right:z,transform:"translateY(-50%)"}:{top:V.top,right:V.right,transform:"translateY(-50%)"},m={top:X===null?0:X.top,right:c+Y+F};return(0,L.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"dutl-nav",role:"navigation","aria-label":w("railLabel"),ref:ce,onMouseEnter:()=>{ne(!0)},onMouseLeave:()=>{ne(!1)},style:x,children:(0,e.jsx)("div",{className:"dutl-wrap"+(G?" dutl-show":""),children:(0,e.jsx)("div",{className:"dutl-page",ref:ae,children:A.map((a,h)=>(0,e.jsxs)("button",{type:"button",className:"dutl-item"+(B===h?" dutl-active":""),"aria-label":`${w("roleUser")}: ${a.text.slice(0,60)||w("noText")}`,"aria-current":B===h?"location":void 0,onClick:()=>{f(C,k,{key:ee(a),seq:a.seq}).catch(()=>{})},onMouseEnter:T=>{const l=T.currentTarget.getBoundingClientRect(),S=Math.min(Math.max(l.top+l.height/2,150),window.innerHeight-150);ue({top:S,entry:a})},onMouseLeave:()=>{ue(null)},children:[(0,e.jsx)("span",{className:"dutl-title"+(G?" dutl-show":""),children:a.text===""?w("noText"):a.text}),(0,e.jsx)("span",{className:"dutl-ind","aria-hidden":!0,children:(0,e.jsx)("span",{className:"dutl-line"})})]},a.seq))})})}),X!==null&&G?(0,e.jsxs)("div",{className:"dutl-bubble",style:m,role:"tooltip",children:[(0,e.jsxs)("div",{className:"dutl-bubble-head",children:[(0,e.jsxs)("span",{className:"dutl-bubble-user",children:[(0,e.jsx)("span",{className:"dutl-bubble-dot"}),w("roleUser")]}),(0,e.jsx)("span",{className:"dutl-bubble-time",children:y(X.entry.time)})]}),(0,e.jsx)("div",{className:"dutl-bubble-text",children:X.entry.text===""?w("noText"):X.entry.text})]}):null]}),document.body)}};function ca(be,j){if(!j.startsWith("."))return j;var K=be.slice(2).split("/");K.pop();for(var re of j.split("/"))re==="."||re===""||(re===".."?K.pop():K.push(re));return"./"+K.join("/")}function ra(be){if(je[be]===void 0)return Ve(be);if(Ze[be]!==void 0)return Ze[be].exports;var j=Ze[be]={exports:{}};return je[be](j,j.exports,Ve,function(K){var re=ca(be,K);return je[re]===void 0?Ve(K):ra(re)}),j.exports}return ra("./index.js")}});
1037
1037
 
1038
1038
  //# sourceMappingURL=client.js.map