@michengai/dsh-archive-manager 1.2.0 → 1.2.3
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/CHANGELOG.md +9 -0
- package/CHANGELOG.zh-CN.md +9 -0
- package/lib/client.js +5 -5
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -7,11 +7,11 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
globalThis.__dshArchiveReactDOMClient = require("react-dom/client");
|
|
8
8
|
var module = { exports: {} };
|
|
9
9
|
var exports = module.exports;
|
|
10
|
-
"use strict";var Bn=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Fs=Object.prototype.hasOwnProperty;var e=(t,r)=>Bn(t,"name",{value:r,configurable:!0});var Bs=(t,r)=>{for(var i in r)Bn(t,i,{get:r[i],enumerable:!0})},Hs=(t,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Os(r))!Fs.call(t,o)&&o!==i&&Bn(t,o,{get:()=>r[o],enumerable:!(a=Ps(r,o))||a.enumerable});return t};var Us=t=>Hs(Bn({},"__esModule",{value:!0}),t);var mi={};Bs(mi,{startArchiveClient:()=>pi});module.exports=Us(mi);function oe(t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("\u53C2\u6570\u5FC5\u987B\u4E3A\u5BF9\u8C61");return t}e(oe,"record");function Ue(t){return String(t&&typeof t=="object"&&"message"in t?t.message??t:t)}e(Ue,"errorMessage");function Hn(t){return t&&typeof t=="object"&&"code"in t?t.code:void 0}e(Hn,"errorCode");var aa=Function("return globalThis.__dshArchiveReact")(),{Children:bi,Component:yi,Fragment:sa,Profiler:wi,PureComponent:Si,StrictMode:xi,Suspense:ki,cloneElement:Ci,createContext:Ei,createElement:ia,createRef:Ti,forwardRef:Ii,isValidElement:_i,lazy:Ai,memo:Ri,startTransition:ji,useCallback:Ni,useContext:Di,useDebugValue:Mi,useDeferredValue:zi,useEffect:oa,useId:Li,useImperativeHandle:Pi,useInsertionEffect:Oi,useLayoutEffect:Fi,useMemo:Bi,useReducer:Hi,useRef:Ui,useState:Ut,useSyncExternalStore:Wi,useTransition:qi,version:Vi}=aa,W=aa;function ca(t){return W.createElement("input",{className:"dsham_number",type:"number",min:t.min,max:t.max,value:t.value??"",disabled:t.disabled,"aria-label":t["aria-label"],onChange:e(r=>{let i=r.target.value;if(i===""){t.onChange(null);return}let a=Number(i);t.onChange(Number.isNaN(a)?null:a)},"onChange")})}e(ca,"NumberField");function qs(t=W.createElement){return t("svg",{className:"dsham_dateIcon",width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},t("rect",{x:2,y:3,width:12,height:11,rx:2}),t("line",{x1:2,y1:6.5,x2:14,y2:6.5}),t("line",{x1:5.5,y1:1.5,x2:5.5,y2:3.5}),t("line",{x1:10.5,y1:1.5,x2:10.5,y2:3.5}))}e(qs,"CalendarIcon");function In(t,r,i){let a=String(r+1).padStart(2,"0"),o=String(i).padStart(2,"0");return`${t}-${a}-${o}`}e(In,"formatYmd");function hn(t){let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);return r?{year:Number(r[1]),monthIndex:Number(r[2])-1,day:Number(r[3])}:null}e(hn,"parseYmd");function Vs(t,r){let i=new Date(t,r,1).getDay(),a=(i===0?7:i)-1,o=new Date(t,r+1,0).getDate(),f=new Date(t,r,0).getDate(),c=[];for(let k=0;k<42;k++){let y=t,I=r,w=0,g=!1;k<a?(w=f-a+k+1,I=r-1,I<0&&(I=11,y--),g=!0):k<a+o?w=k-a+1:(w=k-a-o+1,I=r+1,I>11&&(I=0,y++),g=!0),c.push({year:y,monthIndex:I,day:w,dateStr:In(y,I,w),isOutside:g})}return c}e(Vs,"buildMonthGrid");function $s(t,r=new Date){if(t==="all")return{from:"",to:""};let i=In(r.getFullYear(),r.getMonth(),r.getDate());if(t==="today")return{from:i,to:i};let a=t==="7d"?6:t==="30d"?29:89,o=new Date(r.getTime()-a*864e5);return{from:In(o.getFullYear(),o.getMonth(),o.getDate()),to:i}}e($s,"getPresetRange");function la(t,r,i,a){let o=r+a,f=new Date(t,o+1,0).getDate();return new Date(t,o,Math.min(i,f))}e(la,"shiftMonthClamped");function da(t){let r=t.React||W;function i(T,ne){let Ze=T==="from"?ne:t.from,Yt=T==="to"?ne:t.to;if(Ze===""&&Yt===""){t.onClear();return}T==="from"?t.onFrom(ne):t.onTo(ne)}e(i,"change");let a=!!(t.from||t.to),o="";t.from&&t.to?o=`${t.from} \u2013 ${t.to}`:t.from?o=`${t.from} \u2013`:t.to?o=`\u2013 ${t.to}`:o=t.t?t.t("discovery.timeRange")||`${t.fromLabel} \u2013 ${t.toLabel}`:`${t.fromLabel} \u2013 ${t.toLabel}`;let c=(r.useRef??(T=>{let[ne]=r.useState({current:T});return ne}))(null),[k,y]=r.useState(!1),I=hn(t.from||t.to)??{year:new Date().getFullYear(),monthIndex:new Date().getMonth(),day:new Date().getDate()},[w,g]=r.useState(I.year),[S,D]=r.useState(I.monthIndex),[j,U]=r.useState(null),[L,H]=r.useState(null),[he,se]=r.useState(null);r.useEffect(()=>{if(!k)return;let T=e(Ze=>{c.current&&!c.current.contains(Ze.target)&&(y(!1),U(null))},"onPointerDown"),ne=e(Ze=>{Ze.key==="Escape"&&(Ze.preventDefault(),Ze.stopPropagation(),y(!1),U(null))},"onKeyDown");return typeof document<"u"&&document.addEventListener("mousedown",T,!0),typeof window<"u"&&window.addEventListener("keydown",ne,!0),()=>{typeof document<"u"&&document.removeEventListener("mousedown",T,!0),typeof window<"u"&&window.removeEventListener("keydown",ne,!0)}},[k]),r.useEffect(()=>{if(!k||!he||!c.current)return;c.current.querySelector(`[data-date="${he}"]`)?.focus()},[k,he]);let V=t.t?t.t("discovery.today")==="Today"||(t.t("locale.language")||"").startsWith("en"):!1,ce=t.t?t.t("discovery.today")==="\u0421\u0435\u0433\u043E\u0434\u043D\u044F"||(t.t("locale.language")||"").startsWith("ru"):!1,de=V?"en-US":ce?"ru-RU":"zh-CN",Xe=V?["Mo","Tu","We","Th","Fr","Sa","Su"]:ce?["\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431","\u0412\u0441"]:["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u65E5"];function te(T){T.stopPropagation(),S<=0?(D(11),g(ne=>ne-1)):D(ne=>ne-1)}e(te,"prevMonth");function J(T){T.stopPropagation(),S>=11?(D(0),g(ne=>ne+1)):D(ne=>ne+1)}e(J,"nextMonth");function dt(T){j?(T>=j?(t.onFrom(j),t.onTo(T)):(t.onFrom(T),t.onTo(j)),U(null),y(!1)):(U(T),H(T))}e(dt,"handleDayClick");function vt(T){let ne=$s(T);T==="all"?t.onClear():(t.onFrom(ne.from),t.onTo(ne.to)),U(null),y(!1)}e(vt,"applyPreset");function Ye(T){let ne=In(T.getFullYear(),T.getMonth(),T.getDate());se(ne),j&&H(ne),(T.getFullYear()!==w||T.getMonth()!==S)&&(g(T.getFullYear()),D(T.getMonth()))}e(Ye,"moveFocusToDate");function ke(T,ne){let Ze=hn(T);Ze&&Ye(new Date(Ze.year,Ze.monthIndex,Ze.day+ne))}e(ke,"moveFocus");let ut=t.from,at=t.to;j&&L&&(ut=j<=L?j:L,at=j<=L?L:j);let rn=Vs(w,S),zt=new Date,an=he||ut||In(zt.getFullYear(),zt.getMonth(),zt.getDate()),O=rn.map((T,ne)=>{let Ze=ut===T.dateStr,Yt=at===T.dateStr,mn=!!(ut&&at&&T.dateStr>ut&&T.dateStr<at),jn=T.year===zt.getFullYear()&&T.monthIndex===zt.getMonth()&&T.day===zt.getDate(),ht="dsham_dateDay";T.isOutside&&(ht+=" is-outside"),jn&&(ht+=" is-today"),Ze&&(ht+=" is-start"),Yt&&(ht+=" is-end"),mn&&(ht+=" is-in-range");let sn=!T.isOutside&&(T.dateStr===an||T.day===1&&!rn.some(re=>!re.isOutside&&re.dateStr===an));return r.createElement("div",{key:ne,className:ht,role:"button",tabIndex:sn?0:-1,"data-date":T.dateStr,"aria-label":T.dateStr,"aria-pressed":!!(Ze||Yt||mn),onClick:e(re=>{re.stopPropagation(),dt(T.dateStr)},"onClick"),onKeyDown:e(re=>{if(re.key==="Enter"||re.key===" ")re.preventDefault(),re.stopPropagation(),dt(T.dateStr);else if(re.key==="ArrowLeft")re.preventDefault(),re.stopPropagation(),ke(T.dateStr,-1);else if(re.key==="ArrowRight")re.preventDefault(),re.stopPropagation(),ke(T.dateStr,1);else if(re.key==="ArrowUp")re.preventDefault(),re.stopPropagation(),ke(T.dateStr,-7);else if(re.key==="ArrowDown")re.preventDefault(),re.stopPropagation(),ke(T.dateStr,7);else if(re.key==="Home"){re.preventDefault(),re.stopPropagation();let Ae=hn(T.dateStr);if(Ae){let bt=new Date(Ae.year,Ae.monthIndex,Ae.day),Nn=(bt.getDay()===0?7:bt.getDay())-1;bt.setDate(bt.getDate()-Nn),Ye(bt)}}else if(re.key==="End"){re.preventDefault(),re.stopPropagation();let Ae=hn(T.dateStr);if(Ae){let bt=new Date(Ae.year,Ae.monthIndex,Ae.day),Nn=(bt.getDay()===0?7:bt.getDay())-1;bt.setDate(bt.getDate()+(6-Nn)),Ye(bt)}}else if(re.key==="PageUp"){re.preventDefault(),re.stopPropagation();let Ae=hn(T.dateStr);Ae&&Ye(la(Ae.year,Ae.monthIndex,Ae.day,-1))}else if(re.key==="PageDown"){re.preventDefault(),re.stopPropagation();let Ae=hn(T.dateStr);Ae&&Ye(la(Ae.year,Ae.monthIndex,Ae.day,1))}},"onKeyDown"),onMouseEnter:e(()=>{j&&H(T.dateStr)},"onMouseEnter")},T.day)}),Ne=`${w}\u5E74 ${S+1}\u6708`;try{Ne=new Intl.DateTimeFormat(de,{year:"numeric",month:"long"}).format(new Date(w,S,1))}catch{Ne=V||ce?`${w}-${String(S+1).padStart(2,"0")}`:`${w}\u5E74 ${S+1}\u6708`}return r.createElement("div",{ref:c,className:"dsham_dateRange",role:"group","aria-label":t.label},r.createElement("input",{className:"dsham_dateInputSrOnly",type:"date",tabIndex:-1,"aria-hidden":!0,value:t.from,"aria-label":t.fromLabel,"aria-invalid":t.invalid||void 0,onChange:e(T=>i("from",T.target.value),"onChange")}),r.createElement("input",{className:"dsham_dateInputSrOnly",type:"date",tabIndex:-1,"aria-hidden":!0,value:t.to,"aria-label":t.toLabel,"aria-invalid":t.invalid||void 0,onChange:e(T=>i("to",T.target.value),"onChange")}),r.createElement("div",{className:"dsham_dateTrigger"+(k?" is-open":""),role:"button",tabIndex:0,"aria-expanded":k,"aria-controls":k?"dsham-date-popover":void 0,onClick:e(()=>{k&&U(null),y(!k)},"onClick"),onKeyDown:e(T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),k&&U(null),y(!k))},"onKeyDown")},qs(r.createElement),r.createElement("span",{className:"dsham_dateText"+(a?"":" placeholder")},o),a?r.createElement("button",{type:"button",className:"dsham_dateClearBtn","aria-label":"clear",title:"clear",onClick:e(T=>{T.stopPropagation(),t.onClear(),U(null)},"onClick"),children:"\xD7"}):null,r.createElement("span",{className:"dsham_dateChevron"},ua(r.createElement,k))),k&&r.createElement("div",{id:"dsham-date-popover",className:"dsham_datePopover",role:"region","aria-label":t.label,onClick:e(T=>T.stopPropagation(),"onClick")},r.createElement("div",{className:"dsham_datePresets"},r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>vt("all"),"onClick")},t.t?t.t("discovery.allTime"):"\u5168\u90E8\u65F6\u95F4"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>vt("today"),"onClick")},t.t?t.t("discovery.today"):"\u4ECA\u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>vt("7d"),"onClick")},t.t?t.t("discovery.last7Days"):"\u8FD1 7 \u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>vt("30d"),"onClick")},t.t?t.t("discovery.last30Days"):"\u8FD1 30 \u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>vt("90d"),"onClick")},t.t?t.t("discovery.last90Days"):"\u8FD1 90 \u5929")),r.createElement("div",{className:"dsham_dateCalendar"},r.createElement("div",{className:"dsham_dateCalHeader"},r.createElement("button",{type:"button",className:"dsham_dateNavBtn",onClick:te,"aria-label":"prev month"},"\u2039"),r.createElement("span",{className:"dsham_dateMonthTitle"},Ne),r.createElement("button",{type:"button",className:"dsham_dateNavBtn",onClick:J,"aria-label":"next month"},"\u203A")),r.createElement("div",{className:"dsham_dateGrid"},Xe.map((T,ne)=>r.createElement("div",{key:ne,className:"dsham_dateWeekday"},T))),r.createElement("div",{className:"dsham_dateGrid"},O))))}e(da,"DateRange");function Un(t){return W.createElement("div",{className:t.className},W.createElement("button",{type:"button",className:"dsham_disclosure","aria-expanded":t.open,onClick:t.onToggle},ua(W.createElement,t.open),t.title),t.open?W.createElement("div",null,t.children):null)}e(Un,"Disclosure");function ua(t,r){return t("svg",{className:"dsham_foldChevron"+(r?" is-open":""),viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":!0},t("path",{d:"M4 6l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"}))}e(ua,"foldChevron");function ir(t){let r=W.useRef(null);return W.useEffect(()=>{r.current&&(r.current.indeterminate=!!t.indeterminate&&!t.checked)},[t.indeterminate,t.checked]),W.createElement("input",{ref:r,className:"dsham_checkbox",type:"checkbox",checked:t.checked,disabled:t.disabled,"aria-label":t.label,onChange:e(i=>t.onChange({target:{checked:i.target.checked}}),"onChange")})}e(ir,"SelectionCheckbox");var _n=e(t=>{if(typeof t!="string"||!t.length||t.length>1024)throw new TypeError("\u4F1A\u8BDD ID \u65E0\u6548");return t},"id"),pa=e((t,r=!1)=>{if(typeof t!="string"||t.length>200||r&&!t.trim())throw new TypeError("\u5173\u952E\u8BCD\u987B\u4E3A 1\uFF5E200 \u4E2A\u5B57\u7B26");return t.trim()},"queryText"),ha={parse(t){let r=oe(t);if(!r||!Array.isArray(r.sessionIds)||!r.sessionIds.length||r.sessionIds.length>20)throw new TypeError("\u6BCF\u6B21\u68C0\u7D22\u987B\u5305\u542B 1\uFF5E20 \u4E2A\u4F1A\u8BDD");return{sessionIds:[...new Set(r.sessionIds.map(_n))],query:pa(r.query,!0)}}},Gs={parse(t){let r=oe(t);if(!r)throw new TypeError("\u9884\u89C8\u53C2\u6570\u65E0\u6548");return{sessionId:_n(r.sessionId),query:pa(r.query??"")}}},or=e((t,r)=>{if(typeof t!="string"||t.length>r)throw new TypeError("\u8FD4\u56DE\u6587\u672C\u65E0\u6548");return t},"boundedString"),ma=e(t=>{if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new TypeError("\u6D88\u606F\u5E8F\u53F7\u65E0\u6548");return t},"sequence"),lr={parse(t){let r=oe(t);if(!r||!Array.isArray(r.items)||!Array.isArray(r.failures)||r.items.length>20||r.failures.length>20)throw new TypeError("\u68C0\u7D22\u7ED3\u679C\u65E0\u6548");return{items:r.items.map(oe).map(i=>({sessionId:_n(i.sessionId),seq:ma(i.seq),snippet:or(i.snippet,400)})),failures:r.failures.map(oe).map(i=>({sessionId:_n(i.sessionId),message:or(i.message,500)}))}}},Ks={parse(t){let r=oe(t);if(!r||!Array.isArray(r.messages)||r.messages.length>8||typeof r.hasEarlier!="boolean"||typeof r.hasLater!="boolean")throw new TypeError("\u9884\u89C8\u7ED3\u679C\u65E0\u6548");return{sessionId:_n(r.sessionId),hasEarlier:r.hasEarlier,hasLater:r.hasLater,messages:r.messages.map(oe).map(i=>{if(typeof i.role!="string"||!["user","assistant"].includes(i.role)||typeof i.truncated!="boolean")throw new TypeError("\u6D88\u606F\u89D2\u8272\u6216\u622A\u65AD\u72B6\u6001\u65E0\u6548");return{seq:ma(i.seq),role:i.role,text:or(i.text,2e3),truncated:i.truncated}})}}};async function cr(t,r=globalThis.navigator?.clipboard){if(typeof t!="string"||!t)throw Object.assign(new Error("\u6CA1\u6709\u53EF\u590D\u5236\u7684\u5185\u5BB9"),{code:"copy.empty"});if(!r?.writeText)throw Object.assign(new Error("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u526A\u8D34\u677F\uFF0C\u8BF7\u5728 HTTPS \u6216\u672C\u673A\u5730\u5740\u4E2D\u6253\u5F00\u9875\u9762"),{code:"copy.unavailable"});try{await r.writeText(t)}catch{throw Object.assign(new Error("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u5141\u8BB8\u6D4F\u89C8\u5668\u8BBF\u95EE\u526A\u8D34\u677F\u540E\u91CD\u8BD5"),{code:"copy.denied"})}}e(cr,"copySessionText");function fa(){let t=e((i,a)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${i}`,create:e(()=>a,"create"),schema:a}),"codec");return[["searchSessionContent",ha,lr],["searchArchivedContent",ha,lr],["previewArchivedSession",Gs,Ks]].map(([i,a,o])=>({id:`@michengai/dsh-archive-manager#workspaceRegistry/${i}`,service:"workspaceRegistry",namespace:"workspaceRegistry",method:i,invocation:{kind:"direct"},parameters:[{name:"input",wire:"input",source:"json",codec:t(i+"Input",a)}],result:t(i+"Result",o),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(fa,"discoveryInvocations");function ga(t,r){let i=r?.trim().toLowerCase();if(!i)return null;let a=t.toLowerCase().indexOf(i);if(a<0)return null;let o=0,f=0,c;for(let k of t){let y=f+k.toLowerCase().length;if(c===void 0&&y>a&&(c=o),o+=k.length,y>=a+i.length)return{start:c??o,end:o};f=y}return null}e(ga,"findTextRange");function Wn(t,r=!1){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return NaN;let[i,a,o]=t.split("-").map(Number),f=new Date(i,a-1,o);return f.getFullYear()!==i||f.getMonth()!==a-1||f.getDate()!==o?NaN:(r&&f.setDate(f.getDate()+1),f.getTime())}e(Wn,"dayBoundary");function dr(t,r){return(!t||Number.isFinite(Wn(t)))&&(!r||Number.isFinite(Wn(r)))&&(!t||!r||t<=r)}e(dr,"validUpdatedRange");function va(t,r,i){if(!dr(r,i))return!1;if(!r&&!i)return!0;let a=typeof t=="number"?t:Date.parse(t??"");return Number.isFinite(a)&&(!r||a>=Wn(r))&&(!i||a<Wn(i,!0))}e(va,"matchesUpdatedRange");async function ba(t,r,i,{signal:a,onProgress:o}={}){let f=[],c=[],k=[...new Set(t)],y=e(()=>{if(a?.aborted)throw new Error("\u641C\u7D22\u5DF2\u53D6\u6D88")},"check");for(let I=0;I<k.length;I+=20){y();let w=lr.parse(await i({sessionIds:k.slice(I,I+20),query:r}));y(),f.push(...w.items),c.push(...w.failures),o?.({done:Math.min(I+20,k.length),total:k.length,items:[...f],failures:[...c]})}return y(),{items:f,failures:c}}e(ba,"searchArchiveBatches");function ya(t,r={}){let i=t.createElement;function a({text:g,query:S=""}){let D=ga(g,S);return D?i(t.Fragment,null,g.slice(0,D.start),i("mark",null,g.slice(D.start,D.end)),g.slice(D.end)):g}e(a,"HighlightedText");function o(g,S,D,j){let U=JSON.stringify(g),L=JSON.stringify([U,S]),[H,he]=t.useState(0),[se,V]=t.useState({key:"",status:"idle",items:[],failures:[]});return t.useEffect(()=>{if(!D||!S.trim()||!j)return;let de=new AbortController;V({key:L,status:"loading",items:[],failures:[],done:0,total:g.length});let Xe=setTimeout(()=>{ba(JSON.parse(U),S,j,{signal:de.signal,onProgress:e(te=>{de.signal.aborted||V({key:L,status:"loading",...te})},"onProgress")}).then(te=>{de.signal.aborted||V({key:L,status:"ready",done:g.length,total:g.length,...te})}).catch(te=>{de.signal.aborted||V(J=>({...J,key:L,status:"error",error:Ue(te)}))})},350);return()=>{de.abort(),clearTimeout(Xe)}},[U,S,D,j,H]),{...D&&S.trim()&&j?se.key===L?se:{key:L,status:"loading",items:[],failures:[],done:0,total:g.length}:{status:"idle",items:[],failures:[]},retry:e(()=>he(de=>de+1),"retry")}}e(o,"useArchiveSearch");function f(g,S){let[D,j]=t.useState(null),[U,L]=t.useState({status:"idle"}),[H,he]=t.useState(0),se=D,V=D&&S.includes(D.session.id);return t.useEffect(()=>{D&&!V&&j(null)},[D,V]),t.useEffect(()=>{if(!V||typeof window>"u")return;let ce=e(de=>{de.key==="Escape"&&(de.preventDefault(),de.stopPropagation(),de.stopImmediatePropagation(),j(null))},"onKeyDown");return window.addEventListener("keydown",ce,!0),()=>window.removeEventListener("keydown",ce,!0)},[V]),t.useEffect(()=>{if(!D||!V||!g)return;let ce=!0;return L({key:se,status:"loading"}),Promise.resolve().then(()=>g({sessionId:D.session.id,query:D.query})).then(de=>{ce&&L({key:se,status:"ready",value:de})}).catch(de=>{ce&&L({key:se,status:"error",error:Ue(de)})}),()=>{ce=!1}},[se,V,g,H]),{target:V?D:null,...U.key===se?U:{status:"loading"},open:e((ce,de="")=>j({session:ce,query:de}),"open"),close:e(()=>j(null),"close"),retry:e(()=>he(ce=>ce+1),"retry")}}e(f,"useArchivePreview");function c({title:g,failures:S,separator:D}){let[j,U]=t.useState(!1),L=i("ul",null,S.map(H=>i("li",{key:H.sessionId},H.sessionId,D,H.message)));return i(Un,{title:g,open:j,onToggle:e(()=>U(H=>!H),"onToggle")},L)}e(c,"FailureDetails");function k(g,S){let D=r.Button??(j=>i("button",{type:"button",disabled:j.disabled,onClick:j.onClick},j.children));return i(D,{variant:"outline",size:"sm",...S},g)}e(k,"textButton");function y({t:g,from:S,to:D,onFrom:j,onTo:U,invalid:L,onClear:H}){return i("div",{className:"dsham_dateFilter"},i(da,{React:t,from:S,to:D,invalid:L,label:g("discovery.date"),fromLabel:g("discovery.from"),toLabel:g("discovery.to"),onFrom:j,onTo:U,onClear:H,t:g}),L?i("p",{className:"dsham_dateAlert",role:"alert"},g("discovery.invalidDate")):null)}e(y,"DiscoveryFilters");function I({state:g,t:S}){return g.status==="idle"?null:i("div",{className:"dsham_discoveryStatus",role:"status","aria-live":"polite"},i("p",null,S(g.status==="loading"?"discovery.searching":g.status==="error"?"discovery.searchError":"discovery.searched",{done:g.done??0,total:g.total??0})),g.status==="error"&&i("p",null,g.error),g.failures.length>0&&i(c,{title:S("discovery.failed",{n:g.failures.length}),failures:g.failures,separator:S("common.separator")}),(g.status==="error"||g.status==="ready"&&g.failures.length>0)&&k(S("discovery.retry"),{onClick:g.retry}))}e(I,"SearchStatus");function w({preview:g,t:S,MarkdownText:D}){let[j,U]=t.useState(!1);if(g.status==="loading")return i("p",{role:"status"},S("discovery.loading"));if(g.status==="error")return i("div",null,i("p",{role:"alert"},g.error),k(S("discovery.retry"),{onClick:g.retry}));let L=g.value;return L?i("div",{className:"dsham_previewMessages"},i("div",{className:"dsham_previewToolbar"},i("span",{title:S("discovery.previewHint")},S("discovery.readOnly")," \xB7 ",S("discovery.messageCount",{n:L.messages.length})),D&&i(r.SegmentedControl??"div",{id:"dsham-preview-mode",label:S("discovery.displayMode"),value:j?"raw":"formatted",options:[{value:"formatted",label:S("discovery.formatted")},{value:"raw",label:S("discovery.raw")}],onChange:e(H=>U(H==="raw"),"onChange")})),L.hasEarlier&&i("p",null,S("discovery.earlier")),!L.messages.length&&i("p",null,S("discovery.empty")),L.messages.map(H=>i("article",{key:H.seq,className:"dsham_previewMessage"},i("div",{className:"dsham_previewRole","data-role":H.role},i("span",{"aria-hidden":!0},S(H.role==="user"?"discovery.you":"discovery.ai")),i("strong",null,S("discovery."+H.role))),j||!D?i("pre",{className:"dsham_previewRaw"},i(a,{text:H.text,query:g.target?.query})):i(D,{text:H.text,streaming:!1,labels:{code:{copyLabel:S("discovery.copyCode"),copiedLabel:S("details.copied")},footnotes:S("discovery.footnotes")}}),H.truncated&&i("small",null,S("discovery.truncated")))),L.hasLater&&i("p",null,S("discovery.later"))):null}return e(w,"PreviewContent"),{HighlightedText:a,useArchiveSearch:o,useArchivePreview:f,DiscoveryFilters:y,SearchStatus:I,PreviewContent:w}}e(ya,"createDiscoveryTools");var wa=[".dsham_dateFilter{display:flex;align-items:center;gap:8px;min-width:0;position:relative}",".dsham_dateAlert{position:absolute;top:calc(100% + 4px);right:0;margin:0;width:max-content;max-width:240px;padding:4px 8px;background:var(--dsw-alias-bg-layer-2);border:0.5px solid var(--dsw-alias-state-error-primary);border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,0.25);z-index:1100;font-size:12px;line-height:16px;color:var(--dsw-alias-state-error-primary);pointer-events:none}",".dsham_dateRange{position:relative;display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;box-sizing:border-box}",".dsham_dateTrigger{display:inline-flex;align-items:center;gap:6px;width:100%;height:32px;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;cursor:pointer;box-sizing:border-box;transition:all .15s ease}",".dsham_dateTrigger:hover{border-color:var(--dsw-alias-border-l3)}",".dsham_dateTrigger.is-open{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 1px var(--dsw-alias-state-business-primary)}",".dsham_dateIcon{flex:none;color:var(--dsw-alias-label-tertiary);display:flex;align-items:center}",".dsham_dateText{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;color:var(--dsw-alias-label-primary)}",".dsham_dateText.placeholder{color:var(--dsw-alias-label-primary)}",".dsham_dateClearBtn{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:50%;cursor:pointer;font-size:13px;line-height:1}",".dsham_dateClearBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".dsham_dateChevron{flex:none;color:var(--dsw-alias-label-tertiary);display:flex;align-items:center}",".dsham_dateInputSrOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",".dsham_datePopover{position:absolute;top:calc(100% + 4px);right:0;left:auto;z-index:1000;display:flex;gap:10px;padding:10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-layer-1);box-shadow:0 8px 24px rgba(0,0,0,0.12),0 2px 6px rgba(0,0,0,0.06);box-sizing:border-box}",".dsham_datePresets{width:84px;border-right:0.5px solid var(--dsw-alias-border-l2);padding-right:8px;display:flex;flex-direction:column;gap:3px;flex:none}",".dsham_datePresetBtn{border:0;background:transparent;padding:5px 6px;text-align:left;font:inherit;font-size:12px;color:var(--dsw-alias-label-secondary);border-radius:var(--dsw-radius-sm,6px);cursor:pointer;transition:all .15s ease;white-space:nowrap}",".dsham_datePresetBtn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",".dsham_dateCalendar{width:224px;display:flex;flex-direction:column;gap:6px;flex:none}",".dsham_dateCalHeader{display:flex;justify-content:space-between;align-items:center;padding:0 2px}",".dsham_dateMonthTitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary)}",".dsham_dateNavBtn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:14px;line-height:1}",".dsham_dateNavBtn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",".dsham_dateGrid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}",".dsham_dateWeekday{font-size:11px;color:var(--dsw-alias-label-tertiary);text-align:center;padding:3px 0;font-weight:500}",".dsham_dateDay{position:relative;height:26px;display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:0}",".dsham_dateDay.is-outside{color:var(--dsw-alias-label-quaternary)}",".dsham_dateDay:not(.is-outside):hover{background:var(--dsw-alias-interactive-bg-hover);border-radius:4px}",".dsham_dateDay.is-start{background:var(--dsw-alias-state-business-primary)!important;color:#fff!important;border-top-left-radius:6px;border-bottom-left-radius:6px}",".dsham_dateDay.is-end{background:var(--dsw-alias-state-business-primary)!important;color:#fff!important;border-top-right-radius:6px;border-bottom-right-radius:6px}",".dsham_dateDay.is-start.is-end{border-radius:6px!important}",".dsham_dateDay.is-in-range{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-state-business-primary)}",".dsham_dateDay.is-today::after{content:'';position:absolute;bottom:2px;width:3px;height:3px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}",".dsham_dateDay.is-start.is-today::after,.dsham_dateDay.is-end.is-today::after{background:#fff}",".dsham_discoveryStatus{font-size:12px;margin-bottom:12px;overflow-wrap:anywhere}",".dsham_settingsSnippet{display:block;width:100%;padding:0;margin:4px 0 0;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}",".dsham_previewMessages{max-height:65vh;overflow:auto;overflow-wrap:anywhere;padding-right:8px}",".dsham_previewToolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;color:var(--dsw-alias-label-secondary);font-size:12px}",".dsham_previewRole{display:flex;align-items:center;gap:8px;margin-bottom:12px;font-size:13px}",".dsham_previewRole>span{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--dsw-alias-bg-layer-3);font-size:11px}",".dsham_previewRole[data-role=user]>span{color:var(--dsw-alias-state-business-primary)}",".dsham_previewRaw{white-space:pre-wrap;font:13px/1.8 ui-monospace,monospace;overflow-wrap:anywhere}",".dsham_previewMessage pre:not(.dsham_previewRaw){white-space:pre;overflow-x:auto;max-width:100%}",".dsham_previewMessage table{display:block;max-width:100%;overflow-x:auto}",".dsham_previewMessage img{max-width:100%}","@media(max-width:520px){.dsham_previewToolbar{align-items:flex-start;flex-wrap:wrap}}",".dsham_previewMessage{padding:18px 0;border-bottom:1px solid var(--dsw-alias-border-l2)}",".dsham_previewMessage p{font-size:14px;line-height:1.8}",".dsham_previewHint,.dsham_previewMessage small{color:var(--dsw-alias-label-secondary);font-size:12px}",".dsham_settings mark,.dsham_previewMessages mark{background:var(--dsw-alias-state-warn-tertiary);color:inherit;border-radius:2px}",".dsham_settingsSnippet:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}"].join(""),Sa={"common.separator":"\uFF1A","copy.empty":"\u6CA1\u6709\u53EF\u590D\u5236\u7684\u5185\u5BB9","copy.unavailable":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u526A\u8D34\u677F\uFF0C\u8BF7\u5728 HTTPS \u6216\u672C\u673A\u5730\u5740\u4E2D\u6253\u5F00\u9875\u9762","copy.denied":"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u5141\u8BB8\u6D4F\u89C8\u5668\u8BBF\u95EE\u526A\u8D34\u677F\u540E\u91CD\u8BD5","discovery.you":"\u4F60","discovery.ai":"AI","discovery.readOnly":"\u53EA\u8BFB\u9884\u89C8","discovery.messageCount":"\u672C\u6B21\u663E\u793A {n} \u6761\u6D88\u606F","discovery.displayMode":"\u663E\u793A\u65B9\u5F0F","discovery.formatted":"\u6392\u7248","discovery.raw":"\u539F\u6587\u4E0E\u9AD8\u4EAE","discovery.copyCode":"\u590D\u5236\u4EE3\u7801","discovery.footnotes":"\u6CE8\u91CA","details.copyId":"\u590D\u5236\u4F1A\u8BDD ID","details.copied":"\u5DF2\u590D\u5236","discovery.date":"\u65E5\u671F","discovery.timeRange":"\u65F6\u95F4\u8303\u56F4","discovery.allTime":"\u5168\u90E8\u65F6\u95F4","discovery.today":"\u4ECA\u5929","discovery.last7Days":"\u8FD1 7 \u5929","discovery.last30Days":"\u8FD1 30 \u5929","discovery.last90Days":"\u8FD1 90 \u5929","discovery.customRange":"\u81EA\u5B9A\u4E49\u2026","discovery.dateActive":"\u65E5\u671F\xB7\u5DF2\u9009","discovery.clearDate":"\u6E05\u9664\u65E5\u671F","discovery.active":"\u5DF2\u542F\u7528","discovery.scope":"\u67E5\u627E\u8303\u56F4","discovery.titleOnly":"\u4EC5\u6807\u9898","discovery.titleAndContent":"\u6807\u9898\u4E0E\u6B63\u6587","discovery.from":"\u66F4\u65B0\u65F6\u95F4\u4ECE","discovery.to":"\u81F3","discovery.clear":"\u6E05\u9664\u6761\u4EF6","discovery.invalidDate":"\u5F00\u59CB\u65E5\u671F\u4E0D\u80FD\u665A\u4E8E\u7ED3\u675F\u65E5\u671F\uFF0C\u8BF7\u68C0\u67E5\u65E5\u671F\u8303\u56F4\u3002","discovery.searching":"\u6B63\u5728\u68C0\u7D22\u6B63\u6587\uFF1A{done} / {total}","discovery.searched":"\u6B63\u6587\u68C0\u7D22\u5B8C\u6210\uFF1A{done} / {total}","discovery.searchError":"\u6B63\u6587\u68C0\u7D22\u672A\u5B8C\u6210\uFF0C\u5F53\u524D\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002","discovery.failed":"{n} \u6761\u4F1A\u8BDD\u8BFB\u53D6\u5931\u8D25","discovery.retry":"\u91CD\u8BD5","discovery.preview":"\u5FEB\u901F\u9884\u89C8","discovery.loading":"\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u2026","discovery.previewHint":"\u53EA\u8BFB\u9884\u89C8\u539F\u59CB\u5BF9\u8BDD\u6587\u672C\uFF0C\u4E0D\u6062\u590D\u4F1A\u8BDD\uFF1B\u4E0D\u542B\u5DE5\u5177\u8F93\u51FA\u3001\u9644\u4EF6\u3001\u63A8\u7406\u548C\u7CFB\u7EDF\u5185\u5BB9\u3002","discovery.earlier":"\u524D\u9762\u8FD8\u6709\u6D88\u606F\uFF0C\u53EF\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u67E5\u770B\u3002","discovery.later":"\u540E\u9762\u8FD8\u6709\u6D88\u606F\uFF0C\u53EF\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u67E5\u770B\u3002","discovery.empty":"\u6CA1\u6709\u53EF\u9884\u89C8\u7684\u7528\u6237\u6216\u52A9\u624B\u6587\u672C\u3002","discovery.truncated":"\u672C\u6761\u4EC5\u663E\u793A\u90E8\u5206\u5185\u5BB9\u3002","discovery.user":"\u7528\u6237","discovery.assistant":"\u52A9\u624B","discovery.openFull":"\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD","discovery.searchPlaceholder":"\u641C\u7D22\u6807\u9898\u6216\u6B63\u6587"},xa={"common.separator":": ","copy.empty":"Nothing to copy","copy.unavailable":"Clipboard unavailable. Open the page over HTTPS or localhost.","copy.denied":"Copy failed. Allow clipboard access and retry.","discovery.you":"You","discovery.ai":"AI","discovery.readOnly":"Read-only preview","discovery.messageCount":"Showing {n} messages","discovery.displayMode":"Display mode","discovery.formatted":"Formatted","discovery.raw":"Source and highlights","discovery.copyCode":"Copy code","discovery.footnotes":"Footnotes","details.copyId":"Copy session ID","details.copied":"Copied","discovery.date":"Date","discovery.timeRange":"Time range","discovery.allTime":"All time","discovery.today":"Today","discovery.last7Days":"Past 7 days","discovery.last30Days":"Past 30 days","discovery.last90Days":"Past 90 days","discovery.customRange":"Custom\u2026","discovery.dateActive":"Date \xB7 Set","discovery.clearDate":"Clear dates","discovery.active":"Active","discovery.scope":"Search in","discovery.titleOnly":"Titles","discovery.titleAndContent":"Titles and content","discovery.from":"Updated from","discovery.to":"To","discovery.clear":"Clear filters","discovery.invalidDate":"Check the date range: the start must not be after the end.","discovery.searching":"Searching content: {done} / {total}","discovery.searched":"Content search complete: {done} / {total}","discovery.searchError":"Content search is incomplete; results may be missing.","discovery.failed":"Could not read {n} conversations","discovery.retry":"Retry","discovery.preview":"Quick preview","discovery.loading":"Reading conversation\u2026","discovery.previewHint":"Read-only original conversation text; keeps the conversation archived. Excludes tools, attachments, reasoning and system content.","discovery.earlier":"More messages before this preview. Open the full conversation to read them.","discovery.later":"More messages after this preview. Open the full conversation to read them.","discovery.empty":"No user or assistant text to preview.","discovery.truncated":"Only part of this message is shown.","discovery.user":"User","discovery.assistant":"Assistant","discovery.openFull":"Open full conversation","discovery.searchPlaceholder":"Search titles or content"},ka={"common.separator":": ","copy.empty":"\u041D\u0435\u0447\u0435\u0433\u043E \u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C","copy.unavailable":"\u0411\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u043F\u043E HTTPS \u0438\u043B\u0438 localhost.","copy.denied":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C. \u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u0434\u043E\u0441\u0442\u0443\u043F \u043A \u0431\u0443\u0444\u0435\u0440\u0443 \u043E\u0431\u043C\u0435\u043D\u0430 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435.","discovery.you":"\u0412\u044B","discovery.ai":"\u0418\u0418","discovery.readOnly":"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0447\u0442\u0435\u043D\u0438\u044F","discovery.messageCount":"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u043E \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439: {n}","discovery.displayMode":"\u0420\u0435\u0436\u0438\u043C \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","discovery.formatted":"\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043E","discovery.raw":"\u0418\u0441\u0445\u043E\u0434\u043D\u0438\u043A \u0438 \u043F\u043E\u0434\u0441\u0432\u0435\u0442\u043A\u0430","discovery.copyCode":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043A\u043E\u0434","discovery.footnotes":"\u0421\u043D\u043E\u0441\u043A\u0438","details.copyId":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C ID \u0441\u0435\u0441\u0441\u0438\u0438","details.copied":"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E","discovery.date":"\u0414\u0430\u0442\u0430","discovery.timeRange":"\u041F\u0435\u0440\u0438\u043E\u0434","discovery.allTime":"\u0412\u0441\u0435 \u0432\u0440\u0435\u043C\u044F","discovery.today":"\u0421\u0435\u0433\u043E\u0434\u043D\u044F","discovery.last7Days":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 7 \u0434\u043D\u0435\u0439","discovery.last30Days":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 30 \u0434\u043D\u0435\u0439","discovery.last90Days":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 90 \u0434\u043D\u0435\u0439","discovery.customRange":"\u0421\u0432\u043E\u0439 \u043F\u0435\u0440\u0438\u043E\u0434\u2026","discovery.dateActive":"\u0414\u0430\u0442\u0430 \xB7 \u0412\u044B\u0431\u0440\u0430\u043D\u0430","discovery.clearDate":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0434\u0430\u0442\u044B","discovery.active":"\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u043E","discovery.scope":"\u0418\u0441\u043A\u0430\u0442\u044C \u0432","discovery.titleOnly":"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u044F","discovery.titleAndContent":"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u044F \u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0435","discovery.from":"\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0441","discovery.to":"\u041F\u043E","discovery.clear":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B","discovery.invalidDate":"\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0434\u0430\u0442: \u043D\u0430\u0447\u0430\u043B\u043E \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043F\u043E\u0437\u0436\u0435 \u043A\u043E\u043D\u0446\u0430.","discovery.searching":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443: {done} / {total}","discovery.searched":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D: {done} / {total}","discovery.searchError":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443 \u043D\u0435\u043F\u043E\u043B\u043D\u044B\u0439; \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u043D\u0435\u043F\u043E\u043B\u043D\u044B\u043C\u0438.","discovery.failed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C {n} \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u043E\u0432","discovery.retry":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C","discovery.preview":"\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440","discovery.loading":"\u0427\u0442\u0435\u043D\u0438\u0435 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430\u2026","discovery.previewHint":"\u0422\u043E\u043B\u044C\u043A\u043E \u0447\u0442\u0435\u043D\u0438\u0435 \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0433\u043E \u0442\u0435\u043A\u0441\u0442\u0430 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430; \u0441\u0435\u0441\u0441\u0438\u044F \u043E\u0441\u0442\u0430\u0451\u0442\u0441\u044F \u0432 \u0430\u0440\u0445\u0438\u0432\u0435. \u0411\u0435\u0437 \u0432\u044B\u0432\u043E\u0434\u0430 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u043E\u0432, \u0432\u043B\u043E\u0436\u0435\u043D\u0438\u0439, \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0439 \u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u043E\u0433\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0433\u043E.","discovery.earlier":"\u041F\u0435\u0440\u0435\u0434 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u043E\u043C \u0435\u0441\u0442\u044C \u0435\u0449\u0451 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440, \u0447\u0442\u043E\u0431\u044B \u0438\u0445 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C.","discovery.later":"\u041F\u043E\u0441\u043B\u0435 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430 \u0435\u0441\u0442\u044C \u0435\u0449\u0451 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440, \u0447\u0442\u043E\u0431\u044B \u0438\u0445 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C.","discovery.empty":"\u041D\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u0438\u043B\u0438 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u0430 \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430.","discovery.truncated":"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u0430 \u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0430\u0441\u0442\u044C \u044D\u0442\u043E\u0433\u043E \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F.","discovery.user":"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C","discovery.assistant":"\u0410\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442","discovery.openFull":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440","discovery.searchPlaceholder":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F\u043C \u0438\u043B\u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443"};var Ca=e(t=>{let r=oe(t);if(!r||typeof r.sessionId!="string"||!r.sessionId.length||r.sessionId.length>1024||typeof r.identity!="string"||!r.identity.length||r.identity.length>4096)throw new TypeError("invalid cache rebuild candidate");return{sessionId:r.sessionId,identity:r.identity}},"candidate"),Ys={parse(t){let r=oe(t);if(!r||!Array.isArray(r.items)||!r.items.length||r.items.length>20)throw new TypeError("invalid cache rebuild batch (1\u201320 items required)");return{items:r.items.map(Ca)}}},ur={parse(t){let r=oe(t);if(!r||!Array.isArray(r.items)||r.count!==r.items.length)throw new TypeError("invalid cache diagnosis");return{count:r.items.length,items:r.items.map(Ca)}}},hr={parse(t){let r=oe(t);for(let i of["rebuiltSessionIds","skippedSessionIds"])if(!Array.isArray(r?.[i])||r[i].some(a=>typeof a!="string"))throw new TypeError("invalid cache rebuild result");if(!Array.isArray(r.failures)||r.failures.some(i=>!i||typeof i.sessionId!="string"||typeof i.message!="string"))throw new TypeError("invalid cache rebuild failures");return r}};function Ea(){let t=e((r,i)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${r}`,create:e(()=>i,"create"),schema:i}),"codec");return[{method:"diagnoseSessionCaches",parameters:[],result:t("CacheDiagnosis",ur)},{method:"rebuildSessionCaches",parameters:[{name:"input",wire:"input",source:"json",codec:t("CacheRebuildInput",Ys)}],result:t("CacheRebuildResult",hr)}].map(({method:r,...i})=>({id:`@michengai/dsh-archive-manager#workspaceRegistry/${r}`,service:"workspaceRegistry",namespace:"workspaceRegistry",method:r,invocation:{kind:"direct"},...i,sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(Ea,"cacheRebuildInvocations");function Ta(t,r={}){let{maxLoadRetries:i=3,retryDelayMs:a=200}=r,o={diagnosis:{count:0,items:[]},busy:!1,progress:null,result:null,error:null,refreshError:null},f=!0,c=0,k=[],y,I=new Set,w=e(S=>{if(f){o={...o,...S};for(let D of I)D()}},"update"),g=e(async(S=i)=>{if(!f)return;y!==void 0&&(clearTimeout(y),y=void 0);let D=++c;try{let j=ur.parse(await t.diagnose());f&&D===c&&w({diagnosis:j,error:null})}catch(j){if(S>0&&f&&D===c){y=setTimeout(()=>{y=void 0,f&&D===c&&g(S-1)},a);return}f&&D===c&&w({error:Ue(j)})}},"load");return{snapshot:e(()=>o,"snapshot"),subscribe(S){return I.add(S),()=>{I.delete(S)}},load:g,async run(S=!1){if(!f||o.busy)return;++c,y!==void 0&&(clearTimeout(y),y=void 0);let D=S?[...k]:[...o.diagnosis.items],j={rebuiltSessionIds:[],skippedSessionIds:[],failures:[]};k=[],w({busy:!0,result:null,error:null,refreshError:null,progress:{done:0,total:D.length}});for(let[U,L]of D.entries()){if(!f)return;try{let H=hr.parse(await t.rebuild({items:[L]}));if(!f)return;j.rebuiltSessionIds.push(...H.rebuiltSessionIds),j.skippedSessionIds.push(...H.skippedSessionIds),j.failures.push(...H.failures),H.failures.length&&k.push(L)}catch(H){if(!f)return;j.failures.push({sessionId:L.sessionId,message:Ue(H)}),k.push(L)}w({progress:{done:U+1,total:D.length}})}w({result:j});try{await t.refresh()}catch(U){w({refreshError:Ue(U)})}f&&(await g(),w({busy:!1,progress:null}))},dismiss(){f&&w({result:null,error:null,refreshError:null})},dispose(){f=!1,++c,y!==void 0&&(clearTimeout(y),y=void 0),I.clear()}}}e(Ta,"createCacheRebuildController");var Kt=class extends Error{static{e(this,"ArchiveNavigationError")}code;constructor(r){super(r),this.name="ArchiveNavigationError",this.code=r}};function Ia(t,r){return t instanceof Kt?r(`archives.${t.code}`):Ue(t)}e(Ia,"formatArchiveNavigationError");function Zs(t,r){if(typeof t?.retainInfo!="function")return;let i=t.retainInfo(r),a=i&&typeof i=="object"&&"getSnapshot"in i&&typeof i.getSnapshot=="function"?i.getSnapshot():i;if(!a||typeof a!="object"||!("retainedBy"in a))return;let o=a.retainedBy;if(!(!o||typeof o!="object"||!("mainView"in o)||typeof o.mainView!="number"))return{retainedBy:{mainView:o.mainView}}}e(Zs,"retainInfoSnapshot");function Js(t){let r=t?.byId;if(r!==void 0){for(let i of Object.values(r))if(i&&(i.retainedBy?.mainView??0)>0)return i.id}}e(Js,"mainViewSessionId");function qn(t){return Js(t)}e(qn,"currentSessionId");function Xs(t,r,i){return r===void 0||r===""?!1:(t?.byId?.[r]?.retainedBy?.mainView??0)>0||(Zs(i,r)?.retainedBy?.mainView??0)>0}e(Xs,"sessionIsCurrent");async function _a(t,r,i,a=()=>!0){if(i){if(typeof t.prepare=="function"&&await t.prepare(r),!a())return;await t.restore(r)}a()&&await t.open(r)}e(_a,"openArchivedConversation");function Aa(t,r,i,{onOpened:a=e(()=>{},"onOpened"),beginNavigation:o,warn:f=e((...c)=>console.warn(...c),"warn")}={}){let c,k=t?.clearArchivedCurrent,y=t&&Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent"),I=e(S=>Xs(r.list.getSnapshot(),S,r),"viewing"),w=e(function(...S){return c!==void 0&&I(c)&&i.list.getSnapshot().archivedSessionIds.includes(c)?!1:(c=void 0,k?.apply(this,S))},"wrapped"),g=e(()=>t&&Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent")?.value===w,"ownsWrapper");if(t&&typeof k=="function")try{if(t.clearArchivedCurrent=w,!g())throw new Error("\u5BFC\u822A\u65B9\u6CD5\u672A\u63A5\u7EB3\u5F52\u6863\u9002\u914D")}catch(S){f("archive-manager: \u65E0\u6CD5\u9002\u914D\u5F52\u6863\u5BFC\u822A\uFF0C\u8BF7\u6062\u590D\u4F1A\u8BDD\u540E\u6253\u5F00\u3002",S)}return{open(S){c=S;try{if(typeof k=="function"&&!g()&&i.list.getSnapshot().archivedSessionIds.includes(S))throw f("archive-manager: \u5F52\u6863\u5BFC\u822A\u9002\u914D\u4E0D\u53EF\u7528\u6216\u5DF2\u88AB\u66FF\u6362\u3002"),new Kt("navigationUnavailable");if(o?.(),typeof t?.openSession!="function")throw f("archive-manager: \u5BBF\u4E3B\u672A\u63D0\u4F9B\u4F1A\u8BDD\u6253\u5F00\u63A5\u53E3\u3002"),new Kt("navigationUnavailable");if(t.openSession(S),!I(S))throw f("archive-manager: \u5BBF\u4E3B\u672A\u4FDD\u7559\u76EE\u6807\u4F1A\u8BDD\u3002",{cleanupAvailable:typeof k=="function"}),new Kt("sessionNotRetained");a()}catch(D){throw c=void 0,D}},dispose(){c=void 0,!(!t||Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent")?.value!==w)&&(y?Object.defineProperty(t,"clearArchivedCurrent",y):delete t.clearArchivedCurrent,k?.call(t))}}}e(Aa,"allowArchivedNavigation");var tn=require("@deepseek-ai/dsh-client-ui-primitives");var Ra={check:"\u68C0\u67E5\u66F4\u65B0",update:"\u66F4\u65B0",recheck:"\u91CD\u65B0\u68C0\u67E5",auto:"\u81EA\u52A8\u66F4\u65B0",updating:"\u6B63\u5728\u66F4\u65B0\u2026",copy:"\u590D\u5236\u547D\u4EE4",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",checking:"\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",latest:"\u5DF2\u662F\u6700\u65B0\u7248\u672C",found:"\u53D1\u73B0\u65B0\u7248\u672C",failed:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",current:"\u8FD0\u884C\u7248\u672C",latestLabel:"\u6700\u65B0\u7248\u672C",profile:"\u76EE\u6807 profile",unknown:"\u672A\u77E5",manual:"\u624B\u5DE5\u66F4\u65B0",manualHint:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u53EF\u5728\u5F53\u524D DSH \u7EC8\u7AEF\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF0C\u5B8C\u6210\u540E\u91CD\u542F DSH Web\u3002",manualHintDesktop:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u8BF7\u5148\u5B8C\u5168\u9000\u51FA DSH Desktop\uFF0C\u518D\u7528 Desktop \u81EA\u5E26\u7684 dsh \u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u3002\u666E\u901A dsh \u4F1A\u62D2\u7EDD desktop profile\u3002",intro:"\u4EC5\u68C0\u67E5\u5E76\u66F4\u65B0\u5F53\u524D\u63D2\u4EF6\uFF0C\u4E0D\u4F1A\u8054\u52A8\u5B89\u88C5\u5176\u4ED6\u63D2\u4EF6\u3002",restart:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u91CD\u542F DSH Web\u3002",restartDesktop:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00 DSH Desktop\u3002",restarting:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u542F DSH Desktop\u2026",unavailable:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u81EA\u52A8\u66F4\u65B0\uFF0C\u8BF7\u4F7F\u7528\u624B\u5DE5\u66F4\u65B0\u547D\u4EE4\u3002"},ja={check:"Check for updates",update:"Update",recheck:"Check again",auto:"Update automatically",updating:"Updating\u2026",copy:"Copy command",copied:"Copied",copyFailed:"Copy failed",checking:"Checking for updates\u2026",latest:"You are up to date",found:"New version available",failed:"Could not check for updates. Try again later.",current:"Running version",latestLabel:"Latest version",profile:"Target profile",unknown:"Unknown",manual:"Manual update",manualHint:"If automatic update fails, run this command in the current DSH terminal, then restart DSH Web.",manualHintDesktop:"If automatic update fails, fully quit DSH Desktop, then run this command with Desktop's own dsh. A regular dsh rejects the desktop profile.",intro:"Only this plugin is checked and updated. Other plugins are not changed.",restart:"Update complete. Restart DSH Web.",restartDesktop:"Update complete. Fully quit and reopen DSH Desktop.",restarting:"Update complete. Restarting DSH Desktop\u2026",unavailable:"Automatic update is unavailable. Use the manual command."};function An(t){return t.toLowerCase().startsWith("zh")?Ra:ja}e(An,"pluginUpdateCopy");function Qs(t,r,i,a){let o=An(t),f=r?.restartDesktop===!0||r?.profileName==="desktop",c=f?{...o,manualHint:o.manualHintDesktop}:o,k=i!=="idle",y=c.checking,I="";return i==="checking"?y=c.checking:i==="updating"?y=c.updating:a.type==="error"?(y=a.message||c.failed,I="error"):a.type==="restart"?(y=f?c.restartDesktop:c.restart,I="success"):a.type==="restarting"?(y=c.restarting,I="success"):r===void 0?y=c.checking:r.latestCheckFailed?(y=c.failed,I="error"):!r.canAutoUpdate&&r.updateAvailable?(y=c.unavailable,I="update"):r.updateAvailable?(y=`${c.found}: v${r.latestVersion??c.unknown}`,I="update"):(y=c.latest,I="success"),{copy:c,busy:k,message:y,kind:I,loading:i==="updating",updateLabel:i==="updating"?c.updating:c.auto,disabled:k||r?.canAutoUpdate!==!0||r.updateAvailable!==!0,currentVersion:r===void 0?c.unknown:`v${r.currentVersion}`,latestVersion:r?.latestVersion===void 0?c.unknown:`v${r.latestVersion}`,profileName:r?.profileName??c.unknown,profileRaw:r?.profileName??"",latestRaw:r?.latestVersion??"latest"}}e(Qs,"describePluginUpdate");function Na(t,r,i){let a="idle",o=r,f={type:"status"},c=0,k=new Set,y=e(()=>{for(let w of k)w()},"emit"),I=e(w=>{o=w,i?.(w)},"assign");return{get posts(){return c},subscribe(w){return k.add(w),()=>{k.delete(w)}},view(w){return Qs(w,o,a,f)},async check(){if(a==="idle"){a="checking",f={type:"status"},y();try{I(await t("GET")),f={type:"status"}}catch(w){f={type:"error",message:w instanceof Error?w.message:""}}finally{a="idle",y()}}},async update(){if(a==="idle"){a="updating",f={type:"status"},c+=1,y();try{let w=await t("POST");I(w),f={type:w.autoReload===!0?"restarting":"restart"}}catch(w){f={type:"error",message:w instanceof Error?w.message:""}}finally{a="idle",y()}}}}}e(Na,"createUpdateFlow");function Da(t,r,i){return`dsh plugin${t.trim()===""?"":` --profile ${t.trim()}`} add ${r}@${i} --registry=https://registry.npmjs.org/`}e(Da,"manualPluginUpdateCommand");function Ma(t,r){return t.key!=="Escape"?!1:(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r(),!0)}e(Ma,"handlePluginUpdateEscape");function ei(){let t=globalThis.document;if(typeof t>"u"||t===null)return;let r=t.baseURI;if(!(typeof r!="string"||r===""))try{let i=new URL(r),a=i.pathname.lastIndexOf("/"),o=i.pathname.slice(a+1);return/\.(html?|php|aspx?|jsp)$/i.test(o)?i.pathname=i.pathname.slice(0,a+1):i.pathname.endsWith("/")||(i.pathname+="/"),i.href}catch{return}}e(ei,"pageBaseHref");function Rn(t){if(typeof t!="string"||t.charAt(0)!=="/"||t.charAt(1)==="/")return t;let r=ei();if(r===void 0)return t;try{return new URL(t.slice(1),r).href}catch{return t}}e(Rn,"resolveApiUrl");function za(t){let i=Function("return globalThis.__dshArchiveReactDOMClient")()?.createRoot;if(i===void 0)throw new Error("createRoot unavailable");return i(t)}e(za,"mountRoot");var ti="x-michengai-plugin-update",La="michengai-plugin-update-ui",pr=`
|
|
10
|
+
"use strict";var Un=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Fs=Object.prototype.hasOwnProperty;var e=(t,r)=>Un(t,"name",{value:r,configurable:!0});var Bs=(t,r)=>{for(var i in r)Un(t,i,{get:r[i],enumerable:!0})},Hs=(t,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Os(r))!Fs.call(t,o)&&o!==i&&Un(t,o,{get:()=>r[o],enumerable:!(a=Ps(r,o))||a.enumerable});return t};var Us=t=>Hs(Un({},"__esModule",{value:!0}),t);var mi={};Bs(mi,{startArchiveClient:()=>pi});module.exports=Us(mi);function le(t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("\u53C2\u6570\u5FC5\u987B\u4E3A\u5BF9\u8C61");return t}e(le,"record");function Fe(t){return String(t&&typeof t=="object"&&"message"in t?t.message??t:t)}e(Fe,"errorMessage");function Wn(t){return t&&typeof t=="object"&&"code"in t?t.code:void 0}e(Wn,"errorCode");var sa=Function("return globalThis.__dshArchiveReact")(),{Children:bi,Component:yi,Fragment:ia,Profiler:wi,PureComponent:Si,StrictMode:xi,Suspense:ki,cloneElement:Ci,createContext:Ei,createElement:oa,createRef:Ii,forwardRef:Ti,isValidElement:Ai,lazy:_i,memo:Ri,startTransition:ji,useCallback:Ni,useContext:Di,useDebugValue:Mi,useDeferredValue:Li,useEffect:la,useId:zi,useImperativeHandle:Pi,useInsertionEffect:Oi,useLayoutEffect:Fi,useMemo:Bi,useReducer:Hi,useRef:Ui,useState:Ut,useSyncExternalStore:Wi,useTransition:qi,version:Vi}=sa,q=sa;function da(t){return q.createElement("input",{className:"dsham_number",type:"number",min:t.min,max:t.max,value:t.value??"",disabled:t.disabled,"aria-label":t["aria-label"],onChange:e(r=>{let i=r.target.value;if(i===""){t.onChange(null);return}let a=Number(i);t.onChange(Number.isNaN(a)?null:a)},"onChange")})}e(da,"NumberField");function qs(t=q.createElement){return t("svg",{className:"dsham_dateIcon",width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.25,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},t("rect",{x:2,y:3,width:12,height:11,rx:2}),t("line",{x1:2,y1:6.5,x2:14,y2:6.5}),t("line",{x1:5.5,y1:1.5,x2:5.5,y2:3.5}),t("line",{x1:10.5,y1:1.5,x2:10.5,y2:3.5}))}e(qs,"CalendarIcon");function _n(t,r,i){let a=String(r+1).padStart(2,"0"),o=String(i).padStart(2,"0");return`${t}-${a}-${o}`}e(_n,"formatYmd");function pn(t){let r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);return r?{year:Number(r[1]),monthIndex:Number(r[2])-1,day:Number(r[3])}:null}e(pn,"parseYmd");function Vs(t,r){let i=new Date(t,r,1).getDay(),a=(i===0?7:i)-1,o=new Date(t,r+1,0).getDate(),f=new Date(t,r,0).getDate(),c=[];for(let k=0;k<42;k++){let y=t,A=r,w=0,g=!1;k<a?(w=f-a+k+1,A=r-1,A<0&&(A=11,y--),g=!0):k<a+o?w=k-a+1:(w=k-a-o+1,A=r+1,A>11&&(A=0,y++),g=!0),c.push({year:y,monthIndex:A,day:w,dateStr:_n(y,A,w),isOutside:g})}return c}e(Vs,"buildMonthGrid");function $s(t,r=new Date){if(t==="all")return{from:"",to:""};let i=_n(r.getFullYear(),r.getMonth(),r.getDate());if(t==="today")return{from:i,to:i};let a=t==="7d"?6:t==="30d"?29:89,o=new Date(r.getTime()-a*864e5);return{from:_n(o.getFullYear(),o.getMonth(),o.getDate()),to:i}}e($s,"getPresetRange");function ca(t,r,i,a){let o=r+a,f=new Date(t,o+1,0).getDate();return new Date(t,o,Math.min(i,f))}e(ca,"shiftMonthClamped");function ua(t){let r=t.React||q;function i(T,re){let Ye=T==="from"?re:t.from,Yt=T==="to"?re:t.to;if(Ye===""&&Yt===""){t.onClear();return}T==="from"?t.onFrom(re):t.onTo(re)}e(i,"change");let a=!!(t.from||t.to),o="";t.from&&t.to?o=`${t.from} \u2013 ${t.to}`:t.from?o=`${t.from} \u2013`:t.to?o=`\u2013 ${t.to}`:o=t.t?t.t("discovery.timeRange")||`${t.fromLabel} \u2013 ${t.toLabel}`:`${t.fromLabel} \u2013 ${t.toLabel}`;let c=(r.useRef??(T=>{let[re]=r.useState({current:T});return re}))(null),[k,y]=r.useState(!1),A=pn(t.from||t.to)??{year:new Date().getFullYear(),monthIndex:new Date().getMonth(),day:new Date().getDate()},[w,g]=r.useState(A.year),[S,D]=r.useState(A.monthIndex),[j,W]=r.useState(null),[z,U]=r.useState(null),[pe,ie]=r.useState(null);r.useEffect(()=>{if(!k)return;let T=e(Ye=>{c.current&&!c.current.contains(Ye.target)&&(y(!1),W(null))},"onPointerDown"),re=e(Ye=>{Ye.key==="Escape"&&(Ye.preventDefault(),Ye.stopPropagation(),y(!1),W(null))},"onKeyDown");return typeof document<"u"&&document.addEventListener("mousedown",T,!0),typeof window<"u"&&window.addEventListener("keydown",re,!0),()=>{typeof document<"u"&&document.removeEventListener("mousedown",T,!0),typeof window<"u"&&window.removeEventListener("keydown",re,!0)}},[k]),r.useEffect(()=>{if(!k||!pe||!c.current)return;c.current.querySelector(`[data-date="${pe}"]`)?.focus()},[k,pe]);let $=t.t?t.t("discovery.today")==="Today"||(t.t("locale.language")||"").startsWith("en"):!1,ue=t.t?t.t("discovery.today")==="\u0421\u0435\u0433\u043E\u0434\u043D\u044F"||(t.t("locale.language")||"").startsWith("ru"):!1,he=$?"en-US":ue?"ru-RU":"zh-CN",Qe=$?["Mo","Tu","We","Th","Fr","Sa","Su"]:ue?["\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431","\u0412\u0441"]:["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u65E5"];function ne(T){T.stopPropagation(),S<=0?(D(11),g(re=>re-1)):D(re=>re-1)}e(ne,"prevMonth");function Q(T){T.stopPropagation(),S>=11?(D(0),g(re=>re+1)):D(re=>re+1)}e(Q,"nextMonth");function pt(T){j?(T>=j?(t.onFrom(j),t.onTo(T)):(t.onFrom(T),t.onTo(j)),W(null),y(!1)):(W(T),U(T))}e(pt,"handleDayClick");function xt(T){let re=$s(T);T==="all"?t.onClear():(t.onFrom(re.from),t.onTo(re.to)),W(null),y(!1)}e(xt,"applyPreset");function Ke(T){let re=_n(T.getFullYear(),T.getMonth(),T.getDate());ie(re),j&&U(re),(T.getFullYear()!==w||T.getMonth()!==S)&&(g(T.getFullYear()),D(T.getMonth()))}e(Ke,"moveFocusToDate");function ke(T,re){let Ye=pn(T);Ye&&Ke(new Date(Ye.year,Ye.monthIndex,Ye.day+re))}e(ke,"moveFocus");let mt=t.from,ot=t.to;j&&z&&(mt=j<=z?j:z,ot=j<=z?z:j);let nn=Vs(w,S),Pt=new Date,rn=pe||mt||_n(Pt.getFullYear(),Pt.getMonth(),Pt.getDate()),O=nn.map((T,re)=>{let Ye=mt===T.dateStr,Yt=ot===T.dateStr,gn=!!(mt&&ot&&T.dateStr>mt&&T.dateStr<ot),Nn=T.year===Pt.getFullYear()&&T.monthIndex===Pt.getMonth()&&T.day===Pt.getDate(),ft="dsham_dateDay";T.isOutside&&(ft+=" is-outside"),Nn&&(ft+=" is-today"),Ye&&(ft+=" is-start"),Yt&&(ft+=" is-end"),gn&&(ft+=" is-in-range");let an=!T.isOutside&&(T.dateStr===rn||T.day===1&&!nn.some(ae=>!ae.isOutside&&ae.dateStr===rn));return r.createElement("div",{key:re,className:ft,role:"button",tabIndex:an?0:-1,"data-date":T.dateStr,"aria-label":T.dateStr,"aria-pressed":!!(Ye||Yt||gn),onClick:e(ae=>{ae.stopPropagation(),pt(T.dateStr)},"onClick"),onKeyDown:e(ae=>{if(ae.key==="Enter"||ae.key===" ")ae.preventDefault(),ae.stopPropagation(),pt(T.dateStr);else if(ae.key==="ArrowLeft")ae.preventDefault(),ae.stopPropagation(),ke(T.dateStr,-1);else if(ae.key==="ArrowRight")ae.preventDefault(),ae.stopPropagation(),ke(T.dateStr,1);else if(ae.key==="ArrowUp")ae.preventDefault(),ae.stopPropagation(),ke(T.dateStr,-7);else if(ae.key==="ArrowDown")ae.preventDefault(),ae.stopPropagation(),ke(T.dateStr,7);else if(ae.key==="Home"){ae.preventDefault(),ae.stopPropagation();let _e=pn(T.dateStr);if(_e){let kt=new Date(_e.year,_e.monthIndex,_e.day),Dn=(kt.getDay()===0?7:kt.getDay())-1;kt.setDate(kt.getDate()-Dn),Ke(kt)}}else if(ae.key==="End"){ae.preventDefault(),ae.stopPropagation();let _e=pn(T.dateStr);if(_e){let kt=new Date(_e.year,_e.monthIndex,_e.day),Dn=(kt.getDay()===0?7:kt.getDay())-1;kt.setDate(kt.getDate()+(6-Dn)),Ke(kt)}}else if(ae.key==="PageUp"){ae.preventDefault(),ae.stopPropagation();let _e=pn(T.dateStr);_e&&Ke(ca(_e.year,_e.monthIndex,_e.day,-1))}else if(ae.key==="PageDown"){ae.preventDefault(),ae.stopPropagation();let _e=pn(T.dateStr);_e&&Ke(ca(_e.year,_e.monthIndex,_e.day,1))}},"onKeyDown"),onMouseEnter:e(()=>{j&&U(T.dateStr)},"onMouseEnter")},T.day)}),je=`${w}\u5E74 ${S+1}\u6708`;try{je=new Intl.DateTimeFormat(he,{year:"numeric",month:"long"}).format(new Date(w,S,1))}catch{je=$||ue?`${w}-${String(S+1).padStart(2,"0")}`:`${w}\u5E74 ${S+1}\u6708`}return r.createElement("div",{ref:c,className:"dsham_dateRange",role:"group","aria-label":t.label},r.createElement("input",{className:"dsham_dateInputSrOnly",type:"date",tabIndex:-1,"aria-hidden":!0,value:t.from,"aria-label":t.fromLabel,"aria-invalid":t.invalid||void 0,onChange:e(T=>i("from",T.target.value),"onChange")}),r.createElement("input",{className:"dsham_dateInputSrOnly",type:"date",tabIndex:-1,"aria-hidden":!0,value:t.to,"aria-label":t.toLabel,"aria-invalid":t.invalid||void 0,onChange:e(T=>i("to",T.target.value),"onChange")}),r.createElement("div",{className:"dsham_dateTrigger"+(k?" is-open":""),role:"button",tabIndex:0,"aria-expanded":k,"aria-controls":k?"dsham-date-popover":void 0,onClick:e(()=>{k&&W(null),y(!k)},"onClick"),onKeyDown:e(T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),k&&W(null),y(!k))},"onKeyDown")},qs(r.createElement),r.createElement("span",{className:"dsham_dateText"+(a?"":" placeholder")},o),a?r.createElement("button",{type:"button",className:"dsham_dateClearBtn","aria-label":"clear",title:"clear",onClick:e(T=>{T.stopPropagation(),t.onClear(),W(null)},"onClick"),children:"\xD7"}):null,r.createElement("span",{className:"dsham_dateChevron"},ha(r.createElement,k))),k&&r.createElement("div",{id:"dsham-date-popover",className:"dsham_datePopover",role:"region","aria-label":t.label,onClick:e(T=>T.stopPropagation(),"onClick")},r.createElement("div",{className:"dsham_datePresets"},r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>xt("all"),"onClick")},t.t?t.t("discovery.allTime"):"\u5168\u90E8\u65F6\u95F4"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>xt("today"),"onClick")},t.t?t.t("discovery.today"):"\u4ECA\u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>xt("7d"),"onClick")},t.t?t.t("discovery.last7Days"):"\u8FD1 7 \u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>xt("30d"),"onClick")},t.t?t.t("discovery.last30Days"):"\u8FD1 30 \u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>xt("90d"),"onClick")},t.t?t.t("discovery.last90Days"):"\u8FD1 90 \u5929")),r.createElement("div",{className:"dsham_dateCalendar"},r.createElement("div",{className:"dsham_dateCalHeader"},r.createElement("button",{type:"button",className:"dsham_dateNavBtn",onClick:ne,"aria-label":"prev month"},"\u2039"),r.createElement("span",{className:"dsham_dateMonthTitle"},je),r.createElement("button",{type:"button",className:"dsham_dateNavBtn",onClick:Q,"aria-label":"next month"},"\u203A")),r.createElement("div",{className:"dsham_dateGrid"},Qe.map((T,re)=>r.createElement("div",{key:re,className:"dsham_dateWeekday"},T))),r.createElement("div",{className:"dsham_dateGrid"},O))))}e(ua,"DateRange");function qn(t){return q.createElement("div",{className:t.className},q.createElement("button",{type:"button",className:"dsham_disclosure","aria-expanded":t.open,onClick:t.onToggle},ha(q.createElement,t.open),t.title),t.open?q.createElement("div",null,t.children):null)}e(qn,"Disclosure");function ha(t,r){return t("svg",{className:"dsham_foldChevron"+(r?" is-open":""),viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":!0},t("path",{d:"M4 6l4 4 4-4",strokeLinecap:"round",strokeLinejoin:"round"}))}e(ha,"foldChevron");function lr(t){let r=q.useRef(null);return q.useEffect(()=>{r.current&&(r.current.indeterminate=!!t.indeterminate&&!t.checked)},[t.indeterminate,t.checked]),q.createElement("input",{ref:r,className:"dsham_checkbox",type:"checkbox",checked:t.checked,disabled:t.disabled,"aria-label":t.label,onChange:e(i=>t.onChange({target:{checked:i.target.checked}}),"onChange")})}e(lr,"SelectionCheckbox");var Rn=e(t=>{if(typeof t!="string"||!t.length||t.length>1024)throw new TypeError("\u4F1A\u8BDD ID \u65E0\u6548");return t},"id"),ma=e((t,r=!1)=>{if(typeof t!="string"||t.length>200||r&&!t.trim())throw new TypeError("\u5173\u952E\u8BCD\u987B\u4E3A 1\uFF5E200 \u4E2A\u5B57\u7B26");return t.trim()},"queryText"),pa={parse(t){let r=le(t);if(!r||!Array.isArray(r.sessionIds)||!r.sessionIds.length||r.sessionIds.length>20)throw new TypeError("\u6BCF\u6B21\u68C0\u7D22\u987B\u5305\u542B 1\uFF5E20 \u4E2A\u4F1A\u8BDD");return{sessionIds:[...new Set(r.sessionIds.map(Rn))],query:ma(r.query,!0)}}},Gs={parse(t){let r=le(t);if(!r)throw new TypeError("\u9884\u89C8\u53C2\u6570\u65E0\u6548");return{sessionId:Rn(r.sessionId),query:ma(r.query??"")}}},cr=e((t,r)=>{if(typeof t!="string"||t.length>r)throw new TypeError("\u8FD4\u56DE\u6587\u672C\u65E0\u6548");return t},"boundedString"),fa=e(t=>{if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new TypeError("\u6D88\u606F\u5E8F\u53F7\u65E0\u6548");return t},"sequence"),dr={parse(t){let r=le(t);if(!r||!Array.isArray(r.items)||!Array.isArray(r.failures)||r.items.length>20||r.failures.length>20)throw new TypeError("\u68C0\u7D22\u7ED3\u679C\u65E0\u6548");return{items:r.items.map(le).map(i=>({sessionId:Rn(i.sessionId),seq:fa(i.seq),snippet:cr(i.snippet,400)})),failures:r.failures.map(le).map(i=>({sessionId:Rn(i.sessionId),message:cr(i.message,500)}))}}},Ks={parse(t){let r=le(t);if(!r||!Array.isArray(r.messages)||r.messages.length>8||typeof r.hasEarlier!="boolean"||typeof r.hasLater!="boolean")throw new TypeError("\u9884\u89C8\u7ED3\u679C\u65E0\u6548");return{sessionId:Rn(r.sessionId),hasEarlier:r.hasEarlier,hasLater:r.hasLater,messages:r.messages.map(le).map(i=>{if(typeof i.role!="string"||!["user","assistant"].includes(i.role)||typeof i.truncated!="boolean")throw new TypeError("\u6D88\u606F\u89D2\u8272\u6216\u622A\u65AD\u72B6\u6001\u65E0\u6548");return{seq:fa(i.seq),role:i.role,text:cr(i.text,2e3),truncated:i.truncated}})}}};async function $n(t,r=globalThis.navigator?.clipboard){if(typeof t!="string"||!t)throw Object.assign(new Error("\u6CA1\u6709\u53EF\u590D\u5236\u7684\u5185\u5BB9"),{code:"copy.empty"});if(!r?.writeText)throw Object.assign(new Error("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u526A\u8D34\u677F\uFF0C\u8BF7\u5728 HTTPS \u6216\u672C\u673A\u5730\u5740\u4E2D\u6253\u5F00\u9875\u9762"),{code:"copy.unavailable"});try{await r.writeText(t)}catch{throw Object.assign(new Error("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u5141\u8BB8\u6D4F\u89C8\u5668\u8BBF\u95EE\u526A\u8D34\u677F\u540E\u91CD\u8BD5"),{code:"copy.denied"})}}e($n,"copySessionText");function ga(){let t=e((i,a)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${i}`,create:e(()=>a,"create"),schema:a}),"codec");return[["searchSessionContent",pa,dr],["searchArchivedContent",pa,dr],["previewArchivedSession",Gs,Ks]].map(([i,a,o])=>({id:`@michengai/dsh-archive-manager#workspaceRegistry/${i}`,service:"workspaceRegistry",namespace:"workspaceRegistry",method:i,invocation:{kind:"direct"},parameters:[{name:"input",wire:"input",source:"json",codec:t(i+"Input",a)}],result:t(i+"Result",o),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(ga,"discoveryInvocations");function va(t,r){let i=r?.trim().toLowerCase();if(!i)return null;let a=t.toLowerCase().indexOf(i);if(a<0)return null;let o=0,f=0,c;for(let k of t){let y=f+k.toLowerCase().length;if(c===void 0&&y>a&&(c=o),o+=k.length,y>=a+i.length)return{start:c??o,end:o};f=y}return null}e(va,"findTextRange");function Vn(t,r=!1){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return NaN;let[i,a,o]=t.split("-").map(Number),f=new Date(i,a-1,o);return f.getFullYear()!==i||f.getMonth()!==a-1||f.getDate()!==o?NaN:(r&&f.setDate(f.getDate()+1),f.getTime())}e(Vn,"dayBoundary");function ur(t,r){return(!t||Number.isFinite(Vn(t)))&&(!r||Number.isFinite(Vn(r)))&&(!t||!r||t<=r)}e(ur,"validUpdatedRange");function ba(t,r,i){if(!ur(r,i))return!1;if(!r&&!i)return!0;let a=typeof t=="number"?t:Date.parse(t??"");return Number.isFinite(a)&&(!r||a>=Vn(r))&&(!i||a<Vn(i,!0))}e(ba,"matchesUpdatedRange");async function ya(t,r,i,{signal:a,onProgress:o}={}){let f=[],c=[],k=[...new Set(t)],y=e(()=>{if(a?.aborted)throw new Error("\u641C\u7D22\u5DF2\u53D6\u6D88")},"check");for(let A=0;A<k.length;A+=20){y();let w=dr.parse(await i({sessionIds:k.slice(A,A+20),query:r}));y(),f.push(...w.items),c.push(...w.failures),o?.({done:Math.min(A+20,k.length),total:k.length,items:[...f],failures:[...c]})}return y(),{items:f,failures:c}}e(ya,"searchArchiveBatches");function wa(t,r={}){let i=t.createElement;function a({text:g,query:S=""}){let D=va(g,S);return D?i(t.Fragment,null,g.slice(0,D.start),i("mark",null,g.slice(D.start,D.end)),g.slice(D.end)):g}e(a,"HighlightedText");function o(g,S,D,j){let W=JSON.stringify(g),z=JSON.stringify([W,S]),[U,pe]=t.useState(0),[ie,$]=t.useState({key:"",status:"idle",items:[],failures:[]});return t.useEffect(()=>{if(!D||!S.trim()||!j)return;let he=new AbortController;$({key:z,status:"loading",items:[],failures:[],done:0,total:g.length});let Qe=setTimeout(()=>{ya(JSON.parse(W),S,j,{signal:he.signal,onProgress:e(ne=>{he.signal.aborted||$({key:z,status:"loading",...ne})},"onProgress")}).then(ne=>{he.signal.aborted||$({key:z,status:"ready",done:g.length,total:g.length,...ne})}).catch(ne=>{he.signal.aborted||$(Q=>({...Q,key:z,status:"error",error:Fe(ne)}))})},350);return()=>{he.abort(),clearTimeout(Qe)}},[W,S,D,j,U]),{...D&&S.trim()&&j?ie.key===z?ie:{key:z,status:"loading",items:[],failures:[],done:0,total:g.length}:{status:"idle",items:[],failures:[]},retry:e(()=>pe(he=>he+1),"retry")}}e(o,"useArchiveSearch");function f(g,S){let[D,j]=t.useState(null),[W,z]=t.useState({status:"idle"}),[U,pe]=t.useState(0),ie=D,$=D&&S.includes(D.session.id);return t.useEffect(()=>{D&&!$&&j(null)},[D,$]),t.useEffect(()=>{if(!$||typeof window>"u")return;let ue=e(he=>{he.key==="Escape"&&(he.preventDefault(),he.stopPropagation(),he.stopImmediatePropagation(),j(null))},"onKeyDown");return window.addEventListener("keydown",ue,!0),()=>window.removeEventListener("keydown",ue,!0)},[$]),t.useEffect(()=>{if(!D||!$||!g)return;let ue=!0;return z({key:ie,status:"loading"}),Promise.resolve().then(()=>g({sessionId:D.session.id,query:D.query})).then(he=>{ue&&z({key:ie,status:"ready",value:he})}).catch(he=>{ue&&z({key:ie,status:"error",error:Fe(he)})}),()=>{ue=!1}},[ie,$,g,U]),{target:$?D:null,...W.key===ie?W:{status:"loading"},open:e((ue,he="")=>j({session:ue,query:he}),"open"),close:e(()=>j(null),"close"),retry:e(()=>pe(ue=>ue+1),"retry")}}e(f,"useArchivePreview");function c({title:g,failures:S,separator:D}){let[j,W]=t.useState(!1),z=i("ul",null,S.map(U=>i("li",{key:U.sessionId},U.sessionId,D,U.message)));return i(qn,{title:g,open:j,onToggle:e(()=>W(U=>!U),"onToggle")},z)}e(c,"FailureDetails");function k(g,S){let D=r.Button??(j=>i("button",{type:"button",disabled:j.disabled,onClick:j.onClick},j.children));return i(D,{variant:"outline",size:"sm",...S},g)}e(k,"textButton");function y({t:g,from:S,to:D,onFrom:j,onTo:W,invalid:z,onClear:U}){return i("div",{className:"dsham_dateFilter"},i(ua,{React:t,from:S,to:D,invalid:z,label:g("discovery.date"),fromLabel:g("discovery.from"),toLabel:g("discovery.to"),onFrom:j,onTo:W,onClear:U,t:g}),z?i("p",{className:"dsham_dateAlert",role:"alert"},g("discovery.invalidDate")):null)}e(y,"DiscoveryFilters");function A({state:g,t:S}){return g.status==="idle"?null:i("div",{className:"dsham_discoveryStatus",role:"status","aria-live":"polite"},i("p",null,S(g.status==="loading"?"discovery.searching":g.status==="error"?"discovery.searchError":"discovery.searched",{done:g.done??0,total:g.total??0})),g.status==="error"&&i("p",null,g.error),g.failures.length>0&&i(c,{title:S("discovery.failed",{n:g.failures.length}),failures:g.failures,separator:S("common.separator")}),(g.status==="error"||g.status==="ready"&&g.failures.length>0)&&k(S("discovery.retry"),{onClick:g.retry}))}e(A,"SearchStatus");function w({preview:g,t:S,MarkdownText:D}){let[j,W]=t.useState(!1);if(g.status==="loading")return i("p",{role:"status"},S("discovery.loading"));if(g.status==="error")return i("div",null,i("p",{role:"alert"},g.error),k(S("discovery.retry"),{onClick:g.retry}));let z=g.value;return z?i("div",{className:"dsham_previewMessages"},i("div",{className:"dsham_previewToolbar"},i("span",{title:S("discovery.previewHint")},S("discovery.readOnly")," \xB7 ",S("discovery.messageCount",{n:z.messages.length})),D&&i(r.SegmentedControl??"div",{id:"dsham-preview-mode",label:S("discovery.displayMode"),value:j?"raw":"formatted",options:[{value:"formatted",label:S("discovery.formatted")},{value:"raw",label:S("discovery.raw")}],onChange:e(U=>W(U==="raw"),"onChange")})),z.hasEarlier&&i("p",null,S("discovery.earlier")),!z.messages.length&&i("p",null,S("discovery.empty")),z.messages.map(U=>i("article",{key:U.seq,className:"dsham_previewMessage"},i("div",{className:"dsham_previewRole","data-role":U.role},i("span",{"aria-hidden":!0},S(U.role==="user"?"discovery.you":"discovery.ai")),i("strong",null,S("discovery."+U.role))),j||!D?i("pre",{className:"dsham_previewRaw"},i(a,{text:U.text,query:g.target?.query})):i(D,{text:U.text,streaming:!1,labels:{code:{copyLabel:S("discovery.copyCode"),copiedLabel:S("details.copied")},footnotes:S("discovery.footnotes")}}),U.truncated&&i("small",null,S("discovery.truncated")))),z.hasLater&&i("p",null,S("discovery.later"))):null}return e(w,"PreviewContent"),{HighlightedText:a,useArchiveSearch:o,useArchivePreview:f,DiscoveryFilters:y,SearchStatus:A,PreviewContent:w}}e(wa,"createDiscoveryTools");var Sa=[".dsham_dateFilter{display:flex;align-items:center;gap:8px;min-width:0;position:relative}",".dsham_dateAlert{position:absolute;top:calc(100% + 4px);right:0;margin:0;width:max-content;max-width:240px;padding:4px 8px;background:var(--dsw-alias-bg-layer-2);border:0.5px solid var(--dsw-alias-state-error-primary);border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,0.25);z-index:1100;font-size:12px;line-height:16px;color:var(--dsw-alias-state-error-primary);pointer-events:none}",".dsham_dateRange{position:relative;display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;box-sizing:border-box}",".dsham_dateTrigger{display:inline-flex;align-items:center;gap:6px;width:100%;height:32px;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;cursor:pointer;box-sizing:border-box;transition:all .15s ease}",".dsham_dateTrigger:hover{border-color:var(--dsw-alias-border-l3)}",".dsham_dateTrigger.is-open{border-color:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 1px var(--dsw-alias-state-business-primary)}",".dsham_dateIcon{flex:none;color:var(--dsw-alias-label-tertiary);display:flex;align-items:center}",".dsham_dateText{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;color:var(--dsw-alias-label-primary)}",".dsham_dateText.placeholder{color:var(--dsw-alias-label-primary)}",".dsham_dateClearBtn{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-tertiary);border-radius:50%;cursor:pointer;font-size:13px;line-height:1}",".dsham_dateClearBtn:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}",".dsham_dateChevron{flex:none;color:var(--dsw-alias-label-tertiary);display:flex;align-items:center}",".dsham_dateInputSrOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",".dsham_datePopover{position:absolute;top:calc(100% + 4px);right:0;left:auto;z-index:1000;display:flex;gap:10px;padding:10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,10px);background:var(--dsw-alias-bg-layer-1);box-shadow:0 8px 24px rgba(0,0,0,0.12),0 2px 6px rgba(0,0,0,0.06);box-sizing:border-box}",".dsham_datePresets{width:84px;border-right:0.5px solid var(--dsw-alias-border-l2);padding-right:8px;display:flex;flex-direction:column;gap:3px;flex:none}",".dsham_datePresetBtn{border:0;background:transparent;padding:5px 6px;text-align:left;font:inherit;font-size:12px;color:var(--dsw-alias-label-secondary);border-radius:var(--dsw-radius-sm,6px);cursor:pointer;transition:all .15s ease;white-space:nowrap}",".dsham_datePresetBtn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",".dsham_dateCalendar{width:224px;display:flex;flex-direction:column;gap:6px;flex:none}",".dsham_dateCalHeader{display:flex;justify-content:space-between;align-items:center;padding:0 2px}",".dsham_dateMonthTitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-primary)}",".dsham_dateNavBtn{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;font-size:14px;line-height:1}",".dsham_dateNavBtn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}",".dsham_dateGrid{display:grid;grid-template-columns:repeat(7,1fr);row-gap:2px}",".dsham_dateWeekday{font-size:11px;color:var(--dsw-alias-label-tertiary);text-align:center;padding:3px 0;font-weight:500}",".dsham_dateDay{position:relative;height:26px;display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:0}",".dsham_dateDay.is-outside{color:var(--dsw-alias-label-quaternary)}",".dsham_dateDay:not(.is-outside):hover{background:var(--dsw-alias-interactive-bg-hover);border-radius:4px}",".dsham_dateDay.is-start{background:var(--dsw-alias-state-business-primary)!important;color:#fff!important;border-top-left-radius:6px;border-bottom-left-radius:6px}",".dsham_dateDay.is-end{background:var(--dsw-alias-state-business-primary)!important;color:#fff!important;border-top-right-radius:6px;border-bottom-right-radius:6px}",".dsham_dateDay.is-start.is-end{border-radius:6px!important}",".dsham_dateDay.is-in-range{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-state-business-primary)}",".dsham_dateDay.is-today::after{content:'';position:absolute;bottom:2px;width:3px;height:3px;border-radius:50%;background:var(--dsw-alias-state-business-primary)}",".dsham_dateDay.is-start.is-today::after,.dsham_dateDay.is-end.is-today::after{background:#fff}",".dsham_discoveryStatus{font-size:12px;margin-bottom:12px;overflow-wrap:anywhere}",".dsham_settingsSnippet{display:block;width:100%;padding:0;margin:4px 0 0;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}",".dsham_previewMessages{max-height:65vh;overflow:auto;overflow-wrap:anywhere;padding-right:8px}",".dsham_previewToolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;color:var(--dsw-alias-label-secondary);font-size:12px}",".dsham_previewRole{display:flex;align-items:center;gap:8px;margin-bottom:12px;font-size:13px}",".dsham_previewRole>span{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--dsw-alias-bg-layer-3);font-size:11px}",".dsham_previewRole[data-role=user]>span{color:var(--dsw-alias-state-business-primary)}",".dsham_previewRaw{white-space:pre-wrap;font:13px/1.8 ui-monospace,monospace;overflow-wrap:anywhere}",".dsham_previewMessage pre:not(.dsham_previewRaw){white-space:pre;overflow-x:auto;max-width:100%}",".dsham_previewMessage table{display:block;max-width:100%;overflow-x:auto}",".dsham_previewMessage img{max-width:100%}","@media(max-width:520px){.dsham_previewToolbar{align-items:flex-start;flex-wrap:wrap}}",".dsham_previewMessage{padding:18px 0;border-bottom:1px solid var(--dsw-alias-border-l2)}",".dsham_previewMessage p{font-size:14px;line-height:1.8}",".dsham_previewHint,.dsham_previewMessage small{color:var(--dsw-alias-label-secondary);font-size:12px}",".dsham_settings mark,.dsham_previewMessages mark{background:var(--dsw-alias-state-warn-tertiary);color:inherit;border-radius:2px}",".dsham_settingsSnippet:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}"].join(""),xa={"common.separator":"\uFF1A","copy.empty":"\u6CA1\u6709\u53EF\u590D\u5236\u7684\u5185\u5BB9","copy.unavailable":"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u526A\u8D34\u677F\uFF0C\u8BF7\u5728 HTTPS \u6216\u672C\u673A\u5730\u5740\u4E2D\u6253\u5F00\u9875\u9762","copy.denied":"\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u5141\u8BB8\u6D4F\u89C8\u5668\u8BBF\u95EE\u526A\u8D34\u677F\u540E\u91CD\u8BD5","discovery.you":"\u4F60","discovery.ai":"AI","discovery.readOnly":"\u53EA\u8BFB\u9884\u89C8","discovery.messageCount":"\u672C\u6B21\u663E\u793A {n} \u6761\u6D88\u606F","discovery.displayMode":"\u663E\u793A\u65B9\u5F0F","discovery.formatted":"\u6392\u7248","discovery.raw":"\u539F\u6587\u4E0E\u9AD8\u4EAE","discovery.copyCode":"\u590D\u5236\u4EE3\u7801","discovery.footnotes":"\u6CE8\u91CA","details.copyId":"\u590D\u5236\u4F1A\u8BDD ID","details.copied":"\u5DF2\u590D\u5236","discovery.date":"\u65E5\u671F","discovery.timeRange":"\u65F6\u95F4\u8303\u56F4","discovery.allTime":"\u5168\u90E8\u65F6\u95F4","discovery.today":"\u4ECA\u5929","discovery.last7Days":"\u8FD1 7 \u5929","discovery.last30Days":"\u8FD1 30 \u5929","discovery.last90Days":"\u8FD1 90 \u5929","discovery.customRange":"\u81EA\u5B9A\u4E49\u2026","discovery.dateActive":"\u65E5\u671F\xB7\u5DF2\u9009","discovery.clearDate":"\u6E05\u9664\u65E5\u671F","discovery.active":"\u5DF2\u542F\u7528","discovery.scope":"\u67E5\u627E\u8303\u56F4","discovery.titleOnly":"\u4EC5\u6807\u9898","discovery.titleAndContent":"\u6807\u9898\u4E0E\u6B63\u6587","discovery.from":"\u66F4\u65B0\u65F6\u95F4\u4ECE","discovery.to":"\u81F3","discovery.clear":"\u6E05\u9664\u6761\u4EF6","discovery.invalidDate":"\u5F00\u59CB\u65E5\u671F\u4E0D\u80FD\u665A\u4E8E\u7ED3\u675F\u65E5\u671F\uFF0C\u8BF7\u68C0\u67E5\u65E5\u671F\u8303\u56F4\u3002","discovery.searching":"\u6B63\u5728\u68C0\u7D22\u6B63\u6587\uFF1A{done} / {total}","discovery.searched":"\u6B63\u6587\u68C0\u7D22\u5B8C\u6210\uFF1A{done} / {total}","discovery.searchError":"\u6B63\u6587\u68C0\u7D22\u672A\u5B8C\u6210\uFF0C\u5F53\u524D\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002","discovery.failed":"{n} \u6761\u4F1A\u8BDD\u8BFB\u53D6\u5931\u8D25","discovery.retry":"\u91CD\u8BD5","discovery.preview":"\u5FEB\u901F\u9884\u89C8","discovery.loading":"\u6B63\u5728\u8BFB\u53D6\u4F1A\u8BDD\u2026","discovery.previewHint":"\u53EA\u8BFB\u9884\u89C8\u539F\u59CB\u5BF9\u8BDD\u6587\u672C\uFF0C\u4E0D\u6062\u590D\u4F1A\u8BDD\uFF1B\u4E0D\u542B\u5DE5\u5177\u8F93\u51FA\u3001\u9644\u4EF6\u3001\u63A8\u7406\u548C\u7CFB\u7EDF\u5185\u5BB9\u3002","discovery.earlier":"\u524D\u9762\u8FD8\u6709\u6D88\u606F\uFF0C\u53EF\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u67E5\u770B\u3002","discovery.later":"\u540E\u9762\u8FD8\u6709\u6D88\u606F\uFF0C\u53EF\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u67E5\u770B\u3002","discovery.empty":"\u6CA1\u6709\u53EF\u9884\u89C8\u7684\u7528\u6237\u6216\u52A9\u624B\u6587\u672C\u3002","discovery.truncated":"\u672C\u6761\u4EC5\u663E\u793A\u90E8\u5206\u5185\u5BB9\u3002","discovery.user":"\u7528\u6237","discovery.assistant":"\u52A9\u624B","discovery.openFull":"\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD","discovery.searchPlaceholder":"\u641C\u7D22\u6807\u9898\u6216\u6B63\u6587"},ka={"common.separator":": ","copy.empty":"Nothing to copy","copy.unavailable":"Clipboard unavailable. Open the page over HTTPS or localhost.","copy.denied":"Copy failed. Allow clipboard access and retry.","discovery.you":"You","discovery.ai":"AI","discovery.readOnly":"Read-only preview","discovery.messageCount":"Showing {n} messages","discovery.displayMode":"Display mode","discovery.formatted":"Formatted","discovery.raw":"Source and highlights","discovery.copyCode":"Copy code","discovery.footnotes":"Footnotes","details.copyId":"Copy session ID","details.copied":"Copied","discovery.date":"Date","discovery.timeRange":"Time range","discovery.allTime":"All time","discovery.today":"Today","discovery.last7Days":"Past 7 days","discovery.last30Days":"Past 30 days","discovery.last90Days":"Past 90 days","discovery.customRange":"Custom\u2026","discovery.dateActive":"Date \xB7 Set","discovery.clearDate":"Clear dates","discovery.active":"Active","discovery.scope":"Search in","discovery.titleOnly":"Titles","discovery.titleAndContent":"Titles and content","discovery.from":"Updated from","discovery.to":"To","discovery.clear":"Clear filters","discovery.invalidDate":"Check the date range: the start must not be after the end.","discovery.searching":"Searching content: {done} / {total}","discovery.searched":"Content search complete: {done} / {total}","discovery.searchError":"Content search is incomplete; results may be missing.","discovery.failed":"Could not read {n} conversations","discovery.retry":"Retry","discovery.preview":"Quick preview","discovery.loading":"Reading conversation\u2026","discovery.previewHint":"Read-only original conversation text; keeps the conversation archived. Excludes tools, attachments, reasoning and system content.","discovery.earlier":"More messages before this preview. Open the full conversation to read them.","discovery.later":"More messages after this preview. Open the full conversation to read them.","discovery.empty":"No user or assistant text to preview.","discovery.truncated":"Only part of this message is shown.","discovery.user":"User","discovery.assistant":"Assistant","discovery.openFull":"Open full conversation","discovery.searchPlaceholder":"Search titles or content"},Ca={"common.separator":": ","copy.empty":"\u041D\u0435\u0447\u0435\u0433\u043E \u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C","copy.unavailable":"\u0411\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0435\u043D\u0430 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u043F\u043E HTTPS \u0438\u043B\u0438 localhost.","copy.denied":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C. \u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u0434\u043E\u0441\u0442\u0443\u043F \u043A \u0431\u0443\u0444\u0435\u0440\u0443 \u043E\u0431\u043C\u0435\u043D\u0430 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435.","discovery.you":"\u0412\u044B","discovery.ai":"\u0418\u0418","discovery.readOnly":"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0447\u0442\u0435\u043D\u0438\u044F","discovery.messageCount":"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u043E \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439: {n}","discovery.displayMode":"\u0420\u0435\u0436\u0438\u043C \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","discovery.formatted":"\u0424\u043E\u0440\u043C\u0430\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043E","discovery.raw":"\u0418\u0441\u0445\u043E\u0434\u043D\u0438\u043A \u0438 \u043F\u043E\u0434\u0441\u0432\u0435\u0442\u043A\u0430","discovery.copyCode":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043A\u043E\u0434","discovery.footnotes":"\u0421\u043D\u043E\u0441\u043A\u0438","details.copyId":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C ID \u0441\u0435\u0441\u0441\u0438\u0438","details.copied":"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E","discovery.date":"\u0414\u0430\u0442\u0430","discovery.timeRange":"\u041F\u0435\u0440\u0438\u043E\u0434","discovery.allTime":"\u0412\u0441\u0435 \u0432\u0440\u0435\u043C\u044F","discovery.today":"\u0421\u0435\u0433\u043E\u0434\u043D\u044F","discovery.last7Days":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 7 \u0434\u043D\u0435\u0439","discovery.last30Days":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 30 \u0434\u043D\u0435\u0439","discovery.last90Days":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 90 \u0434\u043D\u0435\u0439","discovery.customRange":"\u0421\u0432\u043E\u0439 \u043F\u0435\u0440\u0438\u043E\u0434\u2026","discovery.dateActive":"\u0414\u0430\u0442\u0430 \xB7 \u0412\u044B\u0431\u0440\u0430\u043D\u0430","discovery.clearDate":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0434\u0430\u0442\u044B","discovery.active":"\u0412\u043A\u043B\u044E\u0447\u0435\u043D\u043E","discovery.scope":"\u0418\u0441\u043A\u0430\u0442\u044C \u0432","discovery.titleOnly":"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u044F","discovery.titleAndContent":"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u044F \u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0435","discovery.from":"\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0441","discovery.to":"\u041F\u043E","discovery.clear":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B","discovery.invalidDate":"\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D \u0434\u0430\u0442: \u043D\u0430\u0447\u0430\u043B\u043E \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043F\u043E\u0437\u0436\u0435 \u043A\u043E\u043D\u0446\u0430.","discovery.searching":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443: {done} / {total}","discovery.searched":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D: {done} / {total}","discovery.searchError":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443 \u043D\u0435\u043F\u043E\u043B\u043D\u044B\u0439; \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u043D\u0435\u043F\u043E\u043B\u043D\u044B\u043C\u0438.","discovery.failed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C {n} \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u043E\u0432","discovery.retry":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C","discovery.preview":"\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440","discovery.loading":"\u0427\u0442\u0435\u043D\u0438\u0435 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430\u2026","discovery.previewHint":"\u0422\u043E\u043B\u044C\u043A\u043E \u0447\u0442\u0435\u043D\u0438\u0435 \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0433\u043E \u0442\u0435\u043A\u0441\u0442\u0430 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430; \u0441\u0435\u0441\u0441\u0438\u044F \u043E\u0441\u0442\u0430\u0451\u0442\u0441\u044F \u0432 \u0430\u0440\u0445\u0438\u0432\u0435. \u0411\u0435\u0437 \u0432\u044B\u0432\u043E\u0434\u0430 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u043E\u0432, \u0432\u043B\u043E\u0436\u0435\u043D\u0438\u0439, \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0439 \u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u043E\u0433\u043E \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u0433\u043E.","discovery.earlier":"\u041F\u0435\u0440\u0435\u0434 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u043E\u043C \u0435\u0441\u0442\u044C \u0435\u0449\u0451 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440, \u0447\u0442\u043E\u0431\u044B \u0438\u0445 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C.","discovery.later":"\u041F\u043E\u0441\u043B\u0435 \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430 \u0435\u0441\u0442\u044C \u0435\u0449\u0451 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440, \u0447\u0442\u043E\u0431\u044B \u0438\u0445 \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C.","discovery.empty":"\u041D\u0435\u0442 \u0442\u0435\u043A\u0441\u0442\u0430 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F \u0438\u043B\u0438 \u0430\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u0430 \u0434\u043B\u044F \u043F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0430.","discovery.truncated":"\u041F\u043E\u043A\u0430\u0437\u0430\u043D\u0430 \u0442\u043E\u043B\u044C\u043A\u043E \u0447\u0430\u0441\u0442\u044C \u044D\u0442\u043E\u0433\u043E \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F.","discovery.user":"\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C","discovery.assistant":"\u0410\u0441\u0441\u0438\u0441\u0442\u0435\u043D\u0442","discovery.openFull":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043F\u043E\u043B\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440","discovery.searchPlaceholder":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F\u043C \u0438\u043B\u0438 \u0441\u043E\u0434\u0435\u0440\u0436\u0438\u043C\u043E\u043C\u0443"};var Ea=e(t=>{let r=le(t);if(!r||typeof r.sessionId!="string"||!r.sessionId.length||r.sessionId.length>1024||typeof r.identity!="string"||!r.identity.length||r.identity.length>4096)throw new TypeError("invalid cache rebuild candidate");return{sessionId:r.sessionId,identity:r.identity}},"candidate"),Ys={parse(t){let r=le(t);if(!r||!Array.isArray(r.items)||!r.items.length||r.items.length>20)throw new TypeError("invalid cache rebuild batch (1\u201320 items required)");return{items:r.items.map(Ea)}}},hr={parse(t){let r=le(t);if(!r||!Array.isArray(r.items)||r.count!==r.items.length)throw new TypeError("invalid cache diagnosis");return{count:r.items.length,items:r.items.map(Ea)}}},pr={parse(t){let r=le(t);for(let i of["rebuiltSessionIds","skippedSessionIds"])if(!Array.isArray(r?.[i])||r[i].some(a=>typeof a!="string"))throw new TypeError("invalid cache rebuild result");if(!Array.isArray(r.failures)||r.failures.some(i=>!i||typeof i.sessionId!="string"||typeof i.message!="string"))throw new TypeError("invalid cache rebuild failures");return r}};function Ia(){let t=e((r,i)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${r}`,create:e(()=>i,"create"),schema:i}),"codec");return[{method:"diagnoseSessionCaches",parameters:[],result:t("CacheDiagnosis",hr)},{method:"rebuildSessionCaches",parameters:[{name:"input",wire:"input",source:"json",codec:t("CacheRebuildInput",Ys)}],result:t("CacheRebuildResult",pr)}].map(({method:r,...i})=>({id:`@michengai/dsh-archive-manager#workspaceRegistry/${r}`,service:"workspaceRegistry",namespace:"workspaceRegistry",method:r,invocation:{kind:"direct"},...i,sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(Ia,"cacheRebuildInvocations");function Ta(t,r={}){let{maxLoadRetries:i=3,retryDelayMs:a=200}=r,o={diagnosis:{count:0,items:[]},busy:!1,progress:null,result:null,error:null,refreshError:null},f=!0,c=0,k=[],y,A=new Set,w=e(S=>{if(f){o={...o,...S};for(let D of A)D()}},"update"),g=e(async(S=i)=>{if(!f)return;y!==void 0&&(clearTimeout(y),y=void 0);let D=++c;try{let j=hr.parse(await t.diagnose());f&&D===c&&w({diagnosis:j,error:null})}catch(j){if(S>0&&f&&D===c){y=setTimeout(()=>{y=void 0,f&&D===c&&g(S-1)},a);return}f&&D===c&&w({error:Fe(j)})}},"load");return{snapshot:e(()=>o,"snapshot"),subscribe(S){return A.add(S),()=>{A.delete(S)}},load:g,async run(S=!1){if(!f||o.busy)return;++c,y!==void 0&&(clearTimeout(y),y=void 0);let D=S?[...k]:[...o.diagnosis.items],j={rebuiltSessionIds:[],skippedSessionIds:[],failures:[]};k=[],w({busy:!0,result:null,error:null,refreshError:null,progress:{done:0,total:D.length}});for(let[W,z]of D.entries()){if(!f)return;try{let U=pr.parse(await t.rebuild({items:[z]}));if(!f)return;j.rebuiltSessionIds.push(...U.rebuiltSessionIds),j.skippedSessionIds.push(...U.skippedSessionIds),j.failures.push(...U.failures),U.failures.length&&k.push(z)}catch(U){if(!f)return;j.failures.push({sessionId:z.sessionId,message:Fe(U)}),k.push(z)}w({progress:{done:W+1,total:D.length}})}w({result:j});try{await t.refresh()}catch(W){w({refreshError:Fe(W)})}f&&(await g(),w({busy:!1,progress:null}))},dismiss(){f&&w({result:null,error:null,refreshError:null})},dispose(){f=!1,++c,y!==void 0&&(clearTimeout(y),y=void 0),A.clear()}}}e(Ta,"createCacheRebuildController");var Kt=class extends Error{static{e(this,"ArchiveNavigationError")}code;constructor(r){super(r),this.name="ArchiveNavigationError",this.code=r}};function Aa(t,r){return t instanceof Kt?r(`archives.${t.code}`):Fe(t)}e(Aa,"formatArchiveNavigationError");function Zs(t,r){if(typeof t?.retainInfo!="function")return;let i=t.retainInfo(r),a=i&&typeof i=="object"&&"getSnapshot"in i&&typeof i.getSnapshot=="function"?i.getSnapshot():i;if(!a||typeof a!="object"||!("retainedBy"in a))return;let o=a.retainedBy;if(!(!o||typeof o!="object"||!("mainView"in o)||typeof o.mainView!="number"))return{retainedBy:{mainView:o.mainView}}}e(Zs,"retainInfoSnapshot");function Js(t){let r=t?.byId;if(r!==void 0){for(let i of Object.values(r))if(i&&(i.retainedBy?.mainView??0)>0)return i.id}}e(Js,"mainViewSessionId");function Gn(t){return Js(t)}e(Gn,"currentSessionId");function Xs(t,r,i){return r===void 0||r===""?!1:(t?.byId?.[r]?.retainedBy?.mainView??0)>0||(Zs(i,r)?.retainedBy?.mainView??0)>0}e(Xs,"sessionIsCurrent");async function _a(t,r,i,a=()=>!0){if(i){if(typeof t.prepare=="function"&&await t.prepare(r),!a())return;await t.restore(r)}a()&&await t.open(r)}e(_a,"openArchivedConversation");function Ra(t,r,i,{onOpened:a=e(()=>{},"onOpened"),beginNavigation:o,warn:f=e((...c)=>console.warn(...c),"warn")}={}){let c,k=t?.clearArchivedCurrent,y=t&&Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent"),A=e(S=>Xs(r.list.getSnapshot(),S,r),"viewing"),w=e(function(...S){return c!==void 0&&A(c)&&i.list.getSnapshot().archivedSessionIds.includes(c)?!1:(c=void 0,k?.apply(this,S))},"wrapped"),g=e(()=>t&&Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent")?.value===w,"ownsWrapper");if(t&&typeof k=="function")try{if(t.clearArchivedCurrent=w,!g())throw new Error("\u5BFC\u822A\u65B9\u6CD5\u672A\u63A5\u7EB3\u5F52\u6863\u9002\u914D")}catch(S){f("archive-manager: \u65E0\u6CD5\u9002\u914D\u5F52\u6863\u5BFC\u822A\uFF0C\u8BF7\u6062\u590D\u4F1A\u8BDD\u540E\u6253\u5F00\u3002",S)}return{open(S){c=S;try{if(typeof k=="function"&&!g()&&i.list.getSnapshot().archivedSessionIds.includes(S))throw f("archive-manager: \u5F52\u6863\u5BFC\u822A\u9002\u914D\u4E0D\u53EF\u7528\u6216\u5DF2\u88AB\u66FF\u6362\u3002"),new Kt("navigationUnavailable");if(o?.(),typeof t?.openSession!="function")throw f("archive-manager: \u5BBF\u4E3B\u672A\u63D0\u4F9B\u4F1A\u8BDD\u6253\u5F00\u63A5\u53E3\u3002"),new Kt("navigationUnavailable");if(t.openSession(S),!A(S))throw f("archive-manager: \u5BBF\u4E3B\u672A\u4FDD\u7559\u76EE\u6807\u4F1A\u8BDD\u3002",{cleanupAvailable:typeof k=="function"}),new Kt("sessionNotRetained");a()}catch(D){throw c=void 0,D}},dispose(){c=void 0,!(!t||Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent")?.value!==w)&&(y?Object.defineProperty(t,"clearArchivedCurrent",y):delete t.clearArchivedCurrent,k?.call(t))}}}e(Ra,"allowArchivedNavigation");var en=require("@deepseek-ai/dsh-client-ui-primitives");var ja={check:"\u68C0\u67E5\u66F4\u65B0",update:"\u66F4\u65B0",recheck:"\u91CD\u65B0\u68C0\u67E5",auto:"\u81EA\u52A8\u66F4\u65B0",updating:"\u6B63\u5728\u66F4\u65B0\u2026",copy:"\u590D\u5236\u547D\u4EE4",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",checking:"\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",latest:"\u5DF2\u662F\u6700\u65B0\u7248\u672C",found:"\u53D1\u73B0\u65B0\u7248\u672C",failed:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",current:"\u8FD0\u884C\u7248\u672C",latestLabel:"\u6700\u65B0\u7248\u672C",profile:"\u76EE\u6807 profile",unknown:"\u672A\u77E5",manual:"\u624B\u5DE5\u66F4\u65B0",manualHint:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u53EF\u5728\u5F53\u524D DSH \u7EC8\u7AEF\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF0C\u5B8C\u6210\u540E\u91CD\u542F DSH Web\u3002",manualHintDesktop:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u8BF7\u5148\u5B8C\u5168\u9000\u51FA DSH Desktop\uFF0C\u518D\u7528 Desktop \u81EA\u5E26\u7684 dsh \u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u3002\u666E\u901A dsh \u4F1A\u62D2\u7EDD desktop profile\u3002",intro:"\u4EC5\u68C0\u67E5\u5E76\u66F4\u65B0\u5F53\u524D\u63D2\u4EF6\uFF0C\u4E0D\u4F1A\u8054\u52A8\u5B89\u88C5\u5176\u4ED6\u63D2\u4EF6\u3002",restart:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u91CD\u542F DSH Web\u3002",restartDesktop:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00 DSH Desktop\u3002",restarting:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u542F DSH Desktop\u2026",unavailable:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u81EA\u52A8\u66F4\u65B0\uFF0C\u8BF7\u4F7F\u7528\u624B\u5DE5\u66F4\u65B0\u547D\u4EE4\u3002"},Na={check:"Check for updates",update:"Update",recheck:"Check again",auto:"Update automatically",updating:"Updating\u2026",copy:"Copy command",copied:"Copied",copyFailed:"Copy failed",checking:"Checking for updates\u2026",latest:"You are up to date",found:"New version available",failed:"Could not check for updates. Try again later.",current:"Running version",latestLabel:"Latest version",profile:"Target profile",unknown:"Unknown",manual:"Manual update",manualHint:"If automatic update fails, run this command in the current DSH terminal, then restart DSH Web.",manualHintDesktop:"If automatic update fails, fully quit DSH Desktop, then run this command with Desktop's own dsh. A regular dsh rejects the desktop profile.",intro:"Only this plugin is checked and updated. Other plugins are not changed.",restart:"Update complete. Restart DSH Web.",restartDesktop:"Update complete. Fully quit and reopen DSH Desktop.",restarting:"Update complete. Restarting DSH Desktop\u2026",unavailable:"Automatic update is unavailable. Use the manual command."};function jn(t){return t.toLowerCase().startsWith("zh")?ja:Na}e(jn,"pluginUpdateCopy");function Qs(t,r,i,a){let o=jn(t),f=r?.restartDesktop===!0||r?.profileName==="desktop",c=f?{...o,manualHint:o.manualHintDesktop}:o,k=i!=="idle",y=c.checking,A="";return i==="checking"?y=c.checking:i==="updating"?y=c.updating:a.type==="error"?(y=a.message||c.failed,A="error"):a.type==="restart"?(y=f?c.restartDesktop:c.restart,A="success"):a.type==="restarting"?(y=c.restarting,A="success"):r===void 0?y=c.checking:r.latestCheckFailed?(y=c.failed,A="error"):!r.canAutoUpdate&&r.updateAvailable?(y=c.unavailable,A="update"):r.updateAvailable?(y=`${c.found}: v${r.latestVersion??c.unknown}`,A="update"):(y=c.latest,A="success"),{copy:c,busy:k,message:y,kind:A,loading:i==="updating",updateLabel:i==="updating"?c.updating:c.auto,disabled:k||r?.canAutoUpdate!==!0||r.updateAvailable!==!0,currentVersion:r===void 0?c.unknown:`v${r.currentVersion}`,latestVersion:r?.latestVersion===void 0?c.unknown:`v${r.latestVersion}`,profileName:r?.profileName??c.unknown,profileRaw:r?.profileName??"",latestRaw:r?.latestVersion??"latest"}}e(Qs,"describePluginUpdate");function Da(t,r,i){let a="idle",o=r,f={type:"status"},c=0,k=new Set,y=e(()=>{for(let w of k)w()},"emit"),A=e(w=>{o=w,i?.(w)},"assign");return{get posts(){return c},subscribe(w){return k.add(w),()=>{k.delete(w)}},view(w){return Qs(w,o,a,f)},async check(){if(a==="idle"){a="checking",f={type:"status"},y();try{A(await t("GET")),f={type:"status"}}catch(w){f={type:"error",message:w instanceof Error?w.message:""}}finally{a="idle",y()}}},async update(){if(a==="idle"){a="updating",f={type:"status"},c+=1,y();try{let w=await t("POST");A(w),f={type:w.autoReload===!0?"restarting":"restart"}}catch(w){f={type:"error",message:w instanceof Error?w.message:""}}finally{a="idle",y()}}}}}e(Da,"createUpdateFlow");function Ma(t,r,i){return`dsh plugin${t.trim()===""?"":` --profile ${t.trim()}`} add ${r}@${i} --registry=https://registry.npmjs.org/`}e(Ma,"manualPluginUpdateCommand");function La(t,r){return t.key!=="Escape"?!1:(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r(),!0)}e(La,"handlePluginUpdateEscape");function ei(){let t=globalThis.document;if(typeof t>"u"||t===null)return;let r=t.baseURI;if(!(typeof r!="string"||r===""))try{let i=new URL(r),a=i.pathname.lastIndexOf("/"),o=i.pathname.slice(a+1);return/\.(html?|php|aspx?|jsp)$/i.test(o)?i.pathname=i.pathname.slice(0,a+1):i.pathname.endsWith("/")||(i.pathname+="/"),i.href}catch{return}}e(ei,"pageBaseHref");function mn(t){if(typeof t!="string"||t.charAt(0)!=="/"||t.charAt(1)==="/")return t;let r=ei();if(r===void 0)return t;try{return new URL(t.slice(1),r).href}catch{return t}}e(mn,"resolveApiUrl");function za(t){let i=Function("return globalThis.__dshArchiveReactDOMClient")()?.createRoot;if(i===void 0)throw new Error("createRoot unavailable");return i(t)}e(za,"mountRoot");var ti="x-michengai-plugin-update",Pa="michengai-plugin-update-ui",mr=`
|
|
11
11
|
.mpi-version{margin-left:8px;color:var(--dsw-alias-label-tertiary,#a0a0a0);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}.mpi-check-host{display:inline-flex;align-items:center}.mpi-icon{display:inline-flex;flex:0 0 auto;width:16px;height:16px;align-items:center;justify-content:center;pointer-events:none}.mpi-icon svg{display:block;width:16px;height:16px}
|
|
12
12
|
.mpi-intro{margin:0 0 16px;color:var(--dsw-alias-label-secondary,#b9b9b9);font-size:13px;line-height:20px}.mpi-meta{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 18px;margin:0 0 16px;font-size:12px;line-height:18px}.mpi-meta dt{color:var(--dsw-alias-label-secondary,#b9b9b9)}.mpi-meta dd{margin:0}.mpi-mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.mpi-latest{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px}.mpi-status{font-size:13px;font-weight:600;line-height:18px}.mpi-status[data-kind=error]{color:var(--dsw-alias-state-error-primary,#ef7272)}.mpi-status[data-kind=success]{color:var(--dsw-alias-state-success-primary,#51b976)}.mpi-status[data-kind=update]{color:#e8b15a !important}.mpi-manual{border-top:1px solid var(--dsw-alias-border-l2,#494949);padding-top:16px}.mpi-manual h3{margin:0 0 6px;font-size:14px;line-height:20px}.mpi-manual p{margin:0 0 10px;color:var(--dsw-alias-label-secondary,#b9b9b9);font-size:12px;line-height:18px}.mpi-command{display:flex;align-items:flex-start;gap:8px;border:1px solid var(--dsw-alias-border-l2,#494949);border-radius:7px;padding:10px;background:var(--dsw-alias-bg-layer-3,var(--dsw-specific-menu-item-hover,#353638))}.mpi-command code{min-width:0;flex:1;overflow:visible;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere}@media(max-width:560px){.mpi-meta{grid-template-columns:1fr;gap:2px}.mpi-meta dd{margin-bottom:6px}}
|
|
13
13
|
.dssm-update-progress{height:4px;border-radius:2px;background:var(--dsw-alias-border-l1,#3a3a3a);overflow:hidden;margin:12px 0;position:relative}.dssm-update-progress-bar{height:100%;width:40%;background:var(--dsw-alias-button-primary-fill,#4176e6);border-radius:2px;animation:dssm-progress-slide 1.4s ease-in-out infinite}@keyframes dssm-progress-slide{0%{transform:translateX(-100%)}100%{transform:translateX(300%)}}@media (prefers-reduced-motion:reduce){.dssm-update-progress-bar{animation:none;width:100%;opacity:.6}}
|
|
14
|
-
`;function ni(){let t=document.getElementById(
|
|
14
|
+
`;function ni(){let t=document.getElementById(Pa);if(t!==null){t.textContent!==mr&&(t.textContent=mr);return}let r=document.createElement("style");r.id=Pa,r.textContent=mr,(document.head??document.documentElement).append(r)}e(ni,"ensureStyle");function ri(t){if(t===null||typeof t!="object")return!1;let r=t;return typeof r.packageName=="string"&&typeof r.currentVersion=="string"&&typeof r.updateAvailable=="boolean"&&typeof r.profileName=="string"&&typeof r.canAutoUpdate=="boolean"&&typeof r.latestCheckFailed=="boolean"&&(r.latestVersion===void 0||typeof r.latestVersion=="string")}e(ri,"validPayload");async function Oa(t,r,i){let a=i===void 0?{}:{signal:i},o=await fetch(t,r==="GET"?{cache:"no-store",...a}:{method:"POST",headers:{"content-type":"application/json",[ti]:"1"},body:"{}",...a}),f=await o.json();if(!o.ok||!ri(f))throw new Error(f&&typeof f=="object"&&"error"in f&&typeof f.error=="string"?f.error:jn(document.documentElement.lang).failed);return f}e(Oa,"requestStatus");function ai(t){let r=q.useRef(null);return q.useLayoutEffect(()=>{r.current?.replaceChildren(t.node)},[t.node]),q.createElement("span",{ref:r,className:"mpi-icon","aria-hidden":!0})}e(ai,"HostIcon");function si(t){let r=q.useRef(null),[,i]=q.useState(0),[a,o]=q.useState("idle");q.useEffect(()=>t.flow.subscribe(()=>i(w=>w+1)),[t.flow]),q.useEffect(()=>{let w=document.documentElement,g=new MutationObserver(()=>i(S=>S+1));return g.observe(w,{attributes:!0,attributeFilter:["lang"]}),()=>g.disconnect()},[]),q.useEffect(()=>{t.flow.check()},[t.flow]),q.useEffect(()=>{function w(g){La(g,t.onClose)}return e(w,"onKey"),document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[t.onClose]);let f=document.documentElement.lang,c=t.flow.view(f),k=f.toLowerCase().startsWith("zh")?t.zhName:f.toLowerCase().startsWith("ru")?t.ruName:t.enName,y=Ma(c.profileRaw,t.packageName,c.latestRaw),A=a==="copied"?c.copy.copied:a==="failed"?c.copy.copyFailed:c.copy.copy;return q.createElement(en.Modal,{open:!0,className:"mpi-dialog",title:`${k} ${c.copy.update}`,closeLabel:"Close",onClose:t.onClose,footer:[q.createElement(en.Button,{key:"check",variant:"outline",disabled:c.busy,onClick:e(()=>{t.flow.check()},"onClick")},c.copy.recheck),q.createElement(en.Button,{key:"update",variant:"primary",disabled:c.disabled,onClick:e(()=>{t.flow.update()},"onClick")},c.updateLabel)]},q.createElement("div",{ref:r},q.createElement("p",{className:"mpi-intro"},c.copy.intro),q.createElement("dl",{className:"mpi-meta"},q.createElement("dt",null,c.copy.current),q.createElement("dd",null,q.createElement("span",{className:"mpi-mono"},c.currentVersion)),q.createElement("dt",null,c.copy.latestLabel),q.createElement("dd",{className:"mpi-latest"},q.createElement("span",{className:"mpi-mono"},c.latestVersion),q.createElement("span",{className:"mpi-status",role:"status","data-kind":c.kind,...c.kind==="update"?{style:{color:"#e8b15a"}}:{}},c.message)),q.createElement("dt",null,c.copy.profile),q.createElement("dd",null,q.createElement("span",{className:"mpi-mono"},c.profileName))),c.busy?q.createElement("div",{className:"dssm-update-progress",role:"progressbar","aria-busy":"true"},q.createElement("div",{className:"dssm-update-progress-bar"})):null,q.createElement("section",{className:"mpi-manual"},q.createElement("h3",null,c.copy.manual),q.createElement("p",null,c.copy.manualHint),q.createElement("div",{className:"mpi-command"},q.createElement("code",null,y),q.createElement(en.Button,{variant:"outline",size:"sm",disabled:c.busy,onClick:e(()=>{let w=navigator.clipboard?.writeText(y);if(w===void 0){o("failed");return}w.then(()=>{o("copied"),window.setTimeout(()=>o("idle"),1400)}).catch(()=>o("failed"))},"onClick")},A)))))}e(si,"UpdateDialog");function Fa(t){if(typeof document>"u"||document.body===null)return()=>{};let r=mn(t.endpoint);ni();let i=new AbortController,a,o,f,c,k,y,A;function w(){f?.unmount(),f=void 0,o=void 0,c=void 0}e(w,"unmountCheck");function g(){if(f===void 0)return;c===void 0&&(c=t.createIcon("refresh"));let ie=c;f.render(q.createElement(en.Button,{variant:"outline",size:"sm",onClick:D,icon:q.createElement(ai,{node:ie})},q.createElement("span",{"data-mpi-label":""},jn(document.documentElement.lang).check)))}e(g,"renderCheck");function S(){y?.unmount(),y=void 0,k?.remove(),k=void 0}e(S,"closeDialog");function D(){S();let ie=document.createElement("div");ie.className="mpi-dialog-root",document.body.append(ie),k=ie,y=za(ie),y.render(q.createElement(si,{flow:Da($=>Oa(r,$,i.signal),a,$=>{a=$,j()}),packageName:t.packageName,zhName:t.zhName,enName:t.enName,ruName:t.ruName,onClose:S}))}e(D,"openDialog");function j(){let ie=document.querySelector(t.titleRowSelector);if(ie===null)return;let $=ie.querySelector("h1,h2"),ue=ie.querySelector(t.linksSelector);if(t.isEnabled&&!t.isEnabled()){if(k!==void 0&&S(),ue!==null){let ne=ue.querySelector(`[data-mpi-check="${t.packageName}"]`);ne!==null&&(w(),ne.remove())}if($!==null){let ne=$.querySelector(`.mpi-version[data-package="${t.packageName}"]`);ne!==null&&ne.remove()}return}if($!==null&&a!==void 0){let ne=$.querySelector(`.mpi-version[data-package="${t.packageName}"]`);ne===null&&(ne=document.createElement("span"),ne.className="mpi-version",ne.dataset.package=t.packageName,$.append(ne));let Q=`v${a.currentVersion}`;ne.textContent!==Q&&(ne.textContent=Q)}if(o!==void 0&&!o.isConnected&&w(),ue===null)return;let he=ue.querySelector(`[data-mpi-check="${t.packageName}"]`);if(he!==null){let ne=he.querySelector("[data-mpi-label]");(ne===null||ne.textContent!==jn(document.documentElement.lang).check)&&g();return}let Qe=document.createElement("span");Qe.dataset.mpiCheck=t.packageName,Qe.className="mpi-check-host",ue.append(Qe),o=Qe,f=za(Qe),g()}e(j,"applyControls");let W=new MutationObserver(()=>{A===void 0&&(A=window.requestAnimationFrame(()=>{A=void 0,j()}))});W.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["lang"]});let z,U=e(async()=>z||(z=(async()=>{try{return a=await Oa(r,"GET",i.signal),j(),a}finally{z=void 0}})(),z),"load"),pe=e(()=>{j(),(!t.isEnabled||t.isEnabled())&&U().catch(()=>{})},"onToggle");return typeof window<"u"&&window.addEventListener("dsham-update-toggle",pe),j(),U().catch(()=>{}),()=>{i.abort(),W.disconnect(),S(),w(),typeof window<"u"&&window.removeEventListener("dsham-update-toggle",pe),A!==void 0&&window.cancelAnimationFrame(A),document.querySelectorAll(`[data-mpi-check="${t.packageName}"],.mpi-version[data-package="${t.packageName}"]`).forEach(ie=>ie.remove())}}e(Fa,"observePluginUpdate");var tn=require("@deepseek-ai/dsh-client-ui-primitives");var Be=oa,ii="@michengai/dsh-archive-manager",fr="archived-sessions",oi=4,Ba="dsham-sidebar-entry-style",li=`
|
|
15
15
|
.dsham_mainPanel{box-sizing:border-box;height:100%;min-height:0;overflow-y:auto;display:flex;flex-direction:column;align-items:center;padding:28px clamp(24px,4vw,48px) 48px}
|
|
16
16
|
.dsham_mainPanel>*{width:100%;max-width:960px}
|
|
17
17
|
.dsham_bundle_row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;border-bottom:0.5px solid var(--dsw-alias-border-l2)}
|
|
@@ -19,9 +19,9 @@ window.__ModuleLoader__.load({
|
|
|
19
19
|
.dsham_bundle_title{font-size:13px;font-weight:500;line-height:20px;color:var(--dsw-alias-label-primary)}
|
|
20
20
|
.dsham_bundle_desc{font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary)}
|
|
21
21
|
.dsham_bundle_error{font-size:12px;line-height:16px;color:var(--dsw-alias-state-error-primary,#ef4444);margin-top:2px}
|
|
22
|
-
`;function Ba(){if(typeof document>"u"||typeof document.getElementById!="function"||document.getElementById(Fa)!==null||typeof document.createElement!="function")return;let t=document.createElement("style");t.id=Fa,t.textContent=li,(document.head??document.documentElement)?.appendChild?.(t)}e(Ba,"ensureSidebarEntryStyle");function ci(t){let r=t&&typeof t.size=="number"?t.size:16;return We(nn.IconArchiveOutlineMedium,{size:r})}e(ci,"ArchiveSidebarIcon");function fr(t){Ba();let{t:r,location:i,onLocationChange:a,errorMessage:o,enabled:f=!1,onToggle:c,disabled:k,onlineUpdateEnabled:y=!0,onToggleOnlineUpdate:I,onlineUpdateDisabled:w,onlineUpdateLocked:g=!1,sidebarFavoriteStarEnabled:S=!0,onToggleSidebarFavoriteStar:D,sidebarFavoriteStarDisabled:j}=t,U=i??(f?"both":"settings"),L=e(he=>{(he==="both"||he==="sidebar"||he==="settings")&&(typeof a=="function"?a(he):typeof c=="function"&&c(he!=="settings"))},"handleLocationChange"),H=[We("div",{key:"entry-location",className:"dsham_bundle_row"},We("div",{className:"dsham_bundle_label_box"},We("span",{className:"dsham_bundle_title"},r("entry.location.title")),We("span",{className:"dsham_bundle_desc"},r("entry.location.desc")),o?We("span",{className:"dsham_bundle_error",role:"alert"},o):null),We(nn.SegmentedControl,{id:"dsham-bundle-entry-location",value:U,onChange:L,label:r("entry.location.title"),disabled:k,options:[{value:"both",label:r("entry.location.both")},{value:"sidebar",label:r("entry.location.sidebar")},{value:"settings",label:r("entry.location.settings")}]}))];if(typeof I=="function"){let he=g?`${r("update.entry.desc")} (${r("update.entry.locked")})`:r("update.entry.desc");H.push(We("div",{key:"online-update",className:"dsham_bundle_row"},We("div",{className:"dsham_bundle_label_box"},We("span",{className:"dsham_bundle_title"},r("update.entry.title")),We("span",{className:"dsham_bundle_desc"},he)),We(nn.Switch,{checked:y,onChange:I,label:r("update.entry.toggle"),disabled:w||g,title:g?r("update.entry.locked"):void 0})))}return typeof D=="function"&&H.push(We("div",{key:"sidebar-favorite-star",className:"dsham_bundle_row"},We("div",{className:"dsham_bundle_label_box"},We("span",{className:"dsham_bundle_title"},r("sidebar.favoriteStar.title")),We("span",{className:"dsham_bundle_desc"},r("sidebar.favoriteStar.desc"))),We(nn.Switch,{checked:S,onChange:D,label:r("sidebar.favoriteStar.toggle"),disabled:j}))),We(sa,null,H)}e(fr,"ArchiveBundleConfigCard");function gr(t){let[r,i]=Ut(t.getLocation),[a,o]=Ut(t.getOnlineUpdateEnabled?t.getOnlineUpdateEnabled:()=>!0),[f,c]=Ut(t.getOnlineUpdateLocked?t.getOnlineUpdateLocked:()=>!1),[k,y]=Ut(t.getSidebarFavoriteStarEnabled?t.getSidebarFavoriteStarEnabled:()=>!0),[I,w]=Ut(null),[g,S]=Ut(!1),[D,j]=Ut(!1),[U,L]=Ut(!1);oa(()=>{let V=e(()=>{i(t.getLocation()),w(null),t.getOnlineUpdateEnabled&&o(t.getOnlineUpdateEnabled()),t.getOnlineUpdateLocked&&c(t.getOnlineUpdateLocked()),t.getSidebarFavoriteStarEnabled&&y(t.getSidebarFavoriteStarEnabled())},"syncState");return V(),t.subscribe(V)},[t]);let H=e(V=>{S(!0),w(null),i(V),t.setLocation(V).catch(ce=>{console.error("archive-manager: setLocation failed:",ce),i(t.getLocation()),w(t.t("entry.location.saveFailed")||"\u4FDD\u5B58\u5165\u53E3\u8BBE\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u91CD\u542F\u5BBF\u4E3B\u8FDB\u7A0B")}).finally(()=>{S(!1)})},"onLocationChange"),he=t.setOnlineUpdate?V=>{t.getOnlineUpdateLocked?.()||(j(!0),o(V),t.setOnlineUpdate(V).catch(()=>{t.getOnlineUpdateEnabled&&o(t.getOnlineUpdateEnabled())}).finally(()=>{j(!1)}))}:void 0,se=t.setSidebarFavoriteStar?V=>{L(!0),y(V),t.setSidebarFavoriteStar(V).catch(()=>{t.getSidebarFavoriteStarEnabled&&y(t.getSidebarFavoriteStarEnabled())}).finally(()=>{L(!1)})}:void 0;return We(fr,{t:t.t,location:r,errorMessage:I,disabled:g,onLocationChange:H,onlineUpdateEnabled:a,onlineUpdateDisabled:D||f,onlineUpdateLocked:f,onToggleOnlineUpdate:he,sidebarFavoriteStarEnabled:k,sidebarFavoriteStarDisabled:U,onToggleSidebarFavoriteStar:se})}e(gr,"ArchiveBundleConfigCardWrapper");function vr(t,r){if(Ba(),!t.locale)return{getLocation:e(()=>"settings","getLocation"),setLocation:e(async()=>"settings","setLocation"),isSettingsSectionEnabled:e(()=>!0,"isSettingsSectionEnabled"),isEnabled:e(()=>!1,"isEnabled"),isSupported:e(()=>!1,"isSupported"),setEnabled:e(async()=>!1,"setEnabled"),isOnlineUpdateEnabled:e(()=>!0,"isOnlineUpdateEnabled"),isOnlineUpdateLocked:e(()=>!1,"isOnlineUpdateLocked"),setOnlineUpdate:e(async()=>!1,"setOnlineUpdate"),isSidebarFavoriteStarEnabled:e(()=>!0,"isSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:e(async()=>!1,"setSidebarFavoriteStar"),destroy:e(()=>{},"destroy")};let{callApi:i,renderPanel:a,ns:o}=r,f="settings",c=!1,k=!1,y=null,I=null,w=0,g=!1,S,D=new Set,j=e(()=>f==="both"||f==="sidebar","isSidebarEnabled"),U=e(()=>f==="both"||f==="settings","isSettingsSectionEnabled"),L=e(()=>{if(!g)for(let O of D)try{O()}catch{}},"notify"),H=e(()=>{if(g||!k||!j()||y)return;let O=t.slots.register({name:"main",key:mr,locale:o,inject:e(()=>{let Ne=typeof r.injectProps=="function"?r.injectProps():{};return Object.assign({t:t.locale?.bind?t.locale.bind(o):void 0},Ne)},"inject")},Ne=>We("div",{className:"dsham_mainPanel"},a(Ne)));y=typeof O=="function"?O:()=>{}},"mountMain"),he=e(()=>{if(y){try{y()}catch{}y=null}},"unmountMain"),se=e(()=>{if(g||!c||!j()||I)return;let O=t.slots.register({name:"sidebar.panellist",id:mr,order:oi,label:e(()=>t.locale.bind(o)("archives.title"),"label"),locale:o},Ne=>ci(Ne&&typeof Ne=="object"&&"size"in Ne?Ne:void 0));I=typeof O=="function"?O:()=>{}},"mountRow"),V=e(()=>{if(I){try{I()}catch{}I=null}},"unmountRow"),ce=e(()=>{if(!g)if(j())H(),se();else{if(S?.panelInfo&&typeof S.selectPanel=="function")try{S.panelInfo.getSnapshot().activePanelId===mr&&S.selectPanel(null)}catch{}V(),he()}},"sync"),de=e(async O=>{if(g)return f;let Ne=++w,T=f;if(f=O,ce(),L(),typeof r.onLocationChange=="function")try{r.onLocationChange(O)}catch{}try{return await i("/sidebar-entry",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({location:O})}),O}catch(ne){if(Ne===w&&(f=T,ce(),L(),typeof r.onLocationChange=="function"))try{r.onLocationChange(T)}catch{}throw ne}},"setLocation"),Xe=e(async O=>(await de(O?"both":"settings"),j()),"setEnabled"),te=!0,J=!1,dt=0,vt=e(async O=>{if(g||J)return te;let Ne=++dt;if(te=O,L(),typeof r.onOnlineUpdateChange=="function")try{r.onOnlineUpdateChange(O)}catch{}try{if(await i("/online-update",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:O})}),Ne===dt&&typeof r.onOnlineUpdateChange=="function")try{r.onOnlineUpdateChange(O)}catch{}return O}catch(T){if(Ne===dt&&(te=!O,L(),typeof r.onOnlineUpdateChange=="function"))try{r.onOnlineUpdateChange(!O)}catch{}throw T}},"setOnlineUpdate"),Ye=!0,ke=0,ut=e(async O=>{if(g)return Ye;let Ne=++ke;if(Ye=O,L(),typeof r.onSidebarFavoriteStarChange=="function")try{r.onSidebarFavoriteStarChange(O)}catch{}try{return await i("/sidebar-favorite-star",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:O})}),O}catch(T){if(Ne===ke&&(Ye=!O,L(),typeof r.onSidebarFavoriteStarChange=="function"))try{r.onSidebarFavoriteStarChange(!O)}catch{}throw T}},"setSidebarFavoriteStar"),at=w;i("/sidebar-entry").then(O=>{if(!g&&w===at&&O&&(O.location==="both"||O.location==="sidebar"||O.location==="settings"?f=O.location:typeof O.enabled=="boolean"&&(f=O.enabled?"both":"settings"),ce(),L(),typeof r.onLocationChange=="function"))try{r.onLocationChange(f)}catch{}}).catch(()=>{});let rn=dt;i("/online-update").then(O=>{if(!g&&dt===rn&&O&&typeof O.enabled=="boolean"&&(te=O.enabled,O.locked===!0&&(J=!0),L(),typeof r.onOnlineUpdateChange=="function"))try{r.onOnlineUpdateChange(te)}catch{}}).catch(()=>{});let zt=ke;i("/sidebar-favorite-star").then(O=>{if(!g&&ke===zt&&O&&typeof O.enabled=="boolean"&&(Ye=O.enabled,L(),typeof r.onSidebarFavoriteStarChange=="function"))try{r.onSidebarFavoriteStarChange(Ye)}catch{}}).catch(()=>{});let an=t;return typeof an.inject=="function"&&an.inject(["layout"],O=>{!g&&O.layout&&(S=O.layout)}),t.slots.inject("main",()=>{if(!g)return k=!0,H(),()=>{k=!1,he()}}),t.slots.inject("sidebar.panellist",()=>{if(!g)return c=!0,se(),()=>{c=!1,V()}}),t.slots.inject("plugins.bundle.config",()=>{if(!g)return t.slots.register({name:"plugins.bundle.config",key:ii,locale:o},O=>O&&O.view==="summary"?null:We(gr,{t:t.locale.bind(o),getLocation:e(()=>f,"getLocation"),setLocation:de,getEnabled:e(()=>j(),"getEnabled"),setSidebar:Xe,getOnlineUpdateEnabled:e(()=>te,"getOnlineUpdateEnabled"),setOnlineUpdate:vt,getOnlineUpdateLocked:e(()=>J,"getOnlineUpdateLocked"),getSidebarFavoriteStarEnabled:e(()=>Ye,"getSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:ut,subscribe:e(Ne=>(D.add(Ne),()=>{D.delete(Ne)}),"subscribe")}))}),{getLocation:e(()=>f,"getLocation"),setLocation:de,isSettingsSectionEnabled:U,isEnabled:e(()=>j(),"isEnabled"),isSupported:e(()=>c,"isSupported"),setEnabled:Xe,isOnlineUpdateEnabled:e(()=>te,"isOnlineUpdateEnabled"),isOnlineUpdateLocked:e(()=>J,"isOnlineUpdateLocked"),setOnlineUpdate:vt,isSidebarFavoriteStarEnabled:e(()=>Ye,"isSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:ut,destroy:e(()=>{g||(g=!0,w++,dt++,ke++,S=void 0,D.clear(),V(),he())},"destroy")}}e(vr,"setupSidebarEntry");function br(t){if(typeof t!="string"||t.length===0||t.length>1024)throw new TypeError("\u4F1A\u8BDD ID \u957F\u5EA6\u987B\u4E3A 1\uFF5E1024 \u4E2A\u5B57\u7B26");return t}e(br,"checkedId");var di={parse(t){let r=oe(t);if(!r||typeof r!="object"||typeof r.favorite!="boolean")throw new TypeError("\u6536\u85CF\u72B6\u6001\u5FC5\u987B\u4E3A\u5E03\u5C14\u503C");return{sessionId:br(r.sessionId),favorite:r.favorite}}},ui={parse(t){let r=oe(t);if(!r||!Array.isArray(r.favoriteSessionIds)||r.favoriteSessionIds.length>1e5)throw new TypeError("\u6536\u85CF\u96C6\u5408\u65E0\u6548");return{favoriteSessionIds:[...new Set(r.favoriteSessionIds.map(br))]}},safeParse(t){try{return{success:!0,data:this.parse(t)}}catch(r){return{success:!1,error:r}}}};function Ha(){let t=e((r,i)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${r}`,create:e(()=>i,"create"),schema:i}),"codec");return["favoriteSessions","setSessionFavorite"].map(r=>({id:`@michengai/dsh-archive-manager#workspaceRegistry/${r}`,service:"workspaceRegistry",namespace:"workspaceRegistry",method:r,invocation:{kind:"direct"},parameters:r==="favoriteSessions"?[]:[{name:"input",wire:"input",source:"json",codec:t("FavoriteInput",di)}],result:t("FavoriteState",ui),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(Ha,"favoriteInvocations");function yr(t,{days:r,now:i=Date.now(),favorites:a=new Set,currentId:o,pending:f=new Map}){if(!t||!Number.isInteger(r)||r<1||r>36500||a.has(t.id)||t.id===o||(t.retainedBy?.mainView??0)>0||t.running||(t.runningSubagentCount??0)>0||t.pendingInteraction!=null||f.has(t.id))return!1;let c=typeof t.updatedAt=="number"?t.updatedAt:Date.parse(t.updatedAt??"");return Number.isFinite(c)&&c<=i-r*864e5}e(yr,"idleArchiveCandidate");async function Vn(t,r,{onProgress:i,refresh:a}={}){let o=[...new Set(t.map(br))],f={requested:o,succeeded:[],skipped:[],failures:[],remaining:[],refreshError:null},c=e(()=>i?.({total:o.length,done:f.succeeded.length+f.skipped.length+f.failures.length,succeeded:f.succeeded.length,skipped:f.skipped.length,failed:f.failures.length}),"report");c();for(let k of o){try{(await r(k)?f.succeeded:f.skipped).push(k)}catch(y){f.failures.push({sessionId:k,message:y instanceof Error?y.message:String(y)}),f.remaining.push(k)}c()}try{await a?.()}catch(k){f.refreshError=k instanceof Error?k.message:String(k)}return f}e(Vn,"runSessionBatch");function Ua({workspaces:t,sessions:r,archive:i,restore:a,deleteOne:o,getFavorites:f,refresh:c,currentSessionId:k}){return async(y,I,w={})=>{if(!["archive","restore","undo","delete"].includes(y))throw new TypeError("\u672A\u77E5\u6279\u91CF\u64CD\u4F5C");return Vn(I,async g=>{let D=t.getSnapshot().archivedSessionIds.includes(g);if(y==="archive"){if(D||!r.getSnapshot().byId[g])return!1;if(w.idleDays!==void 0){let he=new Set((await f()).favoriteSessionIds),se=r.getSnapshot();if(!yr(se.byId[g],{days:w.idleDays,favorites:he,currentId:k(se),pending:w.getPending?.()??w.pending}))return!1}return await i(g),t.getSnapshot().archivedSessionIds.includes(g)}return D?y==="delete"?(await o(g),!0):!((await a(g))?.archivedSessionIds??t.getSnapshot().archivedSessionIds).includes(g):!1},{onProgress:w.onProgress,refresh:c})}}e(Ua,"createSessionOrganizer");function hi(t){return!t||t<=0?"0 B":t<1024?t+" B":t<1024*1024?(t/1024).toFixed(1)+" KB":(t/(1024*1024)).toFixed(1)+" MB"}e(hi,"formatBytes");function Wa(t,r){let i=t.createElement;function a(f,c){return i(r??(y=>i("button",{type:"button",disabled:y.disabled,onClick:y.onClick},y.children)),{variant:"outline",size:"sm",...c},f)}e(a,"textButton");function o({title:f,failures:c,separator:k}){let[y,I]=t.useState(!1),w=i("ul",null,c.map(g=>i("li",{key:g.sessionId},g.sessionId,k,g.message)));return i(Un,{title:f,open:y,onToggle:e(()=>I(g=>!g),"onToggle")},w)}return e(o,"FailureDetails"),e(function({t:c,archived:k,busy:y,ready:I,days:w,onDays:g,count:S,onPreview:D,progress:j,result:U,onRetry:L,undoCount:H,onUndo:he,onReload:se,orphanCount:V=0,orphanSizeBytes:ce=0,orphanCleaning:de=!1,onCleanOrphans:Xe,cacheCount:te=0,cacheRepair:J,onRebuildCaches:dt,onRetryCaches:vt,onReloadCaches:Ye,onDismissCaches:ke}){return i(t.Fragment,null,i("style",null,".dsham_organizer,.dsham_batchFeedback{display:grid;gap:12px;margin:0 0 16px;padding:14px 16px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2)}.dsham_organizerControls{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.dsham_organizer label{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--dsw-alias-label-primary)}.dsham_number{width:88px;height:32px;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}.dsham_number:hover{border-color:var(--dsw-alias-border-l3)}.dsham_number:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}.dsham_disclosure{display:inline-flex;align-items:center;gap:6px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;cursor:pointer}.dsham_foldChevron{transition:transform 150ms ease}.dsham_foldChevron.is-open{transform:rotate(180deg)}.dsham_organizer p,.dsham_batchFeedback p{margin:0;font-size:12px;color:var(--dsw-alias-label-secondary)}.dsham_batchFeedback progress{width:100%}.dsham_batchFeedback details{font-size:12px;overflow-wrap:anywhere}.dsham_archivePreview{max-height:260px;overflow:auto;display:grid;gap:8px;padding:8px 0}.dsham_archivePreview label{display:flex;gap:8px;align-items:center;overflow-wrap:anywhere}"),(!k||!I)&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},!I&&a(c("organizer.reloadFavorites"),{disabled:y,onClick:se}),!k&&i(t.Fragment,null,i("label",null,c("organizer.idleDays"),i(ca,{min:1,max:36500,value:w===""?null:Number(w),disabled:y,"aria-label":c("organizer.idleDays"),onChange:e(ut=>g(ut==null?"":String(ut)),"onChange")})),a(c("organizer.preview",{n:S}),{disabled:y||!I||S===0,onClick:D}))),!k&&i("p",null,c("organizer.rules"))),V>0&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},i("strong",null,c("organizer.orphanTitle",{n:V})),Xe&&a(c(de?"organizer.cleaning":"organizer.cleanOrphans"),{disabled:y||de,onClick:Xe})),i("p",null,c("organizer.orphanDesc",{size:hi(ce)}))),te>0&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},i("strong",null,c("organizer.cacheTitle",{n:te})),dt&&a(c(J?.busy?"organizer.cacheRebuilding":"organizer.cacheRebuild"),{disabled:y||J?.busy,onClick:dt})),i("p",null,c("organizer.cacheDesc"))),J&&(J.result||J.progress||J.error||J.refreshError)&&i("section",{className:"dsham_batchFeedback","aria-label":c("organizer.cacheRebuild")},J.progress&&i("div",{role:"status"},i("progress",{value:J.progress.done,max:Math.max(1,J.progress.total)}),c("organizer.progressCount",J.progress)),J.result&&i("div",{role:"status"},i("p",null,c("organizer.result",{succeeded:J.result.rebuiltSessionIds.length,skipped:J.result.skippedSessionIds.length,failed:J.result.failures.length})),J.result.failures.length>0&&i(o,{title:c("organizer.failureDetails"),failures:J.result.failures,separator:c("common.separator")}),J.result.failures.length>0&&vt&&a(c("organizer.cacheRetry",{n:J.result.failures.length}),{disabled:y||J.busy,onClick:vt})),J.error&&i("p",{role:"alert"},c("organizer.cacheError",{detail:J.error})),J.refreshError&&i("p",{role:"alert"},c("organizer.refreshError",{detail:J.refreshError})),i("div",{className:"dsham_organizerControls"},Ye&&a(c("organizer.cacheCheck"),{disabled:y||J.busy,onClick:Ye}),ke&&a(c("organizer.dismiss"),{disabled:y||J.busy,onClick:ke}))),(j||U||H>0)&&i("section",{className:"dsham_batchFeedback","aria-label":c("organizer.feedback")},j&&i("div",{role:"status","aria-live":"polite"},i("progress",{value:j.done,max:Math.max(1,j.total),"aria-label":c("organizer.progress")}),c("organizer.progressCount",{done:j.done,total:j.total})),U&&i("div",{role:"status"},i("strong",null,c(`organizer.${U.kind??"archive"}Result`)),i("p",null,c("organizer.result",{succeeded:U.succeeded.length,skipped:U.skipped.length,failed:U.failures.length})),U.failures.length>0&&i(o,{title:c("organizer.failureDetails"),failures:U.failures,separator:c("common.separator")}),U.refreshError&&i("p",{role:"alert"},c("organizer.refreshError",{detail:U.refreshError})),U.remaining.length>0&&a(c("organizer.retry",{n:U.remaining.length}),{disabled:y,onClick:L})),H>0&&i("div",{className:"dsham_organizerControls"},a(c("organizer.undo",{n:H}),{disabled:y,onClick:he}),i("p",null,c("organizer.undoHint")))))},"OrganizerPanel")}e(Wa,"createOrganizerPanel");var qa={"organizer.cacheTitle":"\u53D1\u73B0 {n} \u4E2A\u4F1A\u8BDD\u7F3A\u5C11\u53EF\u7528\u5217\u8868\u7F13\u5B58","organizer.cacheDesc":"\u68C0\u67E5\u5DE5\u4F5C\u533A\u3001\u672A\u5206\u7EC4\u53CA\u5F52\u6863\u666E\u901A\u4F1A\u8BDD\u7684\u5934\u90E8\u4E0E\u5B98\u65B9\u7F13\u5B58\u3002\u70B9\u51FB\u540E\u9010\u6761\u53EA\u8BFB\u65E5\u5FD7\u5E76\u91CD\u5EFA\u5B98\u65B9\u5217\u8868\u7F13\u5B58\uFF1B\u8DF3\u8FC7\u6D3B\u52A8\u4F1A\u8BDD\uFF0C\u4E0D\u6253\u5F00\u4F1A\u8BDD\u3001\u4E0D\u8C03\u7528\u6A21\u578B\uFF0C\u4E5F\u4E0D\u6539\u53D8\u5F52\u6863\u6216\u5B9A\u65F6\u4EFB\u52A1\u3002\u8D85\u65F6\u8868\u793A\u4FDD\u5B58\u672A\u786E\u8BA4\uFF0C\u53EF\u91CD\u8BD5\u3002","organizer.cacheRebuild":"\u91CD\u5EFA\u5217\u8868\u7F13\u5B58","organizer.cacheRebuilding":"\u91CD\u5EFA\u4E2D\u2026","organizer.cacheRetry":"\u91CD\u8BD5\u5931\u8D25 {n} \u6761","organizer.cacheCheck":"\u5237\u65B0\u5217\u8868\u5E76\u91CD\u65B0\u68C0\u6D4B","organizer.cacheError":"\u7F13\u5B58\u68C0\u6D4B\u5931\u8D25\uFF1A{detail}","organizer.dismiss":"\u5B8C\u6210","organizer.feedback":"\u64CD\u4F5C\u53CD\u9988","organizer.allSessions":"\u5168\u90E8\u4F1A\u8BDD","organizer.favoriteFilter":"\u6536\u85CF\u7B5B\u9009","organizer.archiveResult":"\u5F52\u6863\u7ED3\u679C","organizer.restoreResult":"\u6062\u590D\u7ED3\u679C","organizer.deleteResult":"\u5220\u9664\u7ED3\u679C","organizer.undoResult":"\u64A4\u56DE\u7ED3\u679C","organizer.favorite":"\u6536\u85CF","organizer.unfavorite":"\u53D6\u6D88\u6536\u85CF","organizer.favoritesOnly":"\u53EA\u770B\u6536\u85CF","organizer.reloadFavorites":"\u91CD\u65B0\u52A0\u8F7D\u6536\u85CF","organizer.idleDays":"\u95F2\u7F6E\u5929\u6570","organizer.preview":"\u9884\u89C8\u95F2\u7F6E\u5F52\u6863\uFF08{n}\uFF09","organizer.rules":"\u6309\u6700\u540E\u6D3B\u52A8\u65F6\u95F4\u7B5B\u9009\uFF0C\u9075\u5FAA\u5F53\u524D\u5217\u8868\u7B5B\u9009\u6761\u4EF6\uFF1B\u6392\u9664\u6536\u85CF\u3001\u5F53\u524D\u6253\u5F00\u3001\u6B63\u5728\u6267\u884C\u53CA\u7B49\u5F85\u4EA4\u4E92\u7684\u4F1A\u8BDD\u3002","organizer.progress":"\u6279\u91CF\u64CD\u4F5C\u8FDB\u5EA6","organizer.progressCount":"\u5DF2\u5904\u7406 {done} / {total}","organizer.result":"\u6210\u529F {succeeded} \xB7 \u8DF3\u8FC7 {skipped} \xB7 \u5931\u8D25 {failed}","organizer.failureDetails":"\u67E5\u770B\u5931\u8D25\u8BE6\u60C5","organizer.refreshError":"\u64CD\u4F5C\u7ED3\u679C\u5DF2\u4FDD\u7559\uFF0C\u4F46\u5217\u8868\u5237\u65B0\u5931\u8D25\uFF1A{detail}","organizer.retry":"\u91CD\u8BD5\u5269\u4F59 {n} \u6761","organizer.undo":"\u64A4\u56DE\u672C\u6B21\u5F52\u6863\uFF08{n}\uFF09","organizer.undoHint":"\u4EC5\u4FDD\u7559\u672C\u6B21\u6253\u5F00\u7BA1\u7406\u9875\u671F\u95F4\u6700\u8FD1\u4E00\u6279\u5F52\u6863\uFF1B\u5173\u95ED\u9875\u9762\u6216\u5237\u65B0\u540E\u6E05\u9664\u3002\u64A4\u56DE\u4E0D\u4F1A\u6062\u590D\u5DF2\u5220\u9664\u7684\u4F1A\u8BDD\u3002","organizer.idleConfirm":"\u8BF7\u68C0\u67E5\u4EE5\u4E0B\u5019\u9009\uFF0C\u53EF\u53D6\u6D88\u52FE\u9009\uFF1B\u6267\u884C\u524D\u518D\u6B21\u6392\u9664\u6536\u85CF\u53CA\u6D3B\u8DC3\u4F1A\u8BDD\u3002","organizer.manualConfirm":"\u4EC5\u5F52\u6863\u4EE5\u4E0B\u52FE\u9009\u4F1A\u8BDD\uFF1B\u53EF\u9010\u6761\u53D6\u6D88\u3002\u5F52\u6863\u540E\u53EF\u64A4\u56DE\u672C\u6279\u64CD\u4F5C\u3002","organizer.orphanTitle":"\u53D1\u73B0 {n} \u4E2A\u65E0\u4E3B\u5B64\u513F\u5B50\u4EE3\u7406","organizer.orphanDesc":"\u6BCD\u4F1A\u8BDD\u5DF2\u88AB\u5916\u90E8\u5220\u9664\uFF0C\u8FD9\u4E9B\u5B50\u4EE3\u7406\u5728\u65E5\u5E38\u804A\u5929\u5217\u8868\u4E2D\u4E0D\u53EF\u89C1\uFF0C\u5171\u5360\u7528\u7EA6 {size} \u78C1\u76D8\u7A7A\u95F4\u3002\u6E05\u7406\u4E0D\u53EF\u64A4\u9500\u3002","organizer.cleanOrphans":"\u6E05\u7406\u5168\u90E8\u5B64\u513F","organizer.cleaning":"\u6E05\u7406\u4E2D\u2026","organizer.orphanCleanSuccess":"\u5DF2\u6210\u529F\u6E05\u7406 {n} \u4E2A\u65E0\u4E3B\u5B50\u4EE3\u7406\u4F1A\u8BDD\u3002"},Va={"organizer.cacheTitle":"Found {n} sessions without usable list caches","organizer.cacheDesc":"Checks headers and official caches for workspace, ungrouped, and archived ordinary sessions. On click, reads logs one at a time and rebuilds official caches. Skips active sessions; never opens sessions, calls models or changes archives or schedules. Timeout means persistence is unconfirmed and can be retried.","organizer.cacheRebuild":"Rebuild list caches","organizer.cacheRebuilding":"Rebuilding\u2026","organizer.cacheRetry":"Retry {n} failed","organizer.cacheCheck":"Refresh lists and check again","organizer.cacheError":"Cache check failed: {detail}","organizer.dismiss":"Done","organizer.feedback":"Operation feedback","organizer.allSessions":"All sessions","organizer.favoriteFilter":"Favorites filter","organizer.archiveResult":"Archive results","organizer.restoreResult":"Restore results","organizer.deleteResult":"Delete results","organizer.undoResult":"Undo results","organizer.favorite":"Favorite","organizer.unfavorite":"Unfavorite","organizer.favoritesOnly":"Favorites only","organizer.reloadFavorites":"Reload favorites","organizer.idleDays":"Idle days","organizer.preview":"Preview idle archives ({n})","organizer.rules":"Uses last activity, the current list filters. Excludes favorites, open, running and waiting sessions.","organizer.progress":"Batch progress","organizer.progressCount":"Processed {done} / {total}","organizer.result":"Succeeded {succeeded} \xB7 Skipped {skipped} \xB7 Failed {failed}","organizer.failureDetails":"Failure details","organizer.refreshError":"Results retained, but refresh failed: {detail}","organizer.retry":"Retry remaining {n}","organizer.undo":"Undo this archive batch ({n})","organizer.undoHint":"Only the latest archive batch while this page is open is retained. Closing or refreshing clears undo. Deleted sessions cannot be restored.","organizer.idleConfirm":"Review and deselect candidates. Favorites and active sessions are checked again before archiving.","organizer.manualConfirm":"Only checked sessions below will be archived. You can undo this batch afterward.","organizer.orphanTitle":"Found {n} orphan subagents","organizer.orphanDesc":"Parent sessions were deleted externally. These subagents are hidden from normal chat lists and occupy ~{size} disk space. Removal cannot be undone.","organizer.cleanOrphans":"Clean up all orphans","organizer.cleaning":"Cleaning up\u2026","organizer.orphanCleanSuccess":"Successfully cleaned up {n} orphan subagent sessions."},$a={"organizer.cacheTitle":"\u041D\u0430\u0439\u0434\u0435\u043D\u043E {n} \u0441\u0435\u0441\u0441\u0438\u0439 \u0431\u0435\u0437 \u043F\u0440\u0438\u0433\u043E\u0434\u043D\u043E\u0433\u043E \u043A\u0435\u0448\u0430 \u0441\u043F\u0438\u0441\u043A\u0430","organizer.cacheDesc":"\u041F\u0440\u043E\u0432\u0435\u0440\u044F\u044E\u0442\u0441\u044F \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 \u0438 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u0435\u0448 \u0441\u0435\u0441\u0441\u0438\u0439 \u0440\u0430\u0431\u043E\u0447\u0438\u0445 \u043E\u0431\u043B\u0430\u0441\u0442\u0435\u0439, \u0431\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B \u0438 \u0430\u0440\u0445\u0438\u0432\u0430. \u041F\u043E \u043D\u0430\u0436\u0430\u0442\u0438\u044E \u0436\u0443\u0440\u043D\u0430\u043B\u044B \u0447\u0438\u0442\u0430\u044E\u0442\u0441\u044F \u043F\u043E \u043E\u0434\u043D\u043E\u043C\u0443 \u0434\u043B\u044F \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u043A\u0435\u0448\u0430. \u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u043F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u044E\u0442\u0441\u044F; \u0441\u0435\u0441\u0441\u0438\u0438 \u043D\u0435 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u044E\u0442\u0441\u044F, \u043C\u043E\u0434\u0435\u043B\u0438 \u043D\u0435 \u0432\u044B\u0437\u044B\u0432\u0430\u044E\u0442\u0441\u044F, \u0430\u0440\u0445\u0438\u0432\u044B \u0438 \u0440\u0430\u0441\u043F\u0438\u0441\u0430\u043D\u0438\u044F \u043D\u0435 \u043C\u0435\u043D\u044F\u044E\u0442\u0441\u044F. \u0422\u0430\u0439\u043C-\u0430\u0443\u0442 \u043E\u0437\u043D\u0430\u0447\u0430\u0435\u0442 \u043D\u0435\u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043D\u043D\u043E\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435; \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u043F\u043E\u0432\u0442\u043E\u0440.","organizer.cacheRebuild":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043A\u0435\u0448 \u0441\u043F\u0438\u0441\u043A\u043E\u0432","organizer.cacheRebuilding":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435\u2026","organizer.cacheRetry":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C {n} \u043E\u0448\u0438\u0431\u043E\u043A","organizer.cacheCheck":"\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u043F\u0438\u0441\u043A\u0438 \u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C","organizer.cacheError":"\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043A\u0435\u0448\u0430: {detail}","organizer.dismiss":"\u0413\u043E\u0442\u043E\u0432\u043E","organizer.feedback":"\u041E\u0442\u0437\u044B\u0432 \u043E\u0431 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438","organizer.allSessions":"\u0412\u0441\u0435 \u0441\u0435\u0441\u0441\u0438\u0438","organizer.favoriteFilter":"\u0424\u0438\u043B\u044C\u0442\u0440 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E","organizer.archiveResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438","organizer.restoreResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F","organizer.deleteResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u044F","organizer.undoResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u043E\u0442\u043C\u0435\u043D\u044B","organizer.favorite":"\u0412 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435","organizer.unfavorite":"\u0423\u0431\u0440\u0430\u0442\u044C \u0438\u0437 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E","organizer.favoritesOnly":"\u0422\u043E\u043B\u044C\u043A\u043E \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435","organizer.reloadFavorites":"\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435","organizer.idleDays":"\u0414\u043D\u0438 \u043F\u0440\u043E\u0441\u0442\u043E\u044F","organizer.preview":"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0430\u0440\u0445\u0438\u0432\u0430 \u043F\u0440\u043E\u0441\u0442\u043E\u044F ({n})","organizer.rules":"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044E\u044E \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C \u0438 \u0442\u0435\u043A\u0443\u0449\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B \u0441\u043F\u0438\u0441\u043A\u0430. \u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435, \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435, \u0437\u0430\u043F\u0443\u0449\u0435\u043D\u043D\u044B\u0435 \u0438 \u043E\u0436\u0438\u0434\u0430\u044E\u0449\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438.","organizer.progress":"\u0425\u043E\u0434 \u043F\u0430\u043A\u0435\u0442\u043D\u043E\u0439 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438","organizer.progressCount":"\u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043E {done} / {total}","organizer.result":"\u0423\u0441\u043F\u0435\u0448\u043D\u043E {succeeded} \xB7 \u041F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E {skipped} \xB7 \u041E\u0448\u0438\u0431\u043E\u043A {failed}","organizer.failureDetails":"\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438 \u043E\u0448\u0438\u0431\u043E\u043A","organizer.refreshError":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B, \u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043F\u0438\u0441\u043A\u0430 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C: {detail}","organizer.retry":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u043E\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044F {n}","organizer.undo":"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u044D\u0442\u0443 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044E ({n})","organizer.undoHint":"\u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u043F\u0430\u043A\u0435\u0442\u043D\u0430\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F, \u043F\u043E\u043A\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u0430 \u044D\u0442\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430. \u0417\u0430\u043A\u0440\u044B\u0442\u0438\u0435 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044B\u0432\u0430\u0435\u0442 \u043E\u0442\u043C\u0435\u043D\u0443. \u0423\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043D\u0435\u043B\u044C\u0437\u044F.","organizer.idleConfirm":"\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043A\u0430\u043D\u0434\u0438\u0434\u0430\u0442\u043E\u0432, \u043C\u043E\u0436\u043D\u043E \u0441\u043D\u044F\u0442\u044C \u043E\u0442\u043C\u0435\u0442\u043A\u0443. \u041F\u0435\u0440\u0435\u0434 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0435\u0439 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435 \u0438 \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u044E\u0442\u0441\u044F \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E.","organizer.manualConfirm":"\u0411\u0443\u0434\u0443\u0442 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u044B \u0442\u043E\u043B\u044C\u043A\u043E \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435 \u043D\u0438\u0436\u0435 \u0441\u0435\u0441\u0441\u0438\u0438. \u042D\u0442\u0443 \u043F\u0430\u043A\u0435\u0442\u043D\u0443\u044E \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044E \u043C\u043E\u0436\u043D\u043E \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0437\u0436\u0435.","organizer.orphanTitle":"\u041D\u0430\u0439\u0434\u0435\u043D\u043E {n} \u043E\u0441\u0438\u0440\u043E\u0442\u0435\u0432\u0448\u0438\u0445 \u043F\u043E\u0434\u0430\u0433\u0435\u043D\u0442\u043E\u0432","organizer.orphanDesc":"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0431\u044B\u043B\u0438 \u0443\u0434\u0430\u043B\u0435\u043D\u044B \u0438\u0437\u0432\u043D\u0435. \u041F\u043E\u0434\u0430\u0433\u0435\u043D\u0442\u044B \u0441\u043A\u0440\u044B\u0442\u044B \u0438\u0437 \u043E\u0431\u044B\u0447\u043D\u044B\u0445 \u0441\u043F\u0438\u0441\u043A\u043E\u0432 \u0447\u0430\u0442\u043E\u0432 \u0438 \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 ~{size} \u0434\u0438\u0441\u043A\u043E\u0432\u043E\u0433\u043E \u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0441\u0442\u0432\u0430. \u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","organizer.cleanOrphans":"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0432\u0441\u0435\u0445 \u0441\u0438\u0440\u043E\u0442","organizer.cleaning":"\u041E\u0447\u0438\u0441\u0442\u043A\u0430\u2026","organizer.orphanCleanSuccess":"\u0423\u0441\u043F\u0435\u0448\u043D\u043E \u043E\u0447\u0438\u0449\u0435\u043D\u043E {n} \u043E\u0441\u0438\u0440\u043E\u0442\u0435\u0432\u0448\u0438\u0445 \u043F\u043E\u0434\u0430\u0433\u0435\u043D\u0442\u043E\u0432."};var pn=Function("return globalThis.__dshArchiveReactDOM")(),Ga=Function("return globalThis.__dshArchiveReactDOMClient")(),Ka=pn.createPortal,Do=pn.flushSync,Mo=Ga?.createRoot,zo=Ga?.hydrateRoot,Lo=pn.findDOMNode,Po=pn.unmountComponentAtNode,Oo=pn.unstable_batchedUpdates,Fo=pn.version;function pi(t){var r={exports:{}},i=r.exports;Object.defineProperty(i,Symbol.toStringTag,{value:"Module"});let a=t("react/jsx-runtime"),o=t("react"),f=t("react-dom"),c=t("@deepseek-ai/dsh-client-ui-primitives");function k({open:n,onClose:s,title:l,description:h,footer:v,children:m,className:C,width:E,portalToBody:N=!1,closeLabel:F,t:A}){let P=o.useRef(null),B=o.useCallback(()=>P.current?.closest(".dsham_settings")??document.body,[]),[u,Ce]=o.useState(null);o.useEffect(()=>{if(!n){Ce(null);return}Ce(N?typeof document<"u"?document.body:null:B())},[n,B,N]),o.useEffect(()=>{if(!n)return;let yt=e(st=>{st.key==="Escape"&&(st.preventDefault(),st.stopPropagation(),"stopImmediatePropagation"in st&&typeof st.stopImmediatePropagation=="function"&&st.stopImmediatePropagation(),s())},"onKey");return window.addEventListener("keydown",yt,!0),()=>window.removeEventListener("keydown",yt,!0)},[n,s]);let ze=F||A("common.close"),pe=(0,a.jsxs)("div",{className:"dsham_modalRoot",role:"presentation",children:[(0,a.jsx)("div",{className:"dsham_modalMask",onClick:s}),(0,a.jsxs)("div",{role:"dialog","aria-modal":!0,"aria-label":typeof l=="string"?l:void 0,className:Qa("dsham_modalDialog",C),style:{width:E??560},children:[(0,a.jsxs)("div",{className:"dsham_modalHeader",children:[(0,a.jsx)("h2",{title:typeof l=="string"?l:void 0,children:l}),(0,a.jsx)("button",{type:"button",className:"dsham_modalClose",onClick:s,"aria-label":ze,title:ze,children:(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:14,height:14,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M3.5 3.5l9 9M12.5 3.5l-9 9"})})})]}),h!=null&&(0,a.jsx)("p",{children:h}),m!=null&&(0,a.jsx)("div",{className:"dsham_modalBody",children:m}),v!=null&&(0,a.jsx)("div",{className:"dsham_modalFooter",children:v})]})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{refObject:P,getContainer:B}),n&&u?Ka(pe,u):null]})}e(k,"SettingsModal");function y({refObject:n,getContainer:s}){return(0,a.jsx)("span",{hidden:!0,ref:n,"data-get-container":s})}e(y,"SettingsModalAnchor");function I({variant:n="outline",icon:s,children:l,className:h,disabled:v,title:m,onClick:C,"aria-label":E,"aria-pressed":N,"aria-expanded":F,"aria-haspopup":A}){return(0,a.jsx)(c.Button,{variant:n,size:"sm",className:h,disabled:v,title:m,onClick:C,"aria-label":E,"aria-pressed":N,"aria-expanded":F,"aria-haspopup":A,icon:s,children:l})}e(I,"settingsButton");function w({variant:n="outline",danger:s=!1,disabled:l,onClick:h,children:v}){return(0,a.jsx)(c.Button,{variant:s?"outline":n,className:s?"dsham_btnDanger":void 0,disabled:l,onClick:h,children:v})}e(w,"modalFooterButton");function g(n,s){let l={className:n?"dsham_archiveTabsLocked":void 0,children:s};return n&&(l.inert=""),l}e(g,"tabsShell");let S=Wa(o,c.Button),{HighlightedText:D,useArchiveSearch:j,useArchivePreview:U,DiscoveryFilters:L,SearchStatus:H,PreviewContent:he}=ya(o,{Button:c.Button,SegmentedControl:c.SegmentedControl}),se={refresh:["M13.5 5.5V2.5m0 0h-3m3 0-2.1 2.1A5.5 5.5 0 1 0 13.2 12"],download:["M8 2v8m0 0 3-3m-3 3-3-3M3 13v2h10v-2"],copy:["M5 5h8v8H5z","M3 3h8"],close:["m4 4 8 8M12 4 4 12"]};function V(n){let s=document.createElement("span"),l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 16 16"),l.setAttribute("width","16"),l.setAttribute("height","16"),l.setAttribute("fill","none"),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width","1.5"),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),l.setAttribute("aria-hidden","true");for(let h of se[n]){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",h),l.append(v)}return s.append(l),s}e(V,"createPluginUpdateIcon");let ce={parse(n){if(typeof n!="string"||n.length===0)throw new TypeError(`sessionId must be a non-empty string, got ${String(n)}`);return n}},de={parse(n){let s=oe(n);if(typeof s!="object"||s===null||Array.isArray(s))throw new TypeError("result must be an object");let l=s.archivedSessionIds;if(!Array.isArray(l)||l.some(h=>typeof h!="string"))throw new TypeError("archivedSessionIds must be a string array");return s}},Xe={parse(n){let s=oe(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.deleted!==!0)throw new TypeError("deleted must be true");return s}},te={parse(n){let s=oe(n);if(typeof s!="object"||s===null||Array.isArray(s))throw new TypeError("target must be an object");if(s.scope==="all"||s.scope==="ungrouped"||s.scope==="workspace"&&typeof s.workspaceId=="string"&&s.workspaceId.length>0||s.scope==="sessions"&&Array.isArray(s.sessionIds)&&s.sessionIds.length>0&&s.sessionIds.every(l=>typeof l=="string"&&l.length>0))return s;throw new TypeError("target.scope must be all, ungrouped, workspace with a non-empty workspaceId, or sessions with non-empty sessionIds")}},J={parse(n){let s=oe(n);if(typeof s!="object"||s===null||Array.isArray(s))throw new TypeError("result must be an object");for(let l of["requestedSessionIds","deletedSessionIds","skippedSessionIds"])if(!Array.isArray(s[l])||s[l].some(h=>typeof h!="string"))throw new TypeError(`${l} must be a string array`);if(!Array.isArray(s.failures)||s.failures.some(l=>typeof l!="object"||l===null||typeof l.sessionId!="string"||typeof l.message!="string"))throw new TypeError("failures must contain sessionId/message objects");return s}},dt={parse(n){let s=oe(n);if(typeof s!="object"||s===null||Array.isArray(s)||!Array.isArray(s.items))throw new TypeError("result.items must be an array");if(s.items.some(l=>typeof l!="object"||l===null||typeof l.sessionId!="string"||typeof l.createdAt!="number"||!Number.isFinite(l.createdAt)))throw new TypeError("items must contain sessionId/createdAt objects");return s}},vt={parse(n){let s=oe(n);if(!s||typeof s.sessionId!="string"||!s.sessionId||typeof s.targetWorkspaceId!="string"||!s.targetWorkspaceId)throw new TypeError("sessionId and targetWorkspaceId must be non-empty strings");return{sessionId:s.sessionId,targetWorkspaceId:s.targetWorkspaceId}}},Ye={parse(n){let s=oe(n);if(!s||s.ok!==!0)throw new TypeError("session move result must be ok: true");return s}};function ke(n,s){return{mode:"strict",typeSymbol:n,create:e(()=>s,"create"),schema:s}}e(ke,"strictCodec");let ut={package:"@michengai/dsh-archive-manager",descriptors:[...Ha(),...fa(),...Ea(),{id:"@michengai/dsh-archive-manager#workspaceRegistry/unarchiveSession",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"unarchiveSession",invocation:{kind:"direct"},parameters:[{name:"sessionId",wire:"sessionId",source:"json",codec:ke("@deepseek-ai/dsh-session/types#SessionId",ce)}],result:ke("@michengai/dsh-archive-manager/types#ArchivedSessionIds",de),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/deleteSession",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"deleteSession",invocation:{kind:"direct"},parameters:[{name:"sessionId",wire:"sessionId",source:"json",codec:ke("@deepseek-ai/dsh-session/types#SessionId",ce)}],result:ke("@michengai/dsh-archive-manager/types#Deleted",Xe),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/deleteArchivedSessions",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"deleteArchivedSessions",invocation:{kind:"direct"},parameters:[{name:"target",wire:"target",source:"json",codec:ke("@michengai/dsh-archive-manager/types#ArchivedBatchTarget",te)}],result:ke("@michengai/dsh-archive-manager/types#DeletedBatch",J),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/archivedSessionMetadata",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"archivedSessionMetadata",invocation:{kind:"direct"},parameters:[],result:ke("@michengai/dsh-archive-manager/types#ArchivedSessionMetadata",dt),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/diagnoseOrphanSubagents",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"diagnoseOrphanSubagents",invocation:{kind:"direct"},parameters:[],result:ke("@michengai/dsh-archive-manager/types#OrphanSubagentDiagnosis",{parse(n){let s=oe(n);if(!s||typeof s.count!="number"||!Array.isArray(s.items)||typeof s.totalSizeBytes!="number")throw new TypeError("invalid orphan subagent diagnosis");return s}}),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/cleanOrphanSubagents",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"cleanOrphanSubagents",invocation:{kind:"direct"},parameters:[{name:"target",wire:"target",source:"json",acceptsUndefined:!0,codec:ke("@michengai/dsh-archive-manager/types#CleanOrphanTarget",{parse(n){if(n==null)return{};let s=oe(n);if(!s)throw new TypeError("target must be an object");if(s.sessionIds!==void 0&&(!Array.isArray(s.sessionIds)||s.sessionIds.some(l=>typeof l!="string")))throw new TypeError("sessionIds must be an array of strings");return s}})}],result:ke("@michengai/dsh-archive-manager/types#CleanOrphanResult",{parse(n){let s=oe(n);if(!s||!Array.isArray(s.cleanedSessionIds)||!Array.isArray(s.skippedSessionIds)||!Array.isArray(s.failures))throw new TypeError("invalid orphan subagent clean result");return s}}),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/moveSessionToWorkspace",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"moveSessionToWorkspace",invocation:{kind:"direct"},parameters:[{name:"input",wire:"input",source:"json",codec:ke("@michengai/dsh-archive-manager/types#SessionMoveInput",vt)}],result:ke("@michengai/dsh-archive-manager/types#SessionMoveResult",Ye),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}]};function at(n,s){if(typeof document>"u"||document.querySelector("style[data-plugin-css="+JSON.stringify(n)+"]")!==null)return;let l=document.createElement("style");l.dataset.plugin="@michengai/dsh-archive-manager",l.dataset.pluginCss=n,l.textContent=s,document.head.appendChild(l)}e(at,"ensurePluginStyle");function rn(n){if(typeof document>"u")return;document.querySelector("style[data-plugin-css="+JSON.stringify(n)+"]")?.remove()}e(rn,"removePluginStyle"),at("dsh-archive-manager/DangerButton.css",".dsham_btnDanger:not(:disabled){color:var(--dsw-alias-state-error-primary,#ef7272);border-color:var(--dsw-alias-state-error-primary,#ef7272)}"),at("dsh-archive-manager/IconAction.css",".dsham_iconAction{display:inline-flex!important;align-items:center!important;justify-content:center!important;box-sizing:border-box!important;width:22px!important;min-width:22px!important;height:22px!important;padding:0!important;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px)!important;background:transparent;color:var(--dsw-alias-label-secondary)}.dsham_iconAction:not(:disabled):hover{color:var(--dsw-alias-link,#4176e6)!important;border-color:var(--dsw-alias-link,#4176e6)!important}.dsham_iconAction.dsham_iconDanger{color:var(--dsw-alias-state-error-primary,#ef7272)!important;border-color:var(--dsw-alias-state-error-primary,#ef7272)!important}.dsham_iconAction.dsham_iconDanger:not(:disabled):hover{color:var(--dsw-alias-state-error-primary,#ef7272)!important;border-color:var(--dsw-alias-state-error-primary,#ef7272)!important}.dsham_iconAction svg{width:16px!important;height:16px!important;flex:none!important}"),at("dsh-archive-manager/Modal.css",".dsham_modalRoot{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:24px}.dsham_modalMask{position:absolute;inset:0;background:var(--dsw-alias-bg-mask-1,rgb(0 0 0 / 45%));backdrop-filter:var(--dsw-mask-blur,blur(16px));-webkit-backdrop-filter:var(--dsw-mask-blur,blur(16px))}.dsham_modalDialog{position:relative;display:flex;flex-direction:column;gap:12px;box-sizing:border-box;max-width:calc(100vw - 48px);max-height:min(85vh,760px);padding:22px 24px 20px;overflow:hidden;border:1px solid var(--dsw-alias-border-l1,rgba(128,128,128,.2));border-radius:var(--dsw-radius-panel,28px);background-color:var(--dsw-alias-surface-overlay,var(--dsw-alias-bg-base,Canvas));background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-surface-overlay,Canvas));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-prominent,0 16px 40px rgb(0 0 0 / 24%))}.dsham_modalHeader{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none}.dsham_modalHeader h2,.dsham_modalDialog h2{margin:0;font-size:16px;line-height:24px;font-weight:600;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.dsham_modalClose{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:28px;height:28px;padding:0;border:none;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;flex:none;transition:background-color .15s ease,color .15s ease}.dsham_modalClose:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.dsham_modalClose svg{display:block;width:14px;height:14px}.dsham_modalDialog>p{margin:0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.dsham_modalBody{display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}.dsham_modalFooter{display:flex;flex:none;align-items:center;justify-content:flex-end;gap:8px}.dsham_modalWide{width:min(900px,calc(100vw - 48px))!important;max-height:min(88vh,820px)!important}.dsham_modalWide .dsham_modalBody{overflow:hidden}.dsham_modalWide .dsham_previewMessages{max-height:none;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}"),at("dsh-archive-manager/SidebarPopover.css",".dsham_sidebarCardRoot{position:fixed;inset:0;z-index:1200;pointer-events:none}.dsham_sidebarCardBackdrop{position:fixed;inset:0;pointer-events:auto;background:transparent}.dsham_sidebarCard{position:fixed;pointer-events:auto;box-sizing:border-box;width:290px;max-height:calc(100vh - 32px);overflow-y:auto;padding:16px 18px 14px;border-radius:var(--dsw-radius-lg,14px);background:var(--dsw-menu-surface-fill);backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));border:none;box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);display:flex;flex-direction:column;gap:8px}.dsham_sidebarCardTitle{margin:0;font-size:14px;font-weight:600;line-height:20px;color:var(--dsw-alias-label-primary)}.dsham_sidebarCardDesc{margin:0;font-size:13px;line-height:18px;color:var(--dsw-alias-label-secondary)}.dsham_sidebarCardError{margin-top:2px;font-size:12px;line-height:16px;color:var(--dsw-alias-state-error-primary,#ef7272);white-space:pre-line}.dsham_sidebarCardFooter{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:10px}.dsham_sidebarCardBtn{border:none;background:transparent;padding:5px 12px;border-radius:var(--dsw-radius-sm,6px);font:inherit;font-size:13px;font-weight:500;line-height:18px;cursor:pointer;transition:background-color .15s ease,opacity .15s ease}.dsham_sidebarCardBtnCancel{color:var(--dsw-alias-label-primary)}.dsham_sidebarCardBtnCancel:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.dsham_sidebarCardBtnDanger{color:var(--dsw-alias-state-error-primary,#ef7272)}.dsham_sidebarCardBtnDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger,#f25a5a26)}.dsham_sidebarCardBtn:disabled{opacity:.4;cursor:default}"),at("dsh-archive-manager/MoveSubmenu.css",".dsham_moveSessionWrap{position:relative}.dsham_moveSubmenu{position:fixed;z-index:99999;min-width:160px;max-width:260px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,0.25) transparent;background:var(--dsw-menu-surface-fill,var(--dsw-alias-surface-overlay,#1e1e22));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));border:1px solid var(--dsw-alias-border-l1,rgba(255,255,255,0.12));border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-prominent,0 6px 20px rgba(0,0,0,0.45));padding:4px;display:flex;flex-direction:column;gap:2px}.dsham_moveSubmenu::-webkit-scrollbar{width:6px}.dsham_moveSubmenu::-webkit-scrollbar-track{background:transparent}.dsham_moveSubmenu::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.2);border-radius:3px}.dsham_moveSubmenu::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,0.35)}.dsham_moveSubmenuBtn{display:flex;align-items:center;width:100%;padding:6px 10px;border:none;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-primary,#ededed);font:inherit;font-size:13px;line-height:20px;text-align:left;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background-color .12s ease}.dsham_moveSubmenuBtn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,0.08))}.dsham_moveSubmenuBtn:focus-visible:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,0.08));outline:none}");let ne="M8 1.75l1.934 3.918 4.324.628-3.129 3.05.738 4.306L8 11.618l-3.867 2.034.738-4.306-3.129-3.05 4.324-.628L8 1.75z";function Ze(n){return n?'<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="'+ne+'"/></svg>':'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round" aria-hidden="true"><path d="'+ne+'"/></svg>'}e(Ze,"starSvg");function Yt(n){return!!n?.querySelector("[data-state]")}e(Yt,"resolveRowHasStatus");let mn="[data-row-key^='session:']{position:relative}.dsham_starSlot{display:none;position:absolute;left:calc(8px + var(--dsh-workspace-indent,0px));inset-inline-start:calc(8px + var(--dsh-workspace-indent,0px));top:50%;transform:translateY(-50%);align-items:center;justify-content:center;box-sizing:border-box;width:16px;height:20px;z-index:1;pointer-events:none}[data-row-key^='session:']:hover .dsham_starSlot,.dsham_starSlot[data-favorited='true']{display:inline-flex;pointer-events:auto}[data-row-key^='session:']:hover>span:first-child:not(:has([data-state])),[data-row-key^='session:'][data-dsham-favorited='true']:not([data-dsham-has-status='true'])>span:first-child:not(:has([data-state])){opacity:0}[data-row-key^='session:'][data-dsham-has-status='true']>span:first-child,[data-row-key^='session:']>span:first-child:has([data-state]){opacity:1}[data-row-key^='session:'][data-dsham-has-status='true'] .dsham_starSlot,[data-row-key^='session:']:has(>span:first-child [data-state]) .dsham_starSlot{width:10px;height:10px;top:auto;bottom:3px;left:calc(15px + var(--dsh-workspace-indent,0px));inset-inline-start:calc(15px + var(--dsh-workspace-indent,0px));transform:none}[data-row-key^='session:'][data-dsham-has-status='true'] .dsham_rowStar,[data-row-key^='session:']:has(>span:first-child [data-state]) .dsham_rowStar{width:10px;height:10px}[data-row-key^='session:'][data-dsham-has-status='true'] .dsham_rowStar svg,[data-row-key^='session:']:has(>span:first-child [data-state]) .dsham_rowStar svg{width:10px;height:10px;filter:drop-shadow(0 0 1px rgba(0,0,0,0.85))}.dsham_rowStar{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:16px;height:16px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-primary);cursor:pointer;flex:none;border-radius:var(--dsw-radius-xs,4px)}.dsham_starSlot[data-favorited='true'] .dsham_rowStar{color:#e8b931}.dsham_rowStar svg{display:block;width:16px;height:16px;flex:none}";at("dsh-archive-manager/RowFavorite.css",mn);let jn="dsh-archive-manager:workspace-favorites-only",ht="data-dsham-favorites-hidden",sn="data-dsham-favorites-only",re="dsham_rowStar",Ae="dsham_starSlot",bt=["\u4EC5\u663E\u793A\u5DF2\u5F52\u6863","Archived only","\u0422\u043E\u043B\u044C\u043A\u043E \u0430\u0440\u0445\u0438\u0432\u043D\u044B\u0435"];at("dsh-archive-manager/FavoritesFilter.css",`[data-dsham-favorites-hidden='true']{display:none!important}button[data-dsham-favorites-only='true'][data-active='true']::after{content:"\\2713";margin-left:auto;padding-left:12px;font-size:12px;line-height:1;color:var(--dsw-alias-state-business-primary,#3b82f6)}`);function Ya(){try{return window.localStorage.getItem(jn)==="1"}catch{return!1}}e(Ya,"readWorkspaceFavoritesOnly");function Za(n){try{window.localStorage.setItem(jn,n?"1":"0")}catch{}}e(Za,"writeWorkspaceFavoritesOnly");function wr(n,s){let l=e(m=>s.favorites.has(m)||s.sessions?.[m]?.blank===!0,"visibleSession"),h=new Map,v=null;for(let m of n){if(m.startsWith("workspace:")){v=m,h.set(m,!1);continue}m.startsWith("session:")&&v!==null&&l(m.slice(8))&&h.set(v,!0)}return n.map(m=>m.startsWith("session:")?l(m.slice(8)):m.startsWith("workspace:")?h.get(m)===!0||s.groupHasFavorite?.(m.slice(10))===!0:!m.startsWith("overflow:"))}e(wr,"favoritesOnlyVisibility");function Sr(n,s){let l=new Map,h=new Set;for(let m of s){let C=!1;for(let E of m.sessionIds)h.add(E),n.has(E)&&(C=!0);l.set(m.workspaceId,C)}let v=!1;for(let m of n)if(!h.has(m)){v=!0;break}return m=>m===""||m==="ungrouped"?v:l.get(m)===!0}e(Sr,"favoriteGroupPredicate");function xr(n,s,l,h){let v={dispose:e(()=>{},"dispose"),setFavoriteStarEnabled:e(q=>{},"setFavoriteStarEnabled"),isFavoriteStarEnabled:e(()=>!0,"isFavoriteStarEnabled")};if(typeof document>"u"||typeof document.addEventListener!="function"||typeof MutationObserver>"u")return v;let m=Ya(),C=typeof h=="function"?h():!0,E=!1,N=!1,F=e(()=>{C?at("dsh-archive-manager/RowFavorite.css",mn):rn("dsh-archive-manager/RowFavorite.css")},"updateStarStyle");F();let A=e(q=>{let Re=q;typeof Re?.detail?.enabled=="boolean"?C=Re.detail.enabled:typeof h=="function"&&(C=h()),F(),tt()},"onStarToggle");typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("dsham-favorite-star-toggle",A);let P=0,B=200,u=null,Ce=new Set,ze=e(q=>{if(!C){for(let ee of q)Array.from(ee.children).find(Le=>Le.classList.contains(Ae))?.remove(),ee.removeAttribute("data-dsham-favorited"),ee.removeAttribute("data-dsham-has-status");return}let Re=s.getSnapshot();for(let ee of q){let K=ee.getAttribute("data-row-key")??"";if(!K.startsWith("session:"))continue;let Le=K.slice(8),Qe=Array.from(ee.children).find(Je=>Je.tagName==="SPAN"&&Array.from(Je.classList).some(At=>At==="slot"||At.endsWith("_slot")))??null;if(Qe===null){ee.removeAttribute("data-dsham-has-status");continue}let M=Array.from(ee.children).find(Je=>Je.classList.contains(Ae))??null;if(!Re.ready){M?.remove(),ee.removeAttribute("data-dsham-favorited"),ee.removeAttribute("data-dsham-has-status");continue}M!==null&&(M.parentElement!==ee||M.nextElementSibling!==null)&&ee.appendChild(M),M===null&&(M=document.createElement("span"),M.className=Ae,ee.appendChild(M)),M.dataset.sessionId=Le,Yt(Qe)?ee.setAttribute("data-dsham-has-status","true"):ee.removeAttribute("data-dsham-has-status");let we=M.querySelector("."+re);we===null&&(we=document.createElement("button"),we.type="button",we.className=re,we.addEventListener("click",Je=>{Je.preventDefault(),Je.stopPropagation(),s.toggle(M?.dataset.sessionId??"")}),M.appendChild(we));let Ke=Re.ids.has(Le);if(Ke?ee.setAttribute("data-dsham-favorited","true"):ee.removeAttribute("data-dsham-favorited"),M.dataset.favorited===String(Ke))continue;let it=l()(Ke?"organizer.unfavorite":"organizer.favorite");M.dataset.favorited=String(Ke),we.setAttribute("aria-pressed",String(Ke)),we.setAttribute("aria-label",it),we.title=it,we.innerHTML=Ze(Ke)}},"ensureRowStars"),pe=e(q=>{let Re=s.getSnapshot();if(!m||!Re.ready){for(let M of q)M.hasAttribute(ht)&&M.removeAttribute(ht);P=0,u=null,Ce.clear();return}let ee=q.map(M=>M.getAttribute("data-row-key")??""),K=Sr(Re.ids,n.workspaces.list?.getSnapshot?.()?.items??[]),Le=wr(ee,{favorites:Re.ids,sessions:n.sessions.list?.getSnapshot?.()?.byId,groupHasFavorite:K});u!==null&&(q.length<=u.rows&&Ce.add(u.key),u=null);let Qe=!1;if(P<B)for(let M=0;M<q.length;M+=1){let Ie=q[M],we=ee[M];if(!we.startsWith("overflow:")||Ie.getAttribute("aria-expanded")!=="false")continue;let Ke=we.slice(9);if(!(Ce.has(Ke)||!K(Ke))){try{Ie.click(),P+=1,u={key:Ke,rows:q.length},Qe=!0}catch(it){console.warn("archive-manager: favorites-only expand failed",it)}break}}for(let M=0;M<q.length;M+=1){let Ie=q[M];Le[M]?Ie.hasAttribute(ht)&&Ie.removeAttribute(ht):Ie.setAttribute(ht,"true")}Qe&&tt()},"applyVisibility"),yt=e(q=>{let Re=q.parentElement;if(Re===null)return null;let ee=Re.cloneNode(!0),K=ee.querySelector('button[role="menuitem"]');if(K===null)return null;let Le=Array.from(K.querySelectorAll("span")),Qe=Le[0]??null,M=Le[Le.length-1]??null;Qe!==null&&(Qe.innerHTML=Ze(!1)),M!==null&&(M.textContent=l()("organizer.favoritesOnly"));for(let Ie of Array.from(K.querySelectorAll("svg")))Ie.closest("span")===null&&Ie.remove();return K.setAttribute(sn,"true"),K.setAttribute("role","menuitemcheckbox"),K.dataset.active=String(m),K.setAttribute("aria-checked",String(m)),K.setAttribute("aria-label",l()("organizer.favoritesOnly")),K.onclick=Ie=>{Ie.preventDefault(),Ie.stopPropagation(),on(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0}))},ee},"buildMenuRow"),st=e(()=>{if(!E){for(let q of Array.from(document.querySelectorAll("button["+sn+"]")))q.dataset.active=String(m),q.setAttribute("aria-checked",String(m));for(let q of Array.from(document.querySelectorAll('[role="menu"]'))){let Re=Array.from(q.querySelectorAll('button[role="menuitem"]')).find(Le=>bt.some(Qe=>(Le.textContent??"").includes(Qe)));if(Re===void 0||q.querySelector("["+sn+"]")!==null)continue;let ee=Re.parentElement;if(ee===null)continue;let K=yt(Re);K!==null&&ee.parentElement?.insertBefore(K,ee.nextSibling)}}},"injectMenuRows"),tt=e(()=>{if(N||E)return;N=!0;let q=e(()=>{if(N=!1,E)return;let Re=Array.from(document.querySelectorAll("[data-row-key]"));st(),ze(Re),pe(Re),s.getSnapshot().ready||ln()},"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(q):setTimeout(q,16)},"schedulePass"),on=e(()=>{m=!m,Ge=20,P=0,u=null,Ce.clear(),Za(m),tt()},"toggle"),pt=null,Ge=20,ln=e(()=>{pt!==null||E||Ge<=0||(Ge-=1,pt=setTimeout(()=>{pt=null,s.ensure(),tt()},600))},"scheduleRetry"),xt=new MutationObserver(q=>{Pn(q,'[data-row-key], [role="menu"]')&&tt()});xt.observe(document.body,{childList:!0,subtree:!0}),s.ensure().catch(()=>{});let Tt=[s.subscribe(()=>tt()),typeof n.sessions.list?.subscribe=="function"?n.sessions.list.subscribe(()=>tt()):null,typeof n.workspaces.list?.subscribe=="function"?n.workspaces.list.subscribe(()=>tt()):null].filter(q=>typeof q=="function");return tt(),{dispose(){E=!0,typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("dsham-favorite-star-toggle",A),xt.disconnect();for(let q of Tt)q();for(let q of Array.from(document.querySelectorAll("["+ht+"]")))q.removeAttribute(ht);for(let q of Array.from(document.querySelectorAll("["+sn+"]")))q.parentElement?.remove();for(let q of Array.from(document.querySelectorAll("."+Ae)))q.remove();for(let q of Array.from(document.querySelectorAll("[data-dsham-favorited]")))q.removeAttribute("data-dsham-favorited");for(let q of Array.from(document.querySelectorAll("[data-dsham-has-status]")))q.removeAttribute("data-dsham-has-status");pt!==null&&(clearTimeout(pt),pt=null)},setFavoriteStarEnabled(q){C=q,F(),tt()},isFavoriteStarEnabled:e(()=>C,"isFavoriteStarEnabled")}}e(xr,"setupWorkspaceFavoritesOnly");function kr(){let n,s={ready:!1,ids:new Set,pending:new Set},l,h=0,v=new Set,m=e(E=>{s=E;for(let N of v)try{N()}catch(F){console.warn("archive-manager: favorite listener failed",F)}},"publish"),C=e((E,N)=>{let F=new Set(E);for(let u of s.pending)u!==N&&(s.ids.has(u)?F.add(u):F.delete(u));let A=new Set(s.pending);N!==void 0?A.delete(N):s.pending.size===0&&A.clear();let P=s.ids.size===F.size&&[...F].every(u=>s.ids.has(u)),B=s.pending.size===A.size&&[...A].every(u=>s.pending.has(u));P&&B&&s.ready||m({ready:!0,ids:F,pending:A})},"adopt");return{bind(E){n=E},subscribe(E){return v.add(E),()=>{v.delete(E)}},getSnapshot:e(()=>s,"getSnapshot"),adopt:e(E=>C(E),"adopt"),ensure(){return n===void 0||s.ready?Promise.resolve():l!==void 0?l:Date.now()<h?Promise.resolve():(l=n.favoriteSessions().then(E=>{C(E.favoriteSessionIds)}).catch(E=>{console.warn("archive-manager: load favorites failed, will retry",E),h=Date.now()+600}).finally(()=>{l=void 0}),l)},async toggle(E){if(n===void 0||!s.ready||s.pending.has(E))return;let N=s.ids.has(E),F=!N,A=new Set(s.ids);F?A.add(E):A.delete(E);let P=new Set(s.pending);P.add(E),m({ready:!0,ids:A,pending:P});try{let B=await n.setSessionFavorite({sessionId:E,favorite:F});if(!Array.isArray(B?.favoriteSessionIds))throw new TypeError("favorite response is missing favoriteSessionIds");C(B.favoriteSessionIds,E)}catch(B){console.warn("archive-manager: sidebar favorite toggle failed",B);let u=new Set(s.ids);N?u.add(E):u.delete(E);let Ce=new Set(s.pending);Ce.delete(E),m({ready:!0,ids:u,pending:Ce})}}}}e(kr,"createFavoriteRowStore");function Ja(){return(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,"aria-hidden":!0,focusable:"false",children:(0,a.jsx)("path",{fill:"currentColor",d:"M8 0a8 8 0 0 0-2.53 15.59c.4.074.547-.173.547-.385 0-.19-.007-.693-.01-1.36-2.226.484-2.695-1.073-2.695-1.073-.364-.924-.89-1.17-.89-1.17-.726-.496.055-.486.055-.486.803.056 1.225.824 1.225.824.714 1.223 1.872.87 2.328.665.072-.517.28-.87.508-1.07-1.777-.202-3.645-.888-3.645-3.956 0-.874.31-1.588.823-2.148-.083-.202-.357-1.017.078-2.12 0 0 .672-.215 2.2.82A7.65 7.65 0 0 1 8 4.8c.68.003 1.365.092 2.004.27 1.527-1.035 2.197-.82 2.197-.82.437 1.103.162 1.918.08 2.12.513.56.822 1.274.822 2.148 0 3.076-1.872 3.752-3.654 3.95.288.248.544.735.544 1.482 0 1.07-.01 1.932-.01 2.195 0 .214.144.463.55.384A8.001 8.001 0 0 0 8 0Z"})})}e(Ja,"GithubMark16");function Xa(){let n=c.IconEditOutlineRegular;return(0,a.jsx)(n,{size:16})}e(Xa,"FeedbackIcon");function Dn({archiveSessions:n,archiveSession:s,sessionStore:l,workspaceStore:h,unarchiveSession:v,deleteSession:m,unarchiveSessions:C,deleteArchivedSessions:E,archivedSessionMetadata:N,openConversation:F,focusSessionWorkspace:A,viewState:P,close:B,t:u,diagnoseOrphanSubagents:Ce,cleanOrphanSubagents:ze,diagnoseSessionCaches:pe,rebuildSessionCaches:yt,refreshCacheLists:st,searchSessionContent:tt,searchArchivedContent:on,previewArchivedSession:pt,favoriteSessions:Ge,setSessionFavorite:ln,favoriteSync:xt,organizeBatch:Tt,useSessionPendingInteraction:q,useSessionStatus:Re}){let ee=(0,o.useSyncExternalStore)(l.subscribe,l.getSnapshot),K=(0,o.useSyncExternalStore)(h.subscribe,h.getSnapshot),[Le,Qe]=(0,o.useState)("archived"),M=Le==="archived",[Ie,we]=(0,o.useState)(null),[Ke,it]=(0,o.useState)(null),[Je,At]=(0,o.useState)(null),Pt=e((d,x=null)=>{G(null),$e(null),z(!1),it(x),we(d)},"requestArchive"),Zt=e(()=>{X||(we(null),it(null),G(null))},"closeArchive"),It=(0,o.useRef)(!1),[_e,Wt]=(0,o.useState)(null),gn=(0,o.useRef)(!1),[X,Ve]=(0,o.useState)(!1),[kt,G]=(0,o.useState)(null),[Fn,$e]=(0,o.useState)(null),cn=e(d=>{G(null),$e(null),Wt(d)},"requestDelete"),[Rt,vn]=(0,o.useState)(P?.query??""),[mt,qt]=(0,o.useState)(P?.project??"all"),[jt,bn]=(0,o.useState)(P?.sortBy??"updated"),[yn,wn]=(0,o.useState)({}),[Vt,Sn]=(0,o.useState)(()=>new Set),Nt=(0,o.useRef)(new Set),[ft,wt]=(0,o.useState)([]),[Dt,Ct]=(0,o.useState)([]),[Jt,Ot]=(0,o.useState)(!1),[xn,p]=(0,o.useState)(!1),b=(0,o.useRef)(!1),[_,Y]=(0,o.useState)(!1),[Ee,ie]=o.useState("content"),[De,je]=o.useState(""),[me,Pe]=o.useState(""),[Oe,St]=(0,o.useState)(()=>new Set),[gt,le]=(0,o.useState)("30"),[ae,z]=(0,o.useState)(!1),[$,be]=(0,o.useState)(null),[fe,Fe]=(0,o.useState)(null),[Se,Be]=(0,o.useState)([]),He=(0,o.useRef)(!1),Me=(0,o.useRef)(null),Q=os(q??as,Re??ss,typeof Re=="function"),Te=(0,o.useRef)(Q.pending);Te.current=Q.pending;let xe=(0,o.useMemo)(()=>new Set(Dt),[Dt]),ot=e(async()=>{if(Ge)try{let d=await Ge();Ct(d.favoriteSessionIds),Ot(!0),xt?.adopt(d.favoriteSessionIds)}catch(d){Ot(!1),G(Ue(d))}},"loadFavorites");(0,o.useEffect)(()=>{let d=!0;return Ge&&Ge().then(x=>{d&&(Ct(x.favoriteSessionIds),Ot(!0),xt?.adopt(x.favoriteSessionIds))}).catch(x=>{d&&G(Ue(x))}),()=>{d=!1}},[Ge]),(0,o.useEffect)(()=>{if(xt)return xt.subscribe(()=>{let d=xt.getSnapshot();d.ready&&(Ct([...d.ids]),Ot(!0))})},[xt]);let nt=e(async d=>{if(!(b.current||X||!Jt)){b.current=!0,p(!0),G(null);try{let x=await ln({sessionId:d,favorite:!xe.has(d)});Ct(x.favoriteSessionIds),xt?.adopt(x.favoriteSessionIds)}catch(x){G(Ue(x))}finally{b.current=!1,p(!1)}}},"toggleFavorite"),ue=e(async(d,x,{idle:Z=!1,retry:ge=!1}={})=>{if(!(He.current||b.current||Nt.current.size>0||!Tt)){He.current=!0,Ve(!0),G(null),$e(null),Fe(null),d==="archive"&&!ge&&Be([]);try{let R=await Tt(d,x,{idleDays:Z?Number(gt):void 0,getPending:e(()=>Te.current,"getPending"),onProgress:e(ve=>{be(ve),d==="archive"&&ve.total>0&&ve.done>=ve.total&&(we(null),it(null),z(!1))},"onProgress")});return Fe({...R,kind:d,tab:Le}),Me.current=R.remaining.length?{kind:d,ids:R.remaining,idle:Z}:null,d==="archive"&&Be(ve=>[...new Set([...ve,...R.succeeded])]),(d==="undo"||d==="restore"||d==="delete")&&Be(ve=>ve.filter(ct=>!R.succeeded.includes(ct)&&!R.skipped.includes(ct))),wt(ve=>ve.filter(ct=>!R.succeeded.includes(ct)&&!R.skipped.includes(ct))),d==="delete"&&Ct(ve=>ve.filter(ct=>!R.succeeded.includes(ct))),R}catch(R){G(Ue(R))}finally{He.current=!1,Ve(!1),be(null)}}},"executeBatch"),[Ft,$t]=(0,o.useState)(null),[Xt,kn]=(0,o.useState)({diagnosis:{count:0,items:[]},busy:!1,progress:null,result:null,error:null,refreshError:null}),ye=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!pe||!yt||!st)return;let d=Ta({diagnose:pe,rebuild:yt,refresh:st});ye.current=d;let x=d.subscribe(()=>{kn(d.snapshot())});return d.load(),()=>{x(),d.dispose(),ye.current=null}},[pe,yt,st]),(0,o.useEffect)(()=>{ye.current?.snapshot().busy||ye.current?.load()},[K.archivedSessionIds]);let rt=e(async(d=!1)=>{if(!(X||He.current||!ye.current||ye.current.snapshot().busy)){He.current=!0,Ve(!0);try{await ye.current.run(d)}finally{He.current=!1,lt.current&&Ve(!1)}}},"runCacheRebuild"),[Qt,dn]=(0,o.useState)(!1),un=e(()=>{typeof Ce=="function"&&Ce().then($t).catch(d=>{console.warn("archive-manager: diagnose orphan subagents failed",d)})},"loadOrphans");(0,o.useEffect)(()=>{un()},[K.archivedSessionIds]);let Et=e(async()=>{if(!(Qt||typeof ze!="function")){dn(!0),G(null),$e(null);try{let d=await ze({});(d.cleanedSessionIds.length>0||d.skippedSessionIds.length>0)&&un(),d.failures.length>0?($e(null),G(zn(d.failures,u))):d.cleanedSessionIds.length>0&&(G(null),$e(u("organizer.orphanCleanSuccess",{n:d.cleanedSessionIds.length})))}catch(d){G(Ue(d))}finally{dn(!1)}}},"cleanOrphans"),lt=(0,o.useRef)(!0),en=(0,o.useRef)(!1);(0,o.useEffect)(()=>(lt.current=!0,()=>{lt.current=!1}),[]);let Mt=e(async(d,x=!1)=>{if(X||en.current)return;en.current=!0,Ve(!0),G(null);let Z=!1;try{await _a({prepare:x?async ge=>{await A?.(ge)}:void 0,restore:e(async ge=>{await v(ge),Z=!0},"restore"),open:e(async ge=>{await F(ge),lt.current&&B?.()},"open")},d.id,x,()=>lt.current)}catch(ge){if(!lt.current)return;if(Z){Qe("unarchived");let R=Gt.find(ve=>ve.sessions.some(ct=>ct.id===d.id));R!==void 0&&qt(R.key)}G(Ia(ge,u))}finally{en.current=!1,lt.current&&Ve(!1)}},"viewConversation");(0,o.useEffect)(()=>{P&&Object.assign(P,{query:Rt,project:mt,sortBy:jt})},[Rt,mt,jt,P]);let Bt=(0,o.useMemo)(()=>M?K.archivedSessionIds:Ur(ee.byId,K.archivedSessionIds),[M,ee.byId,K.archivedSessionIds]),Gt=(0,o.useMemo)(()=>Wr(ee.byId,K.items,Bt,u("group.ungrouped")),[ee.byId,K,Bt,u]),Es=e(d=>{X||Nt.current.size>0||(_t.close(),Qe(d),wt([]),we(null),it(null),G(null),$e(null),qt("all"),vn(""),d!=="archived"&&jt==="archived"&&bn("updated"))},"switchTab"),Zr=e(async(d,x=!1)=>{if(!(It.current||X||!d?.length)){if(Tt){It.current=!0;try{let Z=await ue("archive",d,{idle:x}),ge=Z?.failures.map(R=>_r(R.sessionId,R.message)).find(R=>R!==void 0);if(ge!==void 0&&typeof s=="function"){let R=ee.byId[ge.sessionId];At({sessionId:ge.sessionId,title:R===void 0?ge.sessionId:et(R,u),kinds:ge.kinds.join(", ")}),we(null),it(null),G(null);return}Z&&(we(null),it(null),z(!1))}finally{It.current=!1}return}It.current=!0,Ve(!0),G(null),$e(null);try{let Z=await n(d);we(null),it(null),Z.archivedSessionIdsAdded.length>0&&$e(u("archives.archiveSuccess",{n:Z.archivedSessionIdsAdded.length})),Z.failures&&Z.failures.length>0?G(zn(Z.failures,u)):(wt([]),Qe("archived"),qt("all"),vn(""))}catch(Z){let ge=Ir(Z);if(ge!==void 0&&typeof s=="function"){let R=ee.byId[ge.sessionId];At({sessionId:ge.sessionId,title:R===void 0?ge.sessionId:et(R,u),kinds:ge.kinds.join(", ")}),we(null),it(null),G(null)}else{let R=Ln(Z);G(R===void 0?u("archives.archiveBatchFailed",{detail:Z instanceof Error?Z.message:String(Z)}):u("archives.archiveActive",{kinds:R.join(", ")}))}}finally{It.current=!1,Ve(!1)}}},"performArchive"),Ts=e(()=>Zr(Ie,ae),"confirmArchive"),Is=e(async d=>{G(null),$e(null);try{await cr(d.id),lt.current&&$e(u("details.copied"))}catch(x){lt.current&&G(typeof Hn(x)=="string"&&String(Hn(x)).startsWith("copy.")?u(String(Hn(x))):Ue(x))}},"copyId"),tr=(0,o.useMemo)(()=>qr(Gt,jt,yn,u,M?K.archivedSessionIds:void 0),[Gt,jt,yn,u,M,K.archivedSessionIds]);(0,o.useEffect)(()=>{if(X)return;let d=!1;return N().then(x=>{d||wn(Object.fromEntries(x.items.map(Z=>[Z.sessionId,Z.createdAt])))}).catch(()=>{d||wn({})}),()=>{d=!0}},[N,K.archivedSessionIds,X]),(0,o.useEffect)(()=>{mt!=="all"&&!Gt.some(d=>d.key===mt)&&qt("all")},[Gt,mt]);let Jr=!dr(De,me),Xr=tr.filter(d=>mt==="all"||mt===d.key).map(d=>({...d,sessions:d.sessions.filter(x=>(!_||xe.has(x.id))&&va(x.updatedAt,De,me))})).filter(d=>d.sessions.length),nr=Ee==="content"&&!Jr,Cn=j(Xr.flatMap(d=>d.sessions.map(x=>x.id)),Rt,nr,tt??on),rr=new Map(Cn.items.map(d=>[d.sessionId,d])),_t=U(pt,M?K.archivedSessionIds:[]),Qr=Rt.trim().toLocaleLowerCase(),En=Xr.map(d=>({...d,sessions:d.sessions.filter(x=>!Qr||et(x,u).toLocaleLowerCase().includes(Qr)||rr.has(x.id))})).filter(d=>d.sessions.length),ea=Jt?En.flatMap(d=>d.sessions).filter(d=>yr(d,{days:Number(gt),favorites:xe,currentId:qn(ee),pending:Q.pending})).map(d=>d.id):[],Tn=(0,o.useMemo)(()=>Fr(En),[En]),ar=(0,o.useMemo)(()=>new Set(ft),[ft]),_s=(0,o.useMemo)(()=>{let d=new Set(K.archivedSessionIds);return Se.reduce((x,Z)=>x+(d.has(Z)?1:0),0)},[Se,K.archivedSessionIds]),sr=Tn.filter(d=>ar.has(d)).length,As=Tn.length>0&&sr===Tn.length;(0,o.useEffect)(()=>{wt(d=>Br(d,Bt))},[Bt]);let Rs=e((d,x)=>{wt(Z=>Xn(Z,[d],x))},"toggleSessionSelection"),js=e(d=>{wt(x=>Xn(x,Tn,d))},"toggleVisibleSelection"),Ns=e(d=>{X||Nt.current.has(d)||(Nt.current.add(d),Sn(new Set(Nt.current)),G(null),$e(null),v(d).catch(x=>{G(Er(x,u))}).finally(()=>{Nt.current.delete(d),Sn(new Set(Nt.current))}))},"onUnarchive"),ta=e(async d=>{if(!X){if(Tt){let x=fn(K.archivedSessionIds,K.items,d),Z=await ue("restore",x);return Z&&{unarchivedSessionIds:Z.succeeded}}Ve(!0),G(null),$e(null);try{let x=await C(d);return x.unarchivedSessionIds.length>0&&$e(u("archives.restoreSuccess",{n:x.unarchivedSessionIds.length})),x.failures&&x.failures.length>0&&G(zn(x.failures,u,Er)),x}catch(x){G(u("archives.restoreBatchFailed",{detail:x instanceof Error?x.message:String(x)}))}finally{Ve(!1)}}},"onBatchUnarchive"),Ds=e(async()=>{if(ft.length===0)return;let d=await ta({scope:"sessions",sessionIds:ft});if(d!==void 0){let x=new Set(d.unarchivedSessionIds);wt(Z=>Z.filter(ge=>!x.has(ge)))}},"onSelectedUnarchive"),na=e(()=>{X||Wt(null)},"closeDelete");(0,o.useEffect)(()=>{if(_e===null)return;let d=e(x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),"stopImmediatePropagation"in x&&typeof x.stopImmediatePropagation=="function"&&x.stopImmediatePropagation(),X||Wt(null))},"onKeyDown");return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[_e,X]);let Ms=e(async()=>{if(X||gn.current||_e===null)return;if(_e.kind!=="batch"){gn.current=!0,Ve(!0),G(null),$e(null);try{await m(_e.session.id),Wt(null)}catch(x){G($n(x,u))}finally{gn.current=!1,Ve(!1)}return}if(He.current||b.current||Nt.current.size>0)return;let{target:d}=_e;if(d.scope==="sessions"&&fn(K.archivedSessionIds,K.items,d).length===0){Wt(null);return}He.current=!0,Ve(!0),G(null),$e(null),Fe(null),be(null);try{let x=await E(d),Z=Hr(x,u);Z.kind==="error"?G(Z.message):$e(Z.message);let ge=new Set([...x.deletedSessionIds,...x.skippedSessionIds]);Be(ve=>ve.filter(ct=>!ge.has(ct))),wt(ve=>ve.filter(ct=>!ge.has(ct))),Ct(ve=>ve.filter(ct=>!ge.has(ct)));let R=x.failures.map(ve=>ve.sessionId);Me.current=R.length>0?{kind:"delete",ids:R,idle:!1}:null,Fe({requested:x.requestedSessionIds,succeeded:x.deletedSessionIds,skipped:x.skippedSessionIds,failures:x.failures,remaining:R,refreshError:"refreshError"in x&&typeof x.refreshError=="string"?x.refreshError:null,kind:"delete",tab:Le}),Wt(null)}catch(x){G($n(x,u))}finally{He.current=!1,Ve(!1)}},"confirmDelete"),Ht=_e?.kind==="batch"?_e.target.scope:null,zs=Ht==="ungrouped"?u("archives.deleteUngroupedTitle"):Ht==="workspace"?u("archives.deleteProjectTitle",{name:_e?.kind==="batch"?_e.title:""}):u(Ht==="sessions"?"archives.deleteSelectedTitle":"deleteSession.title"),ra=_e===null?void 0:Ht==="ungrouped"?u("archives.deleteUngroupedDesc",{n:_e.kind==="batch"?_e.count:0}):Ht==="workspace"?u("archives.deleteProjectDesc",{name:_e?.kind==="batch"?_e.title:"",n:_e.kind==="batch"?_e.count:0}):Ht==="sessions"?u("archives.deleteSelectedDesc",{n:_e.kind==="batch"?_e.count:0}):u("deleteSession.desc",{name:et(_e.kind==="session"?_e.session:{},u)}),Ls=u(Ht==="ungrouped"?"archives.deleteUngroupedConfirm":Ht==="workspace"?"archives.deleteProjectConfirm":Ht==="sessions"?"archives.deleteSelectedConfirm":"deleteSession.title");return(0,a.jsxs)("section",{className:"dsham_settings","aria-label":u("archives.title"),children:[(0,a.jsx)("style",{children:cs+hs+ps+ms+fs}),(0,a.jsxs)("div",{className:"dsham_settingsHeader",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"dsham_settingsTitleRow",children:[(0,a.jsx)("h2",{children:u("archives.title")}),(0,a.jsxs)("div",{className:"dsham_settingsLinks",children:[(0,a.jsx)(c.Button,{variant:"outline",size:"sm","aria-label":u("archives.viewProject"),icon:(0,a.jsx)(Ja,{}),onClick:e(()=>window.open("https://github.com/MichengAI/dsh-archive-manager","_blank","noreferrer"),"onClick"),children:u("archives.viewProject")}),(0,a.jsx)(c.Button,{variant:"outline",size:"sm","aria-label":u("archives.feedback"),icon:(0,a.jsx)(Xa,{}),onClick:e(()=>window.open("https://github.com/MichengAI/dsh-archive-manager/issues","_blank","noreferrer"),"onClick"),children:u("archives.feedback")})]})]}),(0,a.jsx)("p",{className:"dsham_settingsIntro",children:u("archives.description")})]}),o.createElement("div",g(X||Vt.size>0,(0,a.jsx)(c.SegmentedTabs,{className:"dsham_archiveTabs",label:u("archives.title"),value:Le==="unarchived"?"unarchived":"archived",onChange:e(d=>Es(d==="unarchived"?"unarchived":"archived"),"onChange"),items:[{value:"archived",label:(0,a.jsxs)("span",{className:"dsham_tabLabel",children:[(0,a.jsx)(c.IconArchiveOutlineMedium,{size:14}),(0,a.jsx)("span",{children:u("archives.tab.archived")})]}),id:"dsham-tab-archived",panelId:"dsham-archive-panel"},{value:"unarchived",label:(0,a.jsxs)("span",{className:"dsham_tabLabel",children:[(0,a.jsx)(c.IconFolderCloseMedium,{size:14}),(0,a.jsx)("span",{children:u("archives.tab.unarchived")})]}),id:"dsham-tab-unarchived",panelId:"dsham-archive-panel"}]})))]}),(0,a.jsxs)("div",{id:"dsham-archive-panel",role:"region","aria-label":u(Le==="unarchived"?"archives.tab.unarchived":"archives.tab.archived"),children:[(0,a.jsx)("div",{className:"dsham_settingsToolbar",children:(0,a.jsxs)("div",{className:"dsham_settingsSearch",children:[(0,a.jsx)(Jn,{id:"dsham-favorite-filter",className:"dsham_srOnly",tabIndex:-1,"aria-hidden":!0,value:_?"favorites":"all",options:[{value:"all",label:u("organizer.allSessions")},{value:"favorites",label:u("organizer.favoritesOnly")}],onChange:e(d=>typeof Y=="function"&&Y(d==="favorites"),"onChange"),"aria-label":u("organizer.favoriteFilter")}),(0,a.jsx)(Jn,{id:"dsham-search-scope",className:"dsham_srOnly",tabIndex:-1,"aria-hidden":!0,value:Ee,options:[{value:"title",label:u("discovery.titleOnly")},{value:"content",label:u("discovery.titleAndContent")}],onChange:e(d=>typeof ie=="function"&&ie(d),"onChange"),"aria-label":u("discovery.scope")}),(0,a.jsx)(c.Input,{id:"dsham-search-input",className:"dsham_searchField",type:"search",icon:(0,a.jsx)(c.IconSearchOutlineMedium,{size:16,"aria-hidden":!0}),autoComplete:"off",spellCheck:!1,maxLength:200,value:Rt,onChange:e(d=>vn(d.target.value),"onChange"),placeholder:u(nr?"discovery.searchPlaceholder":M?"archives.searchPlaceholder":"archives.searchUnarchived"),"aria-label":u(nr?"discovery.searchPlaceholder":M?"archives.searchPlaceholder":"archives.searchUnarchived")}),(0,a.jsx)(gs,{id:"dsham-sort-filter",t:u,disabled:X,favoritesOnly:_,setFavoritesOnly:Y,favoriteBusy:X||xn||!Jt,sortBy:!M&&jt==="archived"?"updated":jt,setSortBy:bn,options:[...M?[{value:"archived",label:u("archives.sortArchived")}]:[],{value:"updated",label:u("archives.sortUpdated")},{value:"created",label:u("archives.sortCreated")},{value:"alphabetical",label:u("archives.sortAlphabetical")}]}),(0,a.jsx)(Jn,{id:"dsham-project-filter",className:"dsham_projectFilter",value:mt,title:mt==="all"?u("archives.allProjects"):tr.find(d=>d.key===mt)?.title??mt,options:[{value:"all",label:u("archives.allProjects")||"\u6240\u6709\u9879\u76EE",title:u("archives.allProjects")},...tr.map(d=>({value:d.key,label:d.title,title:d.title}))],onChange:qt,"aria-label":u("archives.projectFilter")}),o.createElement(L,{t:u,from:De,to:me,onFrom:je,onTo:Pe,invalid:Jr,onClear:e(()=>{je(""),Pe("")},"onClear")})]})}),o.createElement("style",null,wa),o.createElement(H,{state:Cn,t:u}),Tt&&(0,a.jsx)(S,{t:u,archived:M,busy:X||xn||Vt.size>0,ready:Jt,days:gt,onDays:le,count:ea.length,onPreview:e(()=>{Pt(ea),z(!0)},"onPreview"),progress:$,result:fe?.tab===Le?fe:null,onRetry:e(()=>{let d=Me.current;d&&(d.kind==="delete"?cn({kind:"batch",target:{scope:"sessions",sessionIds:d.ids},count:d.ids.length}):ue(d.kind,d.ids,{idle:d.idle,retry:!0}))},"onRetry"),undoCount:_s,onUndo:e(()=>ue("undo",Se,{retry:!0}),"onUndo"),onReload:ot,orphanCount:Ft?.count??0,cacheCount:Xt.diagnosis.count,cacheRepair:Xt,onRebuildCaches:e(()=>rt(),"onRebuildCaches"),onRetryCaches:e(()=>rt(!0),"onRetryCaches"),onReloadCaches:e(async()=>{try{await st?.(),await ye.current?.load(),(ye.current?.snapshot().diagnosis.count??0)===0&&ye.current?.dismiss()}catch(d){lt.current&&G(Ue(d))}},"onReloadCaches"),onDismissCaches:e(()=>ye.current?.dismiss(),"onDismissCaches"),orphanSizeBytes:Ft?.totalSizeBytes??0,orphanCleaning:Qt,onCleanOrphans:Et}),Gt.length>0&&(0,a.jsx)(Lr,{selectedCount:ft.length,hiddenCount:ft.length-sr,allVisibleSelected:As,selectedVisibleCount:sr,visibleCount:Tn.length,busy:X,t:u,onToggle:js,onClear:e(()=>wt([]),"onClear"),onArchive:M?void 0:()=>Pt([...ft]),onRestore:Ds,onDelete:e(()=>cn({kind:"batch",target:{scope:"sessions",sessionIds:ft},count:ft.length}),"onDelete")}),Gt.length===0?(0,a.jsx)("div",{className:"dsham_settingsEmpty",children:u(M?"archives.empty":"archives.emptyUnarchived")}):En.length===0?(0,a.jsx)("div",{className:"dsham_settingsEmpty",children:Cn.status==="loading"||Cn.status==="error"||Cn.failures.length?null:u("archives.emptyFiltered")}):En.map(d=>{let x=ys(d.key),Z=Gt.find(R=>R.key===d.key)?.sessions.map(R=>R.id)??[],ge=M?fn(K.archivedSessionIds,K.items,x).length:Z.length;return(0,a.jsxs)("section",{className:"dsham_settingsGroup",children:[(0,a.jsxs)("div",{className:"dsham_settingsGroupHeading",children:[(0,a.jsx)("h3",{className:"dsham_settingsGroupTitle",children:(0,a.jsxs)("button",{type:"button",className:"dsham_groupToggle","aria-expanded":!Oe.has(d.key),"aria-controls":"dsham-group-"+encodeURIComponent(d.key),onClick:e(()=>St(R=>{let ve=new Set(R);return ve.has(d.key)?ve.delete(d.key):ve.add(d.key),ve}),"onClick"),children:[(0,a.jsx)(Oe.has(d.key)?c.IconChevronRightOutlineMedium:c.IconChevronDownOutlineMedium,{}),(0,a.jsx)(Oe.has(d.key)?c.IconFolderCloseMedium:c.IconFolderOpenOutlineMedium,{}),(0,a.jsx)("span",{children:d.title})]})}),(0,a.jsxs)("div",{className:"dsham_settingsGroupMeta",children:[(0,a.jsx)("span",{className:"dsham_settingsCount",children:u("archives.sessionCount",{n:d.sessions.length})}),(0,a.jsx)(bs,{group:d,busy:X,onArchive:M?void 0:()=>Pt(Z,d),onRestore:e(()=>ta(x),"onRestore"),onDelete:e(()=>cn({kind:"batch",target:x,title:d.title,count:ge}),"onDelete"),t:u})]})]}),(0,a.jsx)("div",{className:"dsham_settingsList",id:"dsham-group-"+encodeURIComponent(d.key),hidden:Oe.has(d.key)||void 0,children:!Oe.has(d.key)&&d.sessions.map(R=>(0,a.jsxs)("div",{className:"dsham_settingsRow","data-selected":ar.has(R.id),children:[(0,a.jsx)(Pr,{checked:ar.has(R.id),disabled:X,label:u("archives.selectSession",{name:et(R,u)}),onChange:e(ve=>Rs(R.id,ve.target.checked),"onChange")}),(0,a.jsxs)("div",{className:"dsham_settingsContent",children:[(0,a.jsx)("button",{type:"button",className:"dsham_settingsTitleLink",title:et(R,u),"aria-label":u("archives.openSession")+u("common.separator")+et(R,u),disabled:X||Vt.has(R.id),onClick:e(()=>Mt(R),"onClick"),children:et(R,u)}),(0,a.jsx)("div",{className:"dsham_settingsMeta",children:[ls(R.updatedAt,u)]}),rr.has(R.id)&&o.createElement("button",{type:"button",className:"dsham_settingsSnippet",disabled:X,title:u(M?"discovery.preview":"archives.openSession"),onClick:e(()=>M?_t.open(R,Rt):Mt(R),"onClick")},o.createElement(D,{text:rr.get(R.id)?.snippet??"",query:Rt}))]}),(0,a.jsxs)("div",{className:"dsham_settingsActions",children:[typeof ln=="function"&&I({variant:"outline",className:"dsham_iconAction"+(xe.has(R.id)?" dsham_favoriteOn":""),title:u(xe.has(R.id)?"organizer.unfavorite":"organizer.favorite"),"aria-pressed":xe.has(R.id),"aria-label":u(xe.has(R.id)?"organizer.unfavorite":"organizer.favorite")+u("common.separator")+et(R,u),disabled:X||xn||!Jt,onClick:e(()=>nt(R.id),"onClick"),children:(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:xe.has(R.id)?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round","aria-hidden":!0,style:{display:"block"},children:(0,a.jsx)("path",{d:ne})})}),I({variant:"outline",className:"dsham_iconAction",title:u(M?"archives.restore":"archives.archiveSelected"),"aria-label":u(M?"archives.restore":"archives.archiveSelected"),disabled:X||Vt.has(R.id),onClick:e(()=>M?Ns(R.id):Zr([R.id]),"onClick"),icon:(0,a.jsx)(M?c.IconRefreshOutlineMedium:c.IconArchiveOutlineMedium,{size:16})}),M&&(0,a.jsx)(vs,{busy:X||Vt.has(R.id),t:u,title:et(R,u),onCopyId:e(()=>Is(R),"onCopyId"),onPreview:typeof pt=="function"?()=>_t.open(R,Rt):void 0,onRestoreOpen:e(()=>Mt(R,!0),"onRestoreOpen"),onDelete:e(()=>cn({kind:"session",session:R}),"onDelete")})]})]},R.id))})]},d.key)}),o.createElement(k,{width:900,className:"dsham_modalWide",portalToBody:!0,t:u,open:_t.target!==null,onClose:_t.close,title:_t.target?et(_t.target.session,u):u("discovery.preview"),footer:w({variant:"primary",disabled:X,onClick:e(()=>{if(_t.target){let d=_t.target.session;return _t.close(),Mt(d)}},"onClick"),children:u("discovery.openFull")}),children:o.createElement(he,{preview:_t,t:u,MarkdownText:c.MarkdownText})}),Ie===null&&kt!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:kt}),Fn!==null&&(0,a.jsx)("div",{className:"dsham_settingsStatus",role:"status",children:Fn}),(0,a.jsx)(k,{t:u,open:Ie!==null,onClose:Zt,title:u("archives.archiveTitle",{n:Ie?.length??0}),description:Ke===null?u("archives.archiveSelectedDesc"):u(Ke.key===On?"archives.archiveUngroupedDesc":"archives.archiveProjectDesc",{name:Ke.title,n:Ie?.length??0}),footer:(0,a.jsxs)(a.Fragment,{children:[w({disabled:X,onClick:Zt,children:u("cancel")}),w({variant:"primary",disabled:X||!Ie?.length,onClick:Ts,children:u("archives.archiveSelected")})]}),children:(0,a.jsxs)(a.Fragment,{children:[Tt&&(0,a.jsx)("p",{children:u(ae?"organizer.idleConfirm":"organizer.manualConfirm")}),Tt&&(0,a.jsx)("div",{className:"dsham_archivePreview",children:(Ie??[]).map(d=>(0,a.jsxs)("label",{children:[(0,a.jsx)(ir,{checked:!0,disabled:X,label:et(ee.byId[d]??{id:d},u),onChange:e(()=>we(x=>(x??[]).filter(Z=>Z!==d)),"onChange")}),et(ee.byId[d]??{id:d},u)]},d))}),$&&(0,a.jsxs)("div",{role:"status",children:[(0,a.jsx)("progress",{value:$.done,max:Math.max(1,$.total)}),u("organizer.progressCount",{done:$.done,total:$.total})]}),kt!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:kt})]})}),(0,a.jsx)(k,{t:u,open:Je!==null,onClose:e(()=>{X||(At(null),G(null))},"onClose"),title:u("archiveActive.title"),...Je===null?{}:{description:u("archiveActive.desc",{name:Je.title,kinds:Je.kinds})},footer:(0,a.jsxs)(a.Fragment,{children:[w({disabled:X,onClick:e(()=>{X||(At(null),G(null))},"onClick"),children:u("cancel")}),w({danger:!0,disabled:X,onClick:e(async()=>{if(!(It.current||X||Je===null||typeof s!="function")){It.current=!0,Ve(!0),G(null);try{await s(Je.sessionId,{stopActivity:!0}),wt(d=>d.filter(x=>Je===null||x!==Je.sessionId)),Qe("archived"),$e(u("archives.archiveSuccess",{n:1})),At(null)}catch(d){G(d instanceof Error?d.message:String(d))}finally{It.current=!1,Ve(!1)}}},"onClick"),children:u("archiveActive.confirm")})]}),children:kt!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:kt})}),(0,a.jsx)(k,{t:u,open:_e!==null,onClose:na,title:zs,...ra===void 0?{}:{description:ra},footer:(0,a.jsxs)(a.Fragment,{children:[w({disabled:X,onClick:na,children:u("cancel")}),w({danger:!0,disabled:X,onClick:Ms,children:Ls})]}),children:(0,a.jsxs)(a.Fragment,{children:[X&&(0,a.jsxs)("div",{role:"status",children:[_e?.kind==="batch"?u("archives.deleteBatchPending"):u("deleteSession.pending"),$&&(0,a.jsx)("progress",{value:$.done,max:Math.max(1,$.total),"aria-label":u("organizer.progress")}),$&&u("organizer.progressCount",{done:$.done,total:$.total})]}),kt!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:kt})]})})]})]})}e(Dn,"ArchivedSessionsSection");function Cr(n){var s,l,h="";if(typeof n=="string"||typeof n=="number")h+=n;else if(typeof n=="object")if(Array.isArray(n)){var v=n.length;for(s=0;s<v;s++)n[s]&&(l=Cr(n[s]))&&(h&&(h+=" "),h+=l)}else for(l in n)n[l]&&(h&&(h+=" "),h+=l);return h}e(Cr,"r");function Qa(...n){for(var s,l,h=0,v="",m=arguments.length;h<m;h++)(s=arguments[h])&&(l=Cr(s))&&(v&&(v+=" "),v+=l);return v}e(Qa,"clsx");function Mn(n){let s=n instanceof Error?n.message:String(n);return s.includes("UNKNOWN_SESSION")||s.includes("no such session")}e(Mn,"isUnknownSessionError");function $n(n,s){if(Mn(n))return s("deleteSession.unknown");let l=n instanceof Error?n.message:String(n);return s("deleteSession.failed",{detail:l})}e($n,"formatDeleteError");function Er(n,s){if(Mn(n))return s("archives.unarchiveUnknown");let l=n instanceof Error?n.message:String(n);return s("archives.unarchiveFailed",{detail:l})}e(Er,"formatUnarchiveError");function zn(n,s,l=Tr){return n.map(h=>h.sessionId+s("common.separator")+l(new Error(h.message),s)).join(`
|
|
23
|
-
`)}e(zn,"formatBatchFailures");function Tr(n,s){if(
|
|
24
|
-
`);function us(n,s){let l=String(s??"").trim();return l.length>0&&String(n??"").trim()===l}e(us,"isOwnSettingsNavRow");function Pn(n,s){for(let l of n){if(l.type==="characterData"){let v=l.target.parentElement;if(v!==null&&v.closest(s)!==null)return!0;continue}let h=l.target;if(h&&h.nodeType===1&&(typeof h.matches=="function"&&h.matches(s)||typeof h.closest=="function"&&h.closest(s)!==null))return!0;if(l.addedNodes)for(let v of l.addedNodes){if(v.nodeType!==1)continue;let m=v;if(typeof m.matches=="function"&&m.matches(s)||typeof m.querySelector=="function"&&m.querySelector(s)!==null||typeof m.closest=="function"&&m.closest(s)!==null)return!0}if(l.removedNodes)for(let v of l.removedNodes){if(v.nodeType!==1)continue;let m=v;if(typeof m.matches=="function"&&m.matches(s)||typeof m.querySelector=="function"&&m.querySelector(s)!==null||typeof m.closest=="function"&&m.closest(s)!==null)return!0}}return!1}e(Pn,"mutationTouches");function Dr(n,s){return us(n.textContent,s)?n.getAttribute(Lt)===""?!1:(n.setAttribute(Lt,""),!0):n.hasAttribute(Lt)?(n.removeAttribute(Lt),!0):!1}e(Dr,"applySettingsNavIcon");function Mr(n){return n.hasAttribute(Lt)?(n.removeAttribute(Lt),!0):!1}e(Mr,"restoreSettingsNavIcon");function zr(n){typeof document>"u"||typeof MutationObserver>"u"||n.effect(()=>{let s="dsham-nav-icon-style",l=document.getElementById(s);l===null?(l=document.createElement("style"),l.id=s,l.textContent=Zn,(document.head??document.documentElement).append(l)):l.textContent!==Zn&&(l.textContent=Zn);let h=!1,v=!1,m=e(()=>{if(v=!1,h)return;let N=n.locale.bind(qe)("archived.badge");for(let F of document.querySelectorAll(ds))Dr(F,N)},"sync"),C=e(()=>{v||h||(v=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(m):setTimeout(m,16))},"schedule");m();let E=new MutationObserver(N=>{Pn(N,'[role="dialog"] nav')&&C()});return E.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),()=>{h=!0,E.disconnect();for(let N of document.querySelectorAll(`[${Lt}]`))Mr(N);l?.remove()}},"archive-manager: settings nav icon")}e(zr,"installSettingsNavIcon");let hs=[".dsham_settings{container-type:inline-size;min-width:0;box-sizing:border-box;width:100%;padding:0 0 32px;color:var(--dsw-alias-label-primary)}",".dsham_settingsHeader{display:flex;flex-direction:column;align-items:stretch;gap:16px;margin-bottom:16px}",".dsham_settings h2{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap}",".dsham_settingsIntro{margin:12px 0 0;max-width:42em;color:var(--dsw-alias-label-tertiary);font-size:14px;line-height:22px}",".dsham_settingsToolbar{display:flex;align-items:center;gap:8px;margin-bottom:16px;width:100%;min-width:0}",".dsham_settingsSearch{display:flex;align-items:center;gap:8px;min-width:0;width:100%;flex-wrap:nowrap}","@container(max-width:520px){.dsham_settingsSearch{flex-wrap:wrap}}",".dsham_settingsSearch .dsham_searchField{flex:1 1 0;min-width:120px;width:auto;box-sizing:border-box}",".dsham_viewSortContainer{flex:0 0 auto;position:relative;box-sizing:border-box}",".dsham_viewSortBtn{height:32px!important;padding:0 8px!important;font-size:13px!important;box-sizing:border-box}",".dsham_viewSortBtn.has-filter{border-color:var(--dsw-alias-state-business-primary)!important;color:var(--dsw-alias-state-business-primary)!important}",".dsham_settingsFilter{display:inline-flex;position:relative}",".dsham_settingsSearch .dsham_projectFilter{flex:0 0 auto;max-width:120px;min-width:0;box-sizing:border-box}",".dsham_settingsSearch .dsham_projectFilter > span{display:inline-block;max-width:100%;box-sizing:border-box}",".dsham_settingsSearch .dsham_projectFilter .dsham_menuSelectBtn{display:inline-flex!important;width:100%;max-width:120px;padding:0 8px;box-sizing:border-box;overflow:hidden}",".dsham_settingsSearch .dsham_projectFilter .dsham_selectLabel{flex:1 1 auto;min-width:0;max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}",".dsham_settingsSearch .dsham_dateFilter{flex:0 0 125px;width:125px;min-width:125px;position:relative;box-sizing:border-box}",".dsham_dateRange{width:100%;box-sizing:border-box}",".dsham_dateTrigger{height:32px!important;padding:0 8px!important;gap:5px!important;border:0.5px solid var(--dsw-alias-border-l2)!important;border-radius:var(--dsw-radius-sm,8px)!important;background:var(--dsw-alias-bg-layer-1)!important;box-sizing:border-box}",".dsham_dateTrigger .dsham_dateText{font-size:12px!important;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".dsham_srOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;opacity:0;pointer-events:none}",".dsham_menuSelectBtn{display:inline-flex!important;align-items:center;justify-content:space-between;gap:6px;width:auto!important;max-width:100%;min-width:0!important;height:32px!important;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-sizing:border-box;font:inherit;font-size:13px;cursor:pointer}",".dsham_selectLabel{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:normal;text-align:left}",".dsham_settingsGroup{margin:0 0 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-button-elevated-fill));overflow:hidden;transition:border-color 150ms ease}",".dsham_settingsGroupHeading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px;padding:0 10px;margin:0;user-select:none}",".dsham_settingsGroupTitle{display:flex;align-items:center;gap:8px;min-width:0;margin:0;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}",".dsham_settingsGroupTitle svg{flex:none;color:var(--dsw-alias-label-secondary)}",".dsham_settingsCount{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px}",".dsham_settingsList{display:grid;overflow:hidden;border:0;border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;background:transparent}",".dsham_settingsList[hidden]{display:none!important;border:0!important}",".dsham_settingsRow{display:grid;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:40px;padding:4px 10px;border-bottom:1px solid var(--dsw-alias-border-l2)}",".dsham_settingsRow:last-child{border-bottom:0}",".dsham_settingsContent{min-width:0;flex:1}",".dsham_settingsMeta{margin-top:1px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:13px}",".dsham_settingsActions{display:flex;align-items:center;gap:4px;flex:none}",".dsham_settingsEmpty{padding:28px 8px;color:var(--dsw-alias-label-secondary);text-align:center}",".dsham_settingsError{margin-top:10px;color:var(--dsw-alias-state-error-primary);font-size:12px;white-space:pre-line}","@container(max-width:520px){.dsham_settingsHeader{margin-bottom:16px}.dsham_settingsGroup{margin-bottom:10px}.dsham_settingsRow{padding:4px 8px}.dsham_settingsActions{gap:2px}}"].join(""),ps=".dsham_settingsTitleLink{display:block;max-width:100%;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;font-weight:600;line-height:16px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.dsham_settingsTitleLink:hover:not(:disabled){text-decoration:underline;text-underline-offset:3px}.dsham_settingsTitleLink:disabled{cursor:default;opacity:.6}.dsham_groupToggle{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding:4px 0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.dsham_groupToggle span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsham_settingsRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.dsham_settingsRow[data-selected=true]{background:var(--dsw-alias-interactive-bg-hover)}.dsham_settingsTitleLink:focus-visible,.dsham_groupToggle:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#3b82f6);outline-offset:2px}@container(max-width:400px){.dsham_settingsRow{gap:6px;padding:4px 6px}.dsham_settingsActions{gap:0}.dsham_settingsMeta{font-size:10px}}.dsham_settingsGroupMeta{display:flex;align-items:center;gap:8px;flex:none;flex-wrap:wrap}.dsham_settingsStatus{margin-top:10px;color:var(--dsw-alias-label-secondary);font-size:12px}.dsham_checkbox{flex:none;box-sizing:border-box;width:16px;height:16px;margin:0;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}.dsham_checkbox:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.dsham_checkbox:disabled{opacity:.5;cursor:default}button.dsham_favoriteOn{color:#e8b931}button.dsham_favoriteOn:not(:disabled):hover{color:#e8b931!important;border-color:#e8b931!important}",ms=".dsham_settingsTitleRow{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}.dsham_settingsLinks{display:flex;align-items:center;gap:8px;flex-wrap:wrap}@media(max-width:720px){.dsham_settingsTitleRow{flex-wrap:wrap}}",fs=".dsham_settingsSelection{margin:-8px 0 16px;padding:4px 0 12px;border-bottom:1px solid var(--dsw-alias-border-l2)}.dsham_settingsSelectionMain{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;min-height:36px}.dsham_settingsSelectionSummary{display:flex;flex-wrap:wrap;align-items:center;gap:12px;min-width:0;max-width:100%}.dsham_settingsSelectionToggle{display:inline-flex;flex:none;white-space:nowrap;align-items:center;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;cursor:pointer}.dsham_settingsSelectionActions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;max-width:100%;margin-left:auto}.dsham_settingsSelectionScope{margin:8px 0 0;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow-wrap:anywhere}";function Jn({id:n,className:s,value:l,options:h,onChange:v,disabled:m=!1,"aria-label":C,title:E,tabIndex:N,"aria-hidden":F}){let[A,P]=o.useState(!1),B=o.useMemo(()=>h.map(ze=>({id:ze.value,label:ze.label})),[h]),u=h.find(ze=>ze.value===l),Ce=u?.label??C;return(0,a.jsx)("div",{id:n,tabIndex:N,"aria-hidden":F,className:s===void 0?"dsham_settingsFilter":`dsham_settingsFilter ${s}`,children:(0,a.jsx)(c.Menu,{open:A,onClose:e(()=>P(!1),"onClose"),onSelect:e(ze=>{m||v(ze),P(!1)},"onSelect"),selectedId:l,align:"start",portal:!0,dense:!0,listClassName:"dsham_selectDropdown",anchor:(0,a.jsxs)(c.Button,{variant:"outline",size:"sm",role:"combobox","aria-label":C,"aria-expanded":A,disabled:m,tabIndex:N,"aria-hidden":F,title:E??u?.title??u?.label??C,className:"dsham_menuSelectBtn"+(A?" is-open":""),onClick:e(()=>{m||P(ze=>!ze)},"onClick"),children:[(0,a.jsx)("span",{className:"dsham_selectLabel",children:Ce}),(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:{marginLeft:4,transition:"transform 150ms ease",transform:A?"rotate(180deg)":"none",flex:"none"},children:(0,a.jsx)("path",{d:"m4 6 4 4 4-4"})})]}),items:B})})}e(Jn,"ArchiveProjectSelect");function gs({id:n,t:s,disabled:l=!1,favoritesOnly:h,setFavoritesOnly:v,favoriteBusy:m=!1,sortBy:C,setSortBy:E,options:N}){let[F,A]=o.useState(!1),P=o.useMemo(()=>{let pe=[];typeof v=="function"&&(pe.push({type:"label",id:"lbl_view_filter",text:s("organizer.favoriteFilter")||"\u7B5B\u9009\u4F1A\u8BDD"}),pe.push({id:"filter:all",label:s("organizer.allSessions")||"\u5168\u90E8\u4F1A\u8BDD"}),pe.push({id:"filter:favorites",label:s("organizer.favoritesOnly")||"\u53EA\u770B\u6536\u85CF"}),pe.push({type:"separator",id:"sep_view_filter"})),pe.push({type:"label",id:"lbl_view_sort",text:s("archives.sortLabel")||"\u6392\u5E8F\u65B9\u5F0F"});for(let yt of N)pe.push({id:`sort:${yt.value}`,label:yt.label});return pe},[s,v,N]),B=e(pe=>{pe.startsWith("filter:")?typeof v=="function"&&!m&&v(pe==="filter:favorites"):pe.startsWith("sort:")&&E(pe.slice(5)),A(!1)},"onSelect"),u=N.find(pe=>pe.value===C),Ce=h?s("organizer.favoritesOnly")||"\u53EA\u770B\u6536\u85CF":s("organizer.allChats")||"\u5168\u90E8\u804A\u5929",ze=`${Ce} \xB7 ${u?.label??C}`;return(0,a.jsxs)("div",{className:"dsham_viewSortContainer",children:[(0,a.jsx)(c.Menu,{open:F,onClose:e(()=>A(!1),"onClose"),onSelect:B,selectedIds:[h?"filter:favorites":"filter:all",`sort:${C}`],align:"end",portal:!0,dense:!0,listClassName:"dsham_viewSortDropdown",anchor:(0,a.jsxs)(c.Button,{variant:"outline",size:"sm",role:"combobox","aria-label":s("archives.viewOptions")||"\u89C6\u56FE\u9009\u9879","aria-expanded":F,disabled:l,title:ze,className:"dsham_menuSelectBtn dsham_viewSortBtn"+(F?" is-open":"")+(h?" has-filter":""),onClick:e(()=>{l||A(pe=>!pe)},"onClick"),children:[(0,a.jsxs)("svg",{viewBox:"0 0 16 16",width:13,height:13,fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none",marginRight:4},children:[(0,a.jsx)("line",{x1:2.5,y1:4.5,x2:13.5,y2:4.5}),(0,a.jsx)("circle",{cx:5,cy:4.5,r:1.5,fill:"var(--dsw-alias-bg-layer-1)"}),(0,a.jsx)("line",{x1:2.5,y1:11.5,x2:13.5,y2:11.5}),(0,a.jsx)("circle",{cx:11,cy:11.5,r:1.5,fill:"var(--dsw-alias-bg-layer-1)"})]}),(0,a.jsx)("span",{className:"dsham_selectLabel",children:Ce}),(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:11,height:11,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:{marginLeft:3,transition:"transform 150ms ease",transform:F?"rotate(180deg)":"none",flex:"none"},children:(0,a.jsx)("path",{d:"m4 6 4 4 4-4"})})]}),items:P})]})}e(gs,"ArchiveViewSortMenu");function Lr({selectedCount:n,hiddenCount:s,allVisibleSelected:l,selectedVisibleCount:h,visibleCount:v,busy:m,t:C,onToggle:E,onClear:N,onRestore:F,onDelete:A,onArchive:P}){let B=n>0;return(0,a.jsxs)("div",{className:"dsham_settingsSelection",children:[(0,a.jsxs)("div",{className:"dsham_settingsSelectionMain",children:[(0,a.jsxs)("div",{className:"dsham_settingsSelectionSummary",children:[(0,a.jsxs)("label",{className:"dsham_settingsSelectionToggle",title:C("archives.selectAllFiltered"),children:[(0,a.jsx)(Pr,{checked:l,indeterminate:h>0&&!l,disabled:m||v===0,label:C("archives.selectAllFiltered"),onChange:e(u=>E(u.target.checked),"onChange")}),(0,a.jsx)("span",{"aria-live":"polite",children:B?C("archives.selectedCount",{n}):C("archives.selectAllFiltered")})]}),B&&I({disabled:m,"aria-label":C("archives.clearSelection"),onClick:N,children:C("archives.clearSelectionShort")})]}),B&&(0,a.jsxs)("div",{className:"dsham_settingsSelectionActions",children:P?[I({disabled:m,onClick:P,children:C("archives.archiveSelected")})]:[I({disabled:m,"aria-label":C("archives.restoreSelected"),onClick:F,children:C("archives.restore")}),I({disabled:m,className:"dsham_btnDanger","aria-label":C("archives.deleteSelected"),onClick:A,children:C("archives.deleteSelectionShort")})]})]}),s>0&&(0,a.jsx)("p",{className:"dsham_settingsSelectionScope",role:"status",children:C("archives.selectionHiddenHint",{hidden:s})})]})}e(Lr,"ArchiveSelectionToolbar");function Pr({checked:n,indeterminate:s=!1,disabled:l=!1,label:h,onChange:v}){return(0,a.jsx)(ir,{checked:n,indeterminate:s,disabled:l,label:h,onChange:v})}e(Pr,"ArchiveSelectionCheckbox");function Or(){return(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,"aria-hidden":!0,focusable:"false",children:[3.5,8,12.5].map(n=>(0,a.jsx)("circle",{cx:n,cy:8,r:1.15,fill:"none",stroke:"currentColor",strokeWidth:1.5},n))})}e(Or,"moreIcon");function vs({busy:n,title:s,t:l,onPreview:h,onRestoreOpen:v,onDelete:m,onCopyId:C}){let[E,N]=(0,o.useState)(!1),F=e(P=>{if(!n){if(N(!1),P==="copyId")return C?.();if(P==="preview")return h?.();if(P==="restoreOpen")return v?.();P==="delete"&&m?.()}},"choose"),A=[...h?[{id:"preview",label:l("discovery.preview"),icon:(0,a.jsx)(c.IconBrowseOutlineMedium,{size:16}),danger:!1}]:[],...v?[{id:"restoreOpen",label:l("archives.restoreOpen"),icon:(0,a.jsx)(c.IconUnarchiveOutlineMedium,{size:16}),danger:!1}]:[],...C?[{id:"copyId",label:l("details.copyId"),icon:(0,a.jsx)(c.IconCopyOutlineMedium,{size:16}),danger:!1}]:[],...m?[{id:"delete",label:l("menu.deleteSession"),icon:(0,a.jsx)(c.IconTrashOutlineMedium,{size:16}),danger:!0}]:[]];return(0,a.jsx)(c.Menu,{open:!n&&E,align:"end",portal:!0,dense:!0,items:A,onSelect:F,onClose:e(()=>N(!1),"onClose"),anchor:I({variant:"outline",className:"dsham_iconAction",disabled:n,title:l("archives.moreActions"),"aria-label":l("archives.moreActions")+l("common.separator")+s,"aria-haspopup":"menu","aria-expanded":E&&!n,icon:Or(),onClick:e(()=>{n||N(P=>!P)},"onClick")})})}e(vs,"ArchivedSessionMenu");function bs({group:n,busy:s,onArchive:l,onRestore:h,onDelete:v,t:m}){let C=n.key===On,E=l?[{id:"archive",label:m(C?"archives.archiveUngrouped":"archives.archiveProject"),icon:(0,a.jsx)(c.IconArchiveOutlineMedium,{size:16}),danger:!0}]:[{id:"restore",label:m(C?"archives.restoreUngrouped":"archives.restoreProject"),icon:(0,a.jsx)(c.IconUnarchiveOutlineMedium,{size:16}),danger:!1},{id:"delete",label:m(C?"archives.deleteUngrouped":"archives.deleteProject"),icon:(0,a.jsx)(c.IconTrashOutlineMedium,{size:16}),danger:!0}],[N,F]=(0,o.useState)(!1),A=m(C?"archives.ungroupedActions":"archives.projectActions",{name:n.title}),P=e(B=>{s||(B==="archive"?l?.():B==="restore"?h?.():B==="delete"&&v?.())},"choose");return(0,a.jsx)(c.Menu,{open:!s&&N,align:"end",portal:!0,dense:!0,items:E,onSelect:e(B=>{F(!1),P(B)},"onSelect"),onClose:e(()=>F(!1),"onClose"),anchor:I({variant:"outline",className:"dsham_iconAction",disabled:s,"aria-label":A,"aria-haspopup":"menu","aria-expanded":N&&!s,icon:Or(),onClick:e(()=>{s||F(B=>!B)},"onClick")})})}e(bs,"ArchivedGroupActions");let On="__ungrouped__";function ys(n){return n===On?{scope:"ungrouped"}:{scope:"workspace",workspaceId:n}}e(ys,"archivedBatchTargetForGroup");function fn(n,s,l){let h=[...new Set(n??[])];if(l.scope==="all")return h;if(l.scope==="sessions"){let m=new Set(l.sessionIds??[]);return h.filter(C=>m.has(C))}if(l.scope==="workspace"){let m=new Set(s.find(C=>C.workspaceId===l.workspaceId)?.sessionIds??[]);return h.filter(C=>m.has(C))}let v=new Set(s.flatMap(m=>m.sessionIds));return h.filter(m=>!v.has(m))}e(fn,"deriveArchivedBatchIds");function Fr(n){return[...new Set(n.flatMap(s=>s.sessions.map(l=>l.id)))]}e(Fr,"archivedSessionIdsInGroups");function Br(n,s){let l=new Set(s);return[...new Set(n)].filter(h=>l.has(h))}e(Br,"pruneArchivedSelection");function Xn(n,s,l){let h=new Set(n);for(let v of s)l?h.add(v):h.delete(v);return[...h]}e(Xn,"toggleArchivedSelection");function Hr(n,s){let l=n.deletedSessionIds.length,h=n.skippedSessionIds.length;return n.failures.length>0?{kind:"error",message:s("archives.deletePartial",{deleted:l,skipped:h,failed:n.failures.length,detail:n.failures[0].message})}:h>0&&l>0?{kind:"notice",message:s("archives.deleteSuccessWithSkipped",{deleted:l,skipped:h})}:h>0?{kind:"notice",message:s("archives.deleteSkipped",{n:h})}:{kind:"notice",message:s("archives.deleteSuccess",{n:l})}}e(Hr,"archivedDeleteFeedback");function Ur(n,s){let l=new Set(s);return Object.values(n).filter(h=>h.origin!=="subagent"&&!h.blank&&!l.has(h.id)).map(h=>h.id)}e(Ur,"unarchivedSessionIds");function Wr(n,s,l,h){let v=s.map(E=>({key:E.workspaceId,title:E.title,ids:new Set(E.sessionIds),sessions:[]})),m=[];for(let E of l){let N=n[E];if(N===void 0||N.origin==="subagent")continue;let F=v.find(A=>A.ids?.has(E));(F===void 0?m:F.sessions).push(N)}let C=v.filter(E=>E.sessions.length>0);return m.length>0&&C.push({key:On,title:h,sessions:m}),C}e(Wr,"deriveArchivedGroups");function qr(n,s,l,h,v=[]){let m=e((A,P)=>String(A).localeCompare(String(P),void 0,{numeric:!0,sensitivity:"base"}),"compareText"),C=new Map;if(Array.isArray(v))for(let A=0;A<v.length;A++)C.set(v[A],A);let E=e(A=>{let P=s==="created"?l[A.id]:A.updatedAt;return typeof P=="number"&&Number.isFinite(P)?P:Number.NEGATIVE_INFINITY},"timestampOf"),N=e((A,P)=>{if(s==="archived"){let B=C.get(A.id)??-1,Ce=(C.get(P.id)??-1)-B;if(Ce!==0)return Ce}if(s!=="alphabetical"){let B=E(P)-E(A);if(Number.isFinite(B)&&B!==0)return B}return m(et(A,h),et(P,h))||m(A.id,P.id)},"compareSessions");return n.map(A=>({...A,sessions:[...A.sessions].sort(N)})).sort((A,P)=>{if(s==="archived"){let B=A.sessions[0]?.id,u=P.sessions[0]?.id,Ce=B!==void 0?C.get(B)??-1:-1,pe=(u!==void 0?C.get(u)??-1:-1)-Ce;if(pe!==0)return pe}if(s!=="alphabetical"){let B=E(P.sessions[0])-E(A.sessions[0]);if(Number.isFinite(B)&&B!==0)return B}return m(A.title,P.title)||m(A.key,P.key)})}e(qr,"sortArchivedGroups");let Vr={...qa,...Sa,"locale.language":"zh","service.unavailable":"\u670D\u52A1\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u91CD\u8BD5","common.close":"\u5173\u95ED","entry.location.title":"\u5165\u53E3\u5C55\u793A\u4F4D\u7F6E","entry.location.desc":"\u9009\u62E9\u5F52\u6863\u7BA1\u7406\u5165\u53E3\u7684\u5C55\u793A\u4F4D\u7F6E\uFF08\u81F3\u5C11\u4FDD\u7559\u4E00\u5904\uFF0C\u9632\u6B62\u65E0\u6CD5\u6253\u5F00\u9762\u677F\uFF09\u3002","entry.location.both":"\u4E24\u8FB9\u663E\u793A","entry.location.sidebar":"\u4EC5\u4FA7\u8FB9\u680F","entry.location.settings":"\u4EC5\u8BBE\u7F6E","entry.location.saveFailed":"\u4FDD\u5B58\u5165\u53E3\u8BBE\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u91CD\u542F\u5BBF\u4E3B\u8FDB\u7A0B","sidebar.favoriteStar.title":"\u4FA7\u680F\u6536\u85CF\u661F\u6807","sidebar.favoriteStar.desc":"\u5728\u4F1A\u8BDD\u5217\u8868\u884C\u524D\u663E\u793A\u6536\u85CF\u661F\u6807\u3002\u5173\u95ED\u540E\u4E0D\u663E\u793A\u56FE\u6807\uFF0C\u4ECD\u53EF\u901A\u8FC7\u83DC\u5355\u6536\u85CF\u548C\u7B5B\u9009\u3002","sidebar.favoriteStar.toggle":"\u5207\u6362\u4FA7\u680F\u6536\u85CF\u661F\u6807","update.entry.title":"\u5728\u7EBF\u66F4\u65B0","update.entry.desc":"\u5141\u8BB8\u68C0\u67E5\u5E76\u5728\u7EBF\u5B89\u88C5\u5F52\u6863\u7BA1\u7406\u5668\u7684\u65B0\u7248\u672C\u3002\u5173\u95ED\u540E\u9690\u85CF\u66F4\u65B0\u5165\u53E3\u3002","update.entry.toggle":"\u5207\u6362\u5728\u7EBF\u66F4\u65B0","update.entry.locked":"\u5728\u7EBF\u66F4\u65B0\u5DF2\u88AB\u5BBF\u4E3B\u914D\u7F6E\u9501\u5B9A\u7981\u7528","archives.archiveProject":"\u5F52\u6863\u8BE5\u9879\u76EE\u7684\u5168\u90E8\u804A\u5929","archives.archiveUngrouped":"\u5F52\u6863\u5168\u90E8\u672A\u5206\u7EC4\u804A\u5929","archives.archiveProjectDesc":"\u5C06\u201C{name}\u201D\u4E2D\u5168\u90E8 {n} \u6761\u672A\u5F52\u6863\u4F1A\u8BDD\u5F52\u6863\uFF0C\u4E0D\u53D7\u5F53\u524D\u641C\u7D22\u7B5B\u9009\u5F71\u54CD\u3002\u4E4B\u540E\u53EF\u5728\u201C\u5DF2\u5F52\u6863\u201D\u4E2D\u6062\u590D\u3002","archives.archiveUngroupedDesc":"\u5C06\u5168\u90E8 {n} \u6761\u672A\u5206\u7EC4\u7684\u672A\u5F52\u6863\u4F1A\u8BDD\u5F52\u6863\uFF0C\u4E0D\u53D7\u5F53\u524D\u641C\u7D22\u7B5B\u9009\u5F71\u54CD\u3002\u4E4B\u540E\u53EF\u5728\u201C\u5DF2\u5F52\u6863\u201D\u4E2D\u6062\u590D\u3002","archives.tab.archived":"\u5DF2\u5F52\u6863","archives.tab.unarchived":"\u672A\u5F52\u6863","archives.searchUnarchived":"\u641C\u7D22\u672A\u5F52\u6863\u804A\u5929","archives.emptyUnarchived":"\u6682\u65E0\u672A\u5F52\u6863\u4F1A\u8BDD\u3002","archives.archiveSelected":"\u5F52\u6863","archives.openSession":"\u6253\u5F00","archives.moreActions":"\u66F4\u591A\u64CD\u4F5C","archives.archiveSelectedDesc":"\u5C06\u9009\u4E2D\u7684\u4F1A\u8BDD\u5F52\u6863\uFF0C\u5305\u542B\u5F53\u524D\u7B5B\u9009\u9690\u85CF\u7684\u5DF2\u9009\u9879\u3002\u4E4B\u540E\u53EF\u5728\u201C\u5DF2\u5F52\u6863\u201D\u4E2D\u67E5\u770B\u548C\u6062\u590D\u3002","archives.archiveSuccess":"\u5DF2\u5F52\u6863 {n} \u6761\u4F1A\u8BDD\u3002","archives.archiveBatchFailed":"\u6279\u91CF\u5F52\u6863\u5931\u8D25\uFF1A{detail}","archives.navigationUnavailable":"\u5F53\u524D\u5BBF\u4E3B\u65E0\u6CD5\u4FDD\u6301\u5F52\u6863\u5BF9\u8BDD\uFF0C\u8BF7\u4F7F\u7528\u201C\u6062\u590D\u5E76\u6253\u5F00\u201D\u3002","archives.sessionNotRetained":"\u5BBF\u4E3B\u672A\u4FDD\u7559\u76EE\u6807\u4F1A\u8BDD\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u6216\u6062\u590D\u540E\u518D\u8BD5\u3002","archives.restoreOpen":"\u6062\u590D\u6253\u5F00","archives.selectedCount":"\u5DF2\u9009 {n} \u6761","archives.selectionHiddenHint":"\u542B\u5F53\u524D\u672A\u663E\u793A\u7684 {hidden} \u6761\uFF0C\u4E5F\u5C06\u53C2\u4E0E\u64CD\u4F5C","archives.clearSelectionShort":"\u6E05\u7A7A","archives.restore":"\u6062\u590D","archives.archiveTitle":"\u5F52\u6863 {n} \u4E2A\u804A\u5929\uFF1F","archives.deleteSelectionShort":"\u5220\u9664","archives.clearSelection":"\u6E05\u7A7A\u9009\u62E9","group.ungrouped":"\u672A\u5206\u7EC4","session.new":"\u65B0\u4F1A\u8BDD","menu.deleteSession":"\u5220\u9664\u4F1A\u8BDD","archived.badge":"\u5F52\u6863\u4F1A\u8BDD","archives.title":"\u5F52\u6863\u4F1A\u8BDD","archives.description":"\u7BA1\u7406\u5DF2\u5F52\u6863\u4F1A\u8BDD\uFF0C\u6216\u9009\u62E9\u672A\u5F52\u6863\u4F1A\u8BDD\u8FDB\u884C\u6279\u91CF\u5F52\u6863\u3002","archives.viewProject":"GitHub","archives.feedback":"\u95EE\u9898\u53CD\u9988","archives.empty":"\u6682\u65E0\u5DF2\u5F52\u6863\u4F1A\u8BDD","archives.emptyFiltered":"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u804A\u5929","archives.searchPlaceholder":"\u641C\u7D22\u5DF2\u5F52\u6863\u804A\u5929","archives.sortLabel":"\u6392\u5E8F\u65B9\u5F0F","archives.viewOptions":"\u89C6\u56FE\u9009\u9879","archives.sortArchived":"\u6700\u8FD1\u5F52\u6863","archives.sortUpdated":"\u66F4\u65B0\u65F6\u95F4","archives.sortCreated":"\u521B\u5EFA\u65F6\u95F4","archives.sortAlphabetical":"\u6309\u5B57\u6BCD\u987A\u5E8F","archives.projectFilter":"\u6309\u9879\u76EE\u7B5B\u9009","archives.allProjects":"\u6240\u6709\u9879\u76EE","discovery.timeRange":"\u65F6\u95F4\u8303\u56F4","organizer.allChats":"\u5168\u90E8\u804A\u5929","archives.sessionCount":"{n} \u4E2A\u804A\u5929","archives.selectAllFiltered":"\u5168\u9009\u5F53\u524D\u7B5B\u9009\u7ED3\u679C","archives.selectSession":"\u9009\u62E9\u4F1A\u8BDD\u201C{name}\u201D","archives.restoreSelected":"\u6062\u590D\u6240\u9009","archives.deleteSelected":"\u5220\u9664\u6240\u9009","archives.timestamp":"{date}\uFF0C{time}","archives.restoreProject":"\u6062\u590D\u9879\u76EE\u5168\u90E8\u804A\u5929","archives.restoreUngrouped":"\u5168\u90E8\u6062\u590D","archives.deleteProject":"\u5220\u9664\u9879\u76EE\u5168\u90E8\u804A\u5929","archives.deleteUngrouped":"\u5168\u90E8\u5220\u9664","archives.projectActions":"\u9879\u76EE\u201C{name}\u201D\u7684\u5F52\u6863\u64CD\u4F5C","archives.ungroupedActions":"\u672A\u5206\u7EC4\u804A\u5929\u7684\u5F52\u6863\u64CD\u4F5C","archives.restoreSuccess":"\u5DF2\u6062\u590D {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u3002","archives.restoreBatchFailed":"\u6279\u91CF\u6062\u590D\u5931\u8D25\uFF1A{detail}","archives.deleteSelectedTitle":"\u5220\u9664\u6240\u9009\u5DF2\u5F52\u6863\u804A\u5929","archives.deleteSelectedDesc":"\u5C06\u6C38\u4E45\u5220\u9664\u6240\u9009\u7684 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u53CA\u5176\u5B50\u4EE3\u7406\uFF08\u542B\u6B63\u5728\u8FD0\u884C\u7684\uFF09\u548C\u8BB0\u5F55\u3002\u5176\u4ED6\u804A\u5929\u4E0D\u4F1A\u53D7\u5F71\u54CD\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","archives.deleteSelectedConfirm":"\u5220\u9664\u6240\u9009\u804A\u5929","archives.deleteProjectTitle":"\u5220\u9664\u201C{name}\u201D\u4E2D\u7684\u5DF2\u5F52\u6863\u804A\u5929","archives.deleteProjectDesc":"\u5C06\u6C38\u4E45\u5220\u9664\u201C{name}\u201D\u4E2D\u7684 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u53CA\u5176\u5B50\u4EE3\u7406\u548C\u8BB0\u5F55\u3002\u9879\u76EE\u76EE\u5F55\u548C\u672A\u5F52\u6863\u804A\u5929\u4E0D\u4F1A\u53D7\u5F71\u54CD\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","archives.deleteProjectConfirm":"\u5220\u9664\u9879\u76EE\u5168\u90E8\u804A\u5929","archives.deleteUngroupedTitle":"\u5220\u9664\u672A\u5206\u7EC4\u7684\u5DF2\u5F52\u6863\u804A\u5929","archives.deleteUngroupedDesc":"\u5C06\u6C38\u4E45\u5220\u9664\u672A\u5206\u7EC4\u4E2D\u7684 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u53CA\u5176\u5B50\u4EE3\u7406\u548C\u8BB0\u5F55\u3002\u5176\u4ED6\u9879\u76EE\u548C\u672A\u5F52\u6863\u804A\u5929\u4E0D\u4F1A\u53D7\u5F71\u54CD\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","archives.deleteUngroupedConfirm":"\u5220\u9664\u672A\u5206\u7EC4\u7684\u5168\u90E8\u804A\u5929","archives.deleteBatchPending":"\u6B63\u5728\u5220\u9664\u5DF2\u5F52\u6863\u804A\u5929\u2026","archives.deleteSuccess":"\u5DF2\u5220\u9664 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u3002","archives.deleteSuccessWithSkipped":"\u5DF2\u5220\u9664 {deleted} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\uFF1B\u53E6\u6E05\u7406 {skipped} \u4E2A\u5DF2\u4E0D\u5B58\u5728\u4F1A\u8BDD\u7684\u5F52\u6863\u8BB0\u5F55\u3002","archives.deleteSkipped":"\u5DF2\u6E05\u7406 {n} \u4E2A\u5DF2\u4E0D\u5B58\u5728\u4F1A\u8BDD\u7684\u5F52\u6863\u8BB0\u5F55\u3002","archives.deletePartial":"\u5DF2\u5220\u9664 {deleted} \u4E2A\u804A\u5929\uFF0C\u6E05\u7406 {skipped} \u4E2A\u5DF2\u4E0D\u5B58\u5728\u4F1A\u8BDD\u7684\u5F52\u6863\u8BB0\u5F55\uFF1B{failed} \u4E2A\u5220\u9664\u5931\u8D25\uFF1A{detail}","archives.unarchiveUnknown":"\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u53D6\u6D88\u5F52\u6863\u3002","archives.unarchiveFailed":"\u53D6\u6D88\u5F52\u6863\u5931\u8D25\uFF1A{detail}","archives.archiveUnknown":"\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u5F52\u6863\u3002","archives.archiveFailed":"\u5F52\u6863\u5931\u8D25\uFF1A{detail}","archives.archiveActive":"\u4F1A\u8BDD\u4ECD\u5728\u8FD0\u884C\uFF08{kinds}\uFF09\u3002","archiveActive.title":"\u505C\u6B62\u5E76\u5F52\u6863","archiveActive.desc":"\u201C{name}\u201D\u4ECD\u6709\u6B63\u5728\u8FDB\u884C\u7684\u5DE5\u4F5C\uFF1A{kinds}\u3002\u5F52\u6863\u524D\u4F1A\u505C\u6B62\u8FD9\u4E9B\u5DE5\u4F5C\u3002","archiveActive.confirm":"\u505C\u6B62\u5E76\u5F52\u6863","archives.forkFailed":"\u5206\u53C9\u4F1A\u8BDD\u5931\u8D25\uFF1A{detail}","deleteSession.title":"\u5220\u9664\u4F1A\u8BDD","deleteSession.confirmTitle":"\u5220\u9664\u4F1A\u8BDD\uFF1F","deleteSession.desc":"\u5C06\u6C38\u4E45\u5220\u9664\u4F1A\u8BDD\u201C{name}\u201D\u53CA\u5176\u5B50\u4EE3\u7406\uFF08\u542B\u6B63\u5728\u8FD0\u884C\u7684\uFF09\u548C\u5168\u90E8\u8BB0\u5F55\uFF08\u5BF9\u8BDD\u5185\u5BB9\u3001\u7EDF\u8BA1\u3001\u7F13\u5B58\uFF09\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","deleteSession.pending":"\u6B63\u5728\u5220\u9664\u4F1A\u8BDD\u2026","deleteSession.unknown":"\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u5220\u9664\u3002","deleteSession.failed":"\u5220\u9664\u4F1A\u8BDD\u5931\u8D25\uFF1A{detail}","menu.archiveWorkspace":"\u5F52\u6863\u4F1A\u8BDD","menu.copyWorkspacePath":"\u590D\u5236\u76EE\u5F55","menu.openInExplorer":"\u6253\u5F00\u76EE\u5F55","menu.moveSession":"\u79FB\u52A8\u5230\u5DE5\u4F5C\u533A","moveSession.noOtherWorkspaces":"\u6682\u65E0\u53EF\u79FB\u52A8\u7684\u5176\u4ED6\u5DE5\u4F5C\u533A","moveSession.success":"\u4F1A\u8BDD\u5DF2\u6210\u529F\u79FB\u52A8\u5230\u201C{name}\u201D","archiveWorkspace.title":"\u5F52\u6863 {n} \u4E2A\u4F1A\u8BDD\uFF1F","archiveWorkspace.desc":"\u8FD9\u4F1A\u5C06\u201C{name}\u201D\u4E2D\u7684\u4F1A\u8BDD\u5F52\u6863\u3002\u4E4B\u540E\u53EF\u4EE5\u5728\u201C\u8BBE\u7F6E \u2192 \u5F52\u6863\u4F1A\u8BDD\u201D\u4E2D\u627E\u5230\u5B83\u4EEC\u3002","archiveWorkspace.confirm":"\u5168\u90E8\u5F52\u6863","archiveWorkspace.pending":"\u6B63\u5728\u5F52\u6863\u4F1A\u8BDD\u2026","date.ymd":"{y}\u5E74{m}\u6708{d}\u65E5"},$r={...Va,...xa,"locale.language":"en","service.unavailable":"The service is not ready. Please retry.","common.close":"Close","entry.location.title":"Entry placement","entry.location.desc":"Choose where to show the entry (at least one is retained to avoid losing access).","entry.location.both":"Both","entry.location.sidebar":"Sidebar only","entry.location.settings":"Settings only","entry.location.saveFailed":"Failed to save entry location. Please check your network or restart the host.","sidebar.favoriteStar.title":"Sidebar favorite star","sidebar.favoriteStar.desc":"Show favorite star on session rows in the sidebar. When disabled, the star is hidden while menu actions and filters stay available.","sidebar.favoriteStar.toggle":"Toggle sidebar favorite star","update.entry.title":"Online updates","update.entry.desc":"Allow checking and installing new versions online. Hides the update entry when disabled.","update.entry.toggle":"Toggle online updates","update.entry.locked":"Online updates are disabled by the host configuration.","archives.moreActions":"More actions","archives.archiveProject":"Archive all chats in this project","archives.archiveUngrouped":"Archive all ungrouped chats","archives.archiveProjectDesc":"Archive all {n} unarchived sessions in \u201C{name}\u201D, regardless of the current search filter. You can restore them in Archived.","archives.archiveUngroupedDesc":"Archive all {n} ungrouped, unarchived sessions, regardless of the current search filter. You can restore them in Archived.","archives.tab.archived":"Archived","archives.tab.unarchived":"Unarchived","archives.searchUnarchived":"Search unarchived chats","archives.emptyUnarchived":"No unarchived sessions.","archives.archiveSelected":"Archive","archives.openSession":"Open session","archives.archiveSelectedDesc":"Archive the selected sessions, including selections hidden by the current filter. You can view and restore them in Archived.","archives.archiveSuccess":"Archived {n} sessions.","archives.archiveBatchFailed":"Batch archive failed: {detail}","archives.navigationUnavailable":"This host cannot keep the conversation archived while opening it. Use \u201CRestore and open\u201D instead.","archives.sessionNotRetained":"The host did not keep the requested conversation open. Try again, or restore it before opening.","archives.restoreOpen":"Restore and open","archives.selectedCount":"{n} selected","archives.selectionHiddenHint":"Includes {hidden} hidden by the current filter; actions apply to them too.","archives.clearSelectionShort":"Clear","archives.restore":"Restore","archives.archiveTitle":"Archive {n} chats?","archives.deleteSelectionShort":"Delete","archives.clearSelection":"Clear selection","group.ungrouped":"Ungrouped","session.new":"New Session","menu.deleteSession":"Delete session","archived.badge":"Archived sessions","archives.title":"Archived sessions","archives.description":"Manage archived sessions or select unarchived sessions to archive in bulk.","archives.viewProject":"GitHub","archives.feedback":"Issues","archives.empty":"No archived sessions.","archives.emptyFiltered":"No chats match your filters.","archives.searchPlaceholder":"Search archived chats","archives.sortLabel":"Sort order","archives.viewOptions":"View options","archives.sortArchived":"Recently archived","archives.sortUpdated":"Last updated","archives.sortCreated":"Created","archives.sortAlphabetical":"Alphabetical","archives.projectFilter":"Filter by project","archives.allProjects":"All projects","discovery.timeRange":"Date range","organizer.allChats":"All chats","archives.sessionCount":"{n} chats","archives.selectAllFiltered":"Select all results","archives.selectSession":"Select chat {name}","archives.restoreSelected":"Restore selected","archives.deleteSelected":"Delete selected","archives.timestamp":"{date}, {time}","archives.restoreProject":"Restore all chats in this project","archives.restoreUngrouped":"Restore all","archives.deleteProject":"Delete all chats in this project","archives.deleteUngrouped":"Delete all","archives.projectActions":"Archive actions for project {name}","archives.ungroupedActions":"Archive actions for ungrouped chats","archives.restoreSuccess":"Restored {n} archived chats.","archives.restoreBatchFailed":"Could not restore the archived chats: {detail}","archives.deleteSelectedTitle":"Delete selected archived chats","archives.deleteSelectedDesc":"This permanently deletes the selected {n} archived chats, their child agents (including any that are still running), and their records. Other chats are not affected. This cannot be undone.","archives.deleteSelectedConfirm":"Delete selected chats","archives.deleteProjectTitle":"Delete archived chats in {name}","archives.deleteProjectDesc":"This permanently deletes the {n} archived chats in {name}, their child agents, and their records. The project directory and unarchived chats are not affected. This cannot be undone.","archives.deleteProjectConfirm":"Delete all project chats","archives.deleteUngroupedTitle":"Delete ungrouped archived chats","archives.deleteUngroupedDesc":"This permanently deletes the {n} ungrouped archived chats, their child agents, and their records. Other projects and unarchived chats are not affected. This cannot be undone.","archives.deleteUngroupedConfirm":"Delete all ungrouped chats","archives.deleteBatchPending":"Deleting archived chats\u2026","archives.deleteSuccess":"Deleted {n} archived chats.","archives.deleteSuccessWithSkipped":"Deleted {deleted} archived chats and cleared {skipped} stale archive entries for sessions that no longer exist.","archives.deleteSkipped":"Cleared {n} stale archive entries for sessions that no longer exist.","archives.deletePartial":"Deleted {deleted} chats and cleared {skipped} stale archive entries; {failed} could not be deleted: {detail}","archives.unarchiveUnknown":"This session no longer exists, so it cannot be unarchived.","archives.unarchiveFailed":"Could not unarchive the session: {detail}","archives.archiveUnknown":"This session no longer exists, so it cannot be archived.","archives.archiveFailed":"Could not archive the session: {detail}","archives.archiveActive":"This conversation is still running ({kinds}).","archiveActive.title":"Stop and archive","archiveActive.desc":"\u201C{name}\u201D still has work in progress: {kinds}. Archiving stops that work first.","archiveActive.confirm":"Stop and archive","archives.forkFailed":"Could not fork the session: {detail}","deleteSession.title":"Delete session","deleteSession.confirmTitle":"Delete session?","deleteSession.desc":"This permanently deletes session \u201C{name}\u201D, its child agents (including any that are still running), and all of its records (conversation, stats, cache). This cannot be undone.","deleteSession.pending":"Deleting session\u2026","deleteSession.unknown":"This session no longer exists or was already deleted.","deleteSession.failed":"Could not delete the session: {detail}","menu.archiveWorkspace":"Archive sessions","menu.copyWorkspacePath":"Copy folder path","menu.openInExplorer":"Open folder","menu.moveSession":"Move to workspace","moveSession.noOtherWorkspaces":"No other workspaces available","moveSession.success":"Session successfully moved to \u201C{name}\u201D","archiveWorkspace.title":"Archive {n} conversations?","archiveWorkspace.desc":"This archives all conversations in \u201C{name}\u201D. You can find them later in Archived sessions.","archiveWorkspace.confirm":"Archive all","archiveWorkspace.pending":"Archiving conversations\u2026","date.ymd":"{y}-{m}-{d}"},ws={...$a,...ka,"locale.language":"ru","service.unavailable":"\u0421\u0435\u0440\u0432\u0438\u0441 \u0435\u0449\u0451 \u043D\u0435 \u0433\u043E\u0442\u043E\u0432. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435.","common.close":"\u0417\u0430\u043A\u0440\u044B\u0442\u044C","entry.location.title":"\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u0443\u043D\u043A\u0442\u0430","entry.location.desc":"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435, \u0433\u0434\u0435 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C \u043F\u0443\u043D\u043A\u0442 \u0432\u0445\u043E\u0434\u0430 (\u0445\u043E\u0442\u044F \u0431\u044B \u043E\u0434\u0438\u043D \u043E\u0441\u0442\u0430\u0435\u0442\u0441\u044F \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u043C).","entry.location.both":"\u041E\u0431\u0430 \u043C\u0435\u0441\u0442\u0430","entry.location.sidebar":"\u0422\u043E\u043B\u044C\u043A\u043E \u0431\u043E\u043A\u043E\u0432\u0430\u044F \u043F\u0430\u043D\u0435\u043B\u044C","entry.location.settings":"\u0422\u043E\u043B\u044C\u043A\u043E \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438","entry.location.saveFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0440\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u0443\u043D\u043A\u0442\u0430. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u0435\u0442\u044C \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0435 \u0445\u043E\u0441\u0442.","sidebar.favoriteStar.title":"\u0417\u0432\u0435\u0437\u0434\u0430 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","sidebar.favoriteStar.desc":"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C \u0437\u0432\u0435\u0437\u0434\u0443 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0443 \u0441\u0442\u0440\u043E\u043A \u0441\u0435\u0441\u0441\u0438\u0439 \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438. \u041F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438 \u0437\u043D\u0430\u0447\u043E\u043A \u0441\u043A\u0440\u044B\u0432\u0430\u0435\u0442\u0441\u044F, \u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043C\u0435\u043D\u044E \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F \u043E\u0441\u0442\u0430\u044E\u0442\u0441\u044F \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u043C\u0438.","sidebar.favoriteStar.toggle":"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0435\u0437\u0434\u0443 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","update.entry.title":"\u041E\u043D\u043B\u0430\u0439\u043D-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435","update.entry.desc":"\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0443 \u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0439 \u043E\u043D\u043B\u0430\u0439\u043D. \u0421\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u043F\u0443\u043D\u043A\u0442 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438.","update.entry.toggle":"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043E\u043D\u043B\u0430\u0439\u043D-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435","update.entry.locked":"\u041E\u043D\u043B\u0430\u0439\u043D-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0445\u043E\u0441\u0442\u0430.","archives.moreActions":"\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E","archives.archiveProject":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.archiveUngrouped":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.archiveProjectDesc":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 {n} \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439 \u0432 \xAB{name}\xBB, \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0444\u0438\u043B\u044C\u0442\u0440\u0430 \u043F\u043E\u0438\u0441\u043A\u0430. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archives.archiveUngroupedDesc":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 {n} \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439, \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0444\u0438\u043B\u044C\u0442\u0440\u0430 \u043F\u043E\u0438\u0441\u043A\u0430. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archives.tab.archived":"\u0410\u0440\u0445\u0438\u0432","archives.tab.unarchived":"\u041D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435","archives.searchUnarchived":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u043C \u0447\u0430\u0442\u0430\u043C","archives.emptyUnarchived":"\u041D\u0435\u0442 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.archiveSelected":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C","archives.openSession":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E","archives.archiveSelectedDesc":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438, \u0432\u043A\u043B\u044E\u0447\u0430\u044F \u0441\u043A\u0440\u044B\u0442\u044B\u0435 \u0442\u0435\u043A\u0443\u0449\u0438\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u043C. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0438 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archives.archiveSuccess":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0441\u0435\u0441\u0441\u0438\u0439: {n}.","archives.archiveBatchFailed":"\u041F\u0430\u043A\u0435\u0442\u043D\u0430\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F \u043D\u0435 \u0443\u0434\u0430\u043B\u0430\u0441\u044C: {detail}","archives.navigationUnavailable":"\u042D\u0442\u043E\u0442 \u0445\u043E\u0441\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 \u043F\u0440\u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0438. \u0412\u043C\u0435\u0441\u0442\u043E \u044D\u0442\u043E\u0433\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \xAB\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u044C\xBB.","archives.sessionNotRetained":"\u0425\u043E\u0441\u0442 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u043B \u0437\u0430\u043F\u0440\u043E\u0448\u0435\u043D\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u043C. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u0438\u043B\u0438 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0435\u0433\u043E \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0435\u043C.","archives.restoreOpen":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u044C","archives.selectedCount":"\u0412\u044B\u0431\u0440\u0430\u043D\u043E: {n}","archives.selectionHiddenHint":"\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 {hidden}, \u0441\u043A\u0440\u044B\u0442\u044B\u0445 \u0442\u0435\u043A\u0443\u0449\u0438\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u043C; \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u043F\u0440\u0438\u043C\u0435\u043D\u044F\u044E\u0442\u0441\u044F \u0438 \u043A \u043D\u0438\u043C.","archives.clearSelectionShort":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C","archives.restore":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C","archives.archiveTitle":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C {n} \u0447\u0430\u0442\u043E\u0432?","archives.deleteSelectionShort":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C","archives.clearSelection":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u044B\u0431\u043E\u0440","group.ungrouped":"\u0411\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B","session.new":"\u041D\u043E\u0432\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F","menu.deleteSession":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E","archived.badge":"\u0410\u0440\u0445\u0438\u0432 \u0441\u0435\u0441\u0441\u0438\u0439","archives.title":"\u0410\u0440\u0445\u0438\u0432 \u0441\u0435\u0441\u0441\u0438\u0439","archives.description":"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u043C\u0438 \u0441\u0435\u0441\u0441\u0438\u044F\u043C\u0438 \u0438\u043B\u0438 \u0432\u044B\u0431\u043E\u0440 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0434\u043B\u044F \u043F\u0430\u043A\u0435\u0442\u043D\u043E\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438.","archives.viewProject":"GitHub","archives.feedback":"\u041F\u0440\u043E\u0431\u043B\u0435\u043C\u044B","archives.empty":"\u041D\u0435\u0442 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.emptyFiltered":"\u041D\u0438 \u043E\u0434\u0438\u043D \u0447\u0430\u0442 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0430\u0448\u0438\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u043C.","archives.searchPlaceholder":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u043C \u0447\u0430\u0442\u0430\u043C","archives.sortLabel":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430","archives.viewOptions":"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0432\u0438\u0434\u0430","archives.sortArchived":"\u041D\u0435\u0434\u0430\u0432\u043D\u043E \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435","archives.sortUpdated":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435","archives.sortCreated":"\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F","archives.sortAlphabetical":"\u041F\u043E \u0430\u043B\u0444\u0430\u0432\u0438\u0442\u0443","archives.projectFilter":"\u0424\u0438\u043B\u044C\u0442\u0440 \u043F\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0443","archives.allProjects":"\u0412\u0441\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B","discovery.timeRange":"\u041F\u0435\u0440\u0438\u043E\u0434","organizer.allChats":"\u0412\u0441\u0435 \u0447\u0430\u0442\u044B","archives.sessionCount":"{n} \u0447\u0430\u0442\u043E\u0432","archives.selectAllFiltered":"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B","archives.selectSession":"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0447\u0430\u0442 {name}","archives.restoreSelected":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435","archives.deleteSelected":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435","archives.timestamp":"{date}, {time}","archives.restoreProject":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.restoreUngrouped":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u0441\u0435","archives.deleteProject":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.deleteUngrouped":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435","archives.projectActions":"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u043F\u0440\u043E\u0435\u043A\u0442\u0430 {name}","archives.ungroupedActions":"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432","archives.restoreSuccess":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432: {n}.","archives.restoreBatchFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B: {detail}","archives.deleteSelectedTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteSelectedDesc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 {n} \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432, \u0438\u0445 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B (\u0432\u043A\u043B\u044E\u0447\u0430\u044F \u0435\u0449\u0451 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0435) \u0438 \u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0438. \u0414\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0442\u044B \u043D\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","archives.deleteSelectedConfirm":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteProjectTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B \u0432 {name}","archives.deleteProjectDesc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 {n} \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432 \u0432 {name}, \u0438\u0445 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B \u0438 \u0437\u0430\u043F\u0438\u0441\u0438. \u041A\u0430\u0442\u0430\u043B\u043E\u0433 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u0438 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B \u043D\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","archives.deleteProjectConfirm":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.deleteUngroupedTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteUngroupedDesc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 {n} \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432, \u0438\u0445 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B \u0438 \u0437\u0430\u043F\u0438\u0441\u0438. \u0414\u0440\u0443\u0433\u0438\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0438 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B \u043D\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","archives.deleteUngroupedConfirm":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteBatchPending":"\u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432\u2026","archives.deleteSuccess":"\u0423\u0434\u0430\u043B\u0435\u043D\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432: {n}.","archives.deleteSuccessWithSkipped":"\u0423\u0434\u0430\u043B\u0435\u043D\u043E {deleted} \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432 \u0438 \u043E\u0447\u0438\u0449\u0435\u043D\u043E {skipped} \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u0434\u043B\u044F \u043D\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.deleteSkipped":"\u041E\u0447\u0438\u0449\u0435\u043D\u043E {n} \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u0434\u043B\u044F \u043D\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.deletePartial":"\u0423\u0434\u0430\u043B\u0435\u043D\u043E {deleted} \u0447\u0430\u0442\u043E\u0432 \u0438 \u043E\u0447\u0438\u0449\u0435\u043D\u043E {skipped} \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430; {failed} \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0443\u0434\u0430\u043B\u0438\u0442\u044C: {detail}","archives.unarchiveUnknown":"\u042D\u0442\u0430 \u0441\u0435\u0441\u0441\u0438\u044F \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0435\u0451 \u043D\u0435\u043B\u044C\u0437\u044F \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430.","archives.unarchiveFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430: {detail}","archives.archiveUnknown":"\u042D\u0442\u0430 \u0441\u0435\u0441\u0441\u0438\u044F \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0435\u0451 \u043D\u0435\u043B\u044C\u0437\u044F \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C.","archives.archiveFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E: {detail}","archives.archiveActive":"\u042D\u0442\u043E\u0442 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F ({kinds}).","archiveActive.title":"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C","archiveActive.desc":"\u0412 \xAB{name}\xBB \u0435\u0449\u0451 \u0438\u0434\u0451\u0442 \u0440\u0430\u0431\u043E\u0442\u0430: {kinds}. \u0410\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442 \u0435\u0451.","archiveActive.confirm":"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C","archives.forkFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u0432\u0435\u0442\u043A\u0443 \u0441\u0435\u0441\u0441\u0438\u0438: {detail}","deleteSession.title":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E","deleteSession.confirmTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E?","deleteSession.desc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 \u0441\u0435\u0441\u0441\u0438\u044E \xAB{name}\xBB, \u0435\u0451 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B (\u0432\u043A\u043B\u044E\u0447\u0430\u044F \u0435\u0449\u0451 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0435) \u0438 \u0432\u0441\u0435 \u0435\u0451 \u0437\u0430\u043F\u0438\u0441\u0438 (\u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0443, \u043A\u044D\u0448). \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","deleteSession.pending":"\u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438\u2026","deleteSession.unknown":"\u042D\u0442\u0430 \u0441\u0435\u0441\u0441\u0438\u044F \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043B\u0438 \u0443\u0436\u0435 \u0443\u0434\u0430\u043B\u0435\u043D\u0430.","deleteSession.failed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E: {detail}","menu.archiveWorkspace":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u0438","menu.copyWorkspacePath":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0443\u0442\u044C \u043A \u043F\u0430\u043F\u043A\u0435","menu.openInExplorer":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u043F\u043A\u0443","menu.moveSession":"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0432 \u043F\u0440\u043E\u0435\u043A\u0442","moveSession.noOtherWorkspaces":"\u041D\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432","moveSession.success":"\u0421\u0435\u0441\u0441\u0438\u044F \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0430 \u0432 \xAB{name}\xBB","archiveWorkspace.title":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C {n} \u0441\u0435\u0441\u0441\u0438\u0439?","archiveWorkspace.desc":"\u042D\u0442\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \xAB{name}\xBB. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u043D\u0430\u0439\u0442\u0438 \u043F\u043E\u0437\u0436\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archiveWorkspace.confirm":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435","archiveWorkspace.pending":"\u0410\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F \u0441\u0435\u0441\u0441\u0438\u0439\u2026","date.ymd":"{y}-{m}-{d}"},qe="archive-manager-workspace",Ss=["slots","sessions","workspaces","locale","remote","typert"];function Qn(n){return{getSnapshot:n.getSnapshot.bind(n),subscribe:n.subscribe.bind(n)}}e(Qn,"bindObservable");function Gr(n){return async s=>{if(typeof n?.unarchiveSession!="function")throw new Error("archive-manager: host unarchiveSession is unavailable");await n.unarchiveSession(s)}}e(Gr,"createUnarchiveSession");async function er(n,s,l){let h=new Set(n.list?.getSnapshot?.()?.archivedSessionIds??[]),v=await Vn(s,async C=>{try{await n.archiveSession(C)}catch(E){throw E!==null&&typeof E=="object"&&Ln(E)!==void 0&&typeof oe(E).sessionId!="string"&&Object.assign(E,{sessionId:C}),E}return!0},{refresh:l}),m=[...n.list?.getSnapshot?.()?.archivedSessionIds??[]];return{archivedSessionIds:m,archivedSessionIdsAdded:m.filter(C=>!h.has(C)),failures:v.failures}}e(er,"archiveSessionsViaOfficial");async function Kr(n,s,l,h){let v=new Set(n.list?.getSnapshot?.()?.archivedSessionIds??[]),m=typeof h=="function"?h:N=>n.unarchiveSession?.(N),C=await Vn(s,async N=>(await m(N),!0),{refresh:l}),E=[...n.list?.getSnapshot?.()?.archivedSessionIds??[]];return{archivedSessionIds:E,unarchivedSessionIds:[...v].filter(N=>!E.includes(N)),failures:C.failures}}e(Kr,"unarchiveSessionsViaOfficial");function Yr({triggerRect:n,viewport:s,itemCount:l,measuredHeight:h}){let v=s.width,m=s.height,C=220,E=Math.max(140,m-20),N=Math.min(360,E),F=l===0?44:34*l+8,A=Math.min(N,Math.max(20,typeof h=="number"&&h>0?h:F)),P=n.right+2;P+C>v-10&&(P=Math.max(10,n.left-C-4));let B=n.top-4;if(B+A>m-10){let u=n.bottom+4-A;u>=10?B=u:B=Math.max(10,m-A-10)}return B<10&&(B=10),{top:B,left:P,maxHeight:N}}e(Yr,"computeSubmenuPosition");async function xs(n){ks(n);let s=n.get("remote"),l=e(()=>{},"disposeRemote");return s!==void 0&&(l=await s.$mount(ut)),async()=>{await l()}}e(xs,"apply");function ks(n){n.effect(()=>n.locale.register(qe,{zh:Vr,en:$r,ru:ws}),"dsh-archive-manager: dictionaries");let s=e(()=>n.get("uiWorkspace"),"uiWorkspaceAt"),l={},h,v=e(p=>(h=Aa(p,n.sessions,n.workspaces,{onOpened:e(()=>n.get("layout")?.selectPanel(null),"onOpened"),beginNavigation:e(()=>n.get("layout")?.beginNavigation?.(),"beginNavigation")}),()=>h?.dispose()),"attachArchiveNavigation");n.effect(()=>v(s()),"archive-manager: explicit archived navigation");let m=e(p=>{if(h===void 0)throw new Kt("navigationUnavailable");return Nr.request(p),h.open(p)},"openConversation"),C=e(async p=>{n.get("layout")?.beginNavigation?.(),Nr.request(p)},"focusSessionWorkspace"),E=e(async(p,b)=>{let _=await n.sessions.search(p,b);if(!_.ok)throw new Error(_.error.message);return _.value},"searchSessions"),N=e(async()=>{if(typeof n.sessions.refresh!="function")return null;try{return await Ce(),null}catch(p){return console.warn("archive-manager: restored archived sessions but session list refresh failed:",p),p instanceof Error?p.message:String(p)}},"refreshSessionList"),F=Gr(n.workspaces),A=e(async(p,...b)=>{let _=n.get("remote.workspaceRegistry");if(!_||typeof _[p]!="function")throw new Error(n.locale.bind(qe)("service.unavailable"));let Ee=await _[p].apply(_,b);if(!Ee.ok)throw new Error(Ee.error.message);return Ee.value},"registryCall"),P=e(()=>A("diagnoseOrphanSubagents"),"diagnoseOrphanSubagents"),B=e(()=>A("diagnoseSessionCaches"),"diagnoseSessionCaches"),u=e(p=>A("rebuildSessionCaches",p),"rebuildSessionCaches"),Ce=e(async()=>{if(typeof n.sessions.refresh!="function")throw new Error("Official session list refresh is unavailable");let p=await n.sessions.refresh(),b=n.sessions,_=b.manager;if(_?.listState==="error"&&_.listError)throw new Error(Ue(_.listError));if(b.listState==="error"&&b.listError)throw new Error(Ue(b.listError));let Y=b.list?.getSnapshot?.();if(Y?.state==="error"&&Y.error)throw new Error(Ue(Y.error));if(p&&typeof p=="object"&&"ok"in p&&p.ok===!1)throw new Error(Ue(p.error??"Session list refresh failed"))},"refreshCacheLists"),ze=e((p={})=>A("cleanOrphanSubagents",p??{}),"cleanOrphanSubagents"),pe=e(p=>A("searchArchivedContent",p),"searchArchivedContent"),yt=e(p=>A("searchSessionContent",p),"searchSessionContent"),st=e(p=>A("previewArchivedSession",p),"previewArchivedSession"),tt=e(()=>A("favoriteSessions"),"favoriteSessions"),on=e(p=>A("setSessionFavorite",p),"setSessionFavorite"),pt=kr();pt.bind({favoriteSessions:tt,setSessionFavorite:on});let Ge,ln=xr(n,pt,()=>n.locale.bind(qe),()=>Ge?.isSidebarFavoriteStarEnabled()??!0);n.effect(()=>()=>ln.dispose(),"archive-manager: favorites only filter");let xt=Ua({workspaces:n.workspaces.list,sessions:n.sessions.list,archive:e(p=>n.workspaces.archiveSession(p),"archive"),restore:e(async p=>{await F(p)},"restore"),deleteOne:e(async p=>{let b=n.get("remote.workspaceRegistry");if(!b)throw new Error(n.locale.bind(qe)("service.unavailable"));let _=await b.deleteSession(p);if(!_.ok)throw new Error(_.error.message)},"deleteOne"),getFavorites:tt,refresh:e(()=>n.sessions.refresh?.(),"refresh"),currentSessionId:qn}),Tt=e(async p=>{await F(p),await N()},"unarchiveSession"),q=e(async p=>{let b=n.get("remote.workspaceRegistry");if(b===void 0)throw new Error("archive-manager remote service is unavailable");let _=await b.deleteSession(p);if(!_.ok)throw new Error(_.error.message);await N()},"deleteSession"),Re=e(async(p,b)=>{let _=n.get("remote.workspaceRegistry");if(_===void 0)throw new Error("archive-manager remote service is unavailable");let Y=await _.moveSessionToWorkspace({sessionId:p,targetWorkspaceId:b});if(!Y.ok)throw new Error(Y.error?.message||"move failed");return await N(),Y.value},"moveSession"),ee=e(async p=>er(n.workspaces,p,N),"archiveSessions"),K=e(async p=>{let b=n.workspaces.list?.getSnapshot?.()??{archivedSessionIds:[],items:[]},_=fn(b.archivedSessionIds,b.items,p);return Kr(n.workspaces,_,N,F)},"unarchiveSessions"),Le=e(async p=>{let b=n.get("remote.workspaceRegistry");if(b===void 0)throw new Error("archive-manager remote service is unavailable");let _=await b.deleteArchivedSessions(p);if(!_.ok)throw new Error(_.error.message);let Y=await N();return{..._.value,refreshError:Y}},"deleteArchivedSessions"),Qe=e(async()=>{let p=n.get("remote.workspaceRegistry");if(p===void 0)throw new Error("archive-manager remote service is unavailable");let b=await p.archivedSessionMetadata();if(!b.ok)throw new Error(b.error.message);return b.value},"archivedSessionMetadata"),M="sidebar.workspaces.session.menu.item",Ie=null,we=new Set,Ke=e(p=>{Ie=p;for(let b of we)b()},"publishDeleteTarget");function it(){return o.useSyncExternalStore(p=>(we.add(p),()=>{we.delete(p)}),()=>Ie,()=>Ie)}e(it,"useDeleteRequest");function Je({sessionId:p,displayTitle:b,useMenuOpenState:_,t:Y}){let[,Ee]=_(),ie=c.MenuItemButton,De=(0,a.jsx)(c.IconTrashOutlineRegular,{size:14}),je=e(()=>{Ee(!1),Ke({sessionId:p,title:b})},"onSelect");return typeof ie=="function"?(0,a.jsx)(ie,{danger:!0,icon:De,onSelect:je,children:Y("menu.deleteSession")}):(0,a.jsx)("button",{type:"button",role:"menuitem",onClick:je,children:Y("menu.deleteSession")})}e(Je,"DeleteSessionMenuItem");function At({sessionId:p,favoriteRow:b,useMenuOpenState:_,t:Y}){let[,Ee]=_(),ie=(0,o.useSyncExternalStore)(b.subscribe,b.getSnapshot),De=ie.ready&&ie.ids.has(p),je=e(()=>{Ee(!1),b.toggle(p)},"onSelect"),me=c.MenuItemButton,Pe=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:De?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:ne})}),Oe=Y(De?"organizer.unfavorite":"organizer.favorite");return typeof me=="function"?(0,a.jsx)(me,{icon:Pe,onSelect:je,children:Oe}):(0,a.jsx)("button",{type:"button",role:"menuitem",onClick:je,children:Oe})}e(At,"FavoriteMenuItem");let Pt=null,Zt=new Set;function It(p,b="success"){Pt={text:p,tone:b,seq:Date.now()};for(let _ of Zt)_()}e(It,"showToast");function _e(){let p=o.useSyncExternalStore(_=>(Zt.add(_),()=>{Zt.delete(_)}),()=>Pt,()=>Pt);if(!p)return null;let b=c.Toast;return typeof b=="function"?(0,a.jsx)(b,{key:p.seq,text:p.text,tone:p.tone,holdMs:3e3,onDone:e(()=>{if(Pt?.seq===p.seq){Pt=null;for(let _ of Zt)_()}},"onDone")}):(0,a.jsx)("div",{key:p.seq,style:{position:"fixed",top:16,left:"50%",transform:"translateX(-50%)",zIndex:99999,padding:"8px 16px",borderRadius:8,background:p.tone==="danger"?"#7f1d1d":"#14532d",color:"#fff",fontSize:13,boxShadow:"0 4px 16px rgba(0,0,0,0.4)"},children:p.text})}e(_e,"GlobalToastOverlay");function Wt({sessionId:p,displayTitle:b,useMenuOpenState:_,t:Y}){let[,Ee]=_(),[ie,De]=o.useState(!1),[je,me]=o.useState(null),[Pe,Oe]=o.useState(!1),St=o.useRef(null),gt=o.useRef(null),le=o.useRef(null),ae=n.workspaces.list?.getSnapshot?.()?.items??[],z=c.MenuItemButton,$=e(Q=>{if(!St.current)return;let Te=St.current.getBoundingClientRect(),xe=typeof window<"u"?window.innerWidth:1024,ot=typeof window<"u"?window.innerHeight:768,nt=Yr({triggerRect:Te,viewport:{width:xe,height:ot},itemCount:ae.length,measuredHeight:Q});me(ue=>ue&&ue.top===nt.top&&ue.left===nt.left&&ue.maxHeight===nt.maxHeight?ue:nt)},"updatePosition"),be=e(()=>{le.current&&clearTimeout(le.current),$(),De(!0)},"handleMouseEnter");o.useLayoutEffect(()=>{if(!ie||!gt.current)return;let Q=gt.current.offsetHeight;Q>0&&$(Q)},[ie,ae.length]);let fe=e(()=>{le.current=setTimeout(()=>{De(!1)},180)},"handleMouseLeave"),Fe=e(async(Q,Te)=>{if(!Pe){Oe(!0),De(!1),Ee(!1);try{await Re(p,Q),It(Y("moveSession.success",{name:Te})||`\u4F1A\u8BDD\u5DF2\u6210\u529F\u79FB\u52A8\u5230\u201C${Te}\u201D`,"success")}catch(xe){let ot=xe instanceof Error?xe.message:String(xe);console.warn("archive-manager: move session failed",xe),It(ot,"danger")}finally{Oe(!1)}}},"handleSelectWorkspace"),Se=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:14,height:14,fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,a.jsx)("path",{d:"M2 3.5C2 2.67157 2.67157 2 3.5 2H6.5L8 4H12.5C13.3284 4 14 4.67157 14 5.5V12.5C14 13.3284 13.3284 14 12.5 14H3.5C2.67157 14 2 13.3284 2 12.5V3.5Z"}),(0,a.jsx)("path",{d:"M8 7.5L10.5 10L8 12.5"}),(0,a.jsx)("path",{d:"M5.5 10H10.5"})]}),Be=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{marginLeft:"auto",opacity:.65},children:(0,a.jsx)("path",{d:"M6 3.5L10.5 8L6 12.5"})}),He=(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",gap:8},children:[(0,a.jsx)("span",{children:Y("menu.moveSession")}),Be]}),Me=typeof z=="function"?(0,a.jsx)(z,{icon:Se,onSelect:e(()=>be(),"onSelect"),children:He}):(0,a.jsxs)("button",{type:"button",role:"menuitem",onClick:e(()=>be(),"onClick"),style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"6px 8px",background:"transparent",border:"none",cursor:"pointer",color:"inherit",textAlign:"left"},children:[Se,He]});return(0,a.jsxs)("div",{ref:St,className:"dsham_moveSessionWrap",onMouseEnter:be,onMouseLeave:fe,children:[Me,ie&&je&&typeof document<"u"&&typeof f?.createPortal=="function"&&(0,f.createPortal)((0,a.jsxs)("div",{ref:gt,className:"dsham_moveSubmenu",role:"menu",onPointerDown:e(Q=>{Q.stopPropagation()},"onPointerDown"),onMouseDown:e(Q=>{Q.stopPropagation()},"onMouseDown"),onMouseEnter:be,onMouseLeave:fe,style:{top:je.top,left:je.left,maxHeight:je.maxHeight},children:[(0,a.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:-6,width:8},"aria-hidden":!0}),ae.length===0?(0,a.jsx)("div",{style:{padding:"8px 10px",fontSize:"12px",color:"var(--dsw-alias-label-tertiary, #888)"},children:Y("moveSession.noOtherWorkspaces")}):ae.map(Q=>{let Te=Q.title||Q.path||Q.workspaceId;return(0,a.jsxs)("button",{type:"button",role:"menuitem",className:"dsham_moveSubmenuBtn",disabled:Pe,onPointerDown:e(xe=>{xe.preventDefault(),xe.stopPropagation(),Fe(Q.workspaceId,Te)},"onPointerDown"),onClick:e(xe=>{xe.preventDefault(),xe.stopPropagation(),Fe(Q.workspaceId,Te)},"onClick"),children:[(0,a.jsx)("span",{"aria-hidden":!0,style:{display:"inline-flex",flex:"none",marginRight:8},children:(0,a.jsx)(c.IconFolderCloseMedium,{size:14})}),(0,a.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:Te})]},Q.workspaceId)})]}),document.body)]})}e(Wt,"MoveSessionMenuItem");function gn(p){try{let b=document.querySelector(`[data-row-key="session:${CSS.escape(p)}"]`);return b?(b.hasAttribute("tabindex")||(b.setAttribute("tabindex","-1"),b.addEventListener("blur",()=>b.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(b):b.focus(),!0):!1}catch{return!1}}e(gn,"focusSessionRow");function X({t:p}){let b=it(),[_,Y]=(0,o.useState)(!1),[Ee,ie]=(0,o.useState)(null),[De,je]=(0,o.useState)(null),me=(0,o.useRef)(null),Pe=(0,o.useRef)(null),Oe=(0,o.useRef)(null);if((0,o.useLayoutEffect)(()=>{if(b===null||typeof document>"u"){je(null);return}let le=null,ae=e(()=>{if(le&&le.isConnected)return le;try{le=document.querySelector(`[data-row-key="session:${CSS.escape(b.sessionId)}"]`)}catch{le=null}return le},"getTargetRow"),z=e(()=>{let be=me.current,fe=be?.offsetWidth||290,Fe=be?.offsetHeight||160,Se=8,Be=ae();if(!Be){let Te=window.innerWidth,xe=window.innerHeight,ot=Math.max(16,(xe-Fe)/2),nt=Math.max(16,(Te-fe)/2);je(ue=>ue!==null&&ue.top===ot&&ue.left===nt?ue:{top:ot,left:nt});return}let He=Be.getBoundingClientRect(),Me=He.top-4;Me+Fe>window.innerHeight-16&&(Me=window.innerHeight-16-Fe),Me<16&&(Me=16);let Q=He.right+Se;Q+fe>window.innerWidth-16&&(Q=He.left-fe-Se),Q<16&&(Q=16),je(Te=>Te!==null&&Te.top===Me&&Te.left===Q?Te:{top:Me,left:Q})},"updatePosition");z(),window.addEventListener("scroll",z,!0),window.addEventListener("resize",z);let $=null;return typeof ResizeObserver<"u"&&me.current&&($=new ResizeObserver(z),$.observe(me.current)),()=>{$?.disconnect(),window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}},[b]),(0,o.useEffect)(()=>{if(b===null)return;Pe.current&&!Pe.current.disabled?Pe.current.focus():me.current?.focus();let le=b.sessionId;return()=>{if(!gn(le)){let z=document.querySelector('[role="treeitem"][aria-selected="true"]');z&&(z.hasAttribute("tabindex")||(z.setAttribute("tabindex","-1"),z.addEventListener("blur",()=>z.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(z):z.focus())}}},[b]),(0,o.useEffect)(()=>{b!==null&&_&&me.current?.focus()},[b,_]),(0,o.useEffect)(()=>{if(b===null)return;let le=e(ae=>{if(ae.key==="Escape"){ae.preventDefault(),ae.stopPropagation(),"stopImmediatePropagation"in ae&&typeof ae.stopImmediatePropagation=="function"&&ae.stopImmediatePropagation(),_||(ie(null),Ke(null));return}if(ae.key==="Tab"){if(ae.preventDefault(),_){me.current?.focus();return}let z=Pe.current,$=Oe.current;if(!z||!$)return;ae.shiftKey?document.activeElement===z?$.focus():z.focus():document.activeElement===$?z.focus():$.focus()}},"onKey");return window.addEventListener("keydown",le,!0),()=>window.removeEventListener("keydown",le,!0)},[b,_]),b===null)return null;let St=e(()=>{_||(ie(null),Ke(null))},"close"),gt=e(()=>{Y(!0),ie(null),q(b.sessionId).then(()=>{Y(!1),Ke(null)}).catch(le=>{Y(!1),ie($n(le,p))})},"confirm");return(0,a.jsxs)("div",{className:"dsham_sidebarCardRoot",children:[(0,a.jsx)("div",{className:"dsham_sidebarCardBackdrop",onClick:St}),(0,a.jsxs)("div",{ref:me,role:"dialog","aria-modal":!0,"aria-label":p("deleteSession.title"),tabIndex:-1,className:"dsham_sidebarCard",style:De?{top:De.top,left:De.left,visibility:"visible"}:{visibility:"hidden",top:0,left:0},children:[(0,a.jsx)("h3",{className:"dsham_sidebarCardTitle",children:p("deleteSession.confirmTitle")}),(0,a.jsx)("p",{className:"dsham_sidebarCardDesc",children:p("deleteSession.desc",{name:b.title})}),_&&(0,a.jsx)("div",{className:"dsham_sidebarCardDesc",role:"status",children:p("deleteSession.pending")}),Ee!==null&&(0,a.jsx)("div",{className:"dsham_sidebarCardError",role:"alert",children:Ee}),(0,a.jsxs)("div",{className:"dsham_sidebarCardFooter",children:[(0,a.jsx)("button",{ref:Pe,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnCancel",disabled:_,onClick:St,children:p("cancel")}),(0,a.jsx)("button",{ref:Oe,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnDanger",disabled:_,onClick:gt,children:p("deleteSession.title")})]})]})]})}e(X,"DeleteSessionOverlay");let Ve=null,kt=new Set,G=e(p=>{Ve=p;for(let b of kt)b()},"publishArchiveWsTarget");function Fn(){return o.useSyncExternalStore(p=>(kt.add(p),()=>{kt.delete(p)}),()=>Ve,()=>Ve)}e(Fn,"useArchiveWsRequest");function $e(p){try{let b=document.querySelector(`[data-row-key="workspace:${CSS.escape(p)}"]`);return b?(b.hasAttribute("tabindex")||(b.setAttribute("tabindex","-1"),b.addEventListener("blur",()=>b.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(b):b.focus(),!0):!1}catch{return!1}}e($e,"focusWorkspaceRow");function cn({t:p}){let b=Fn(),[_,Y]=(0,o.useState)(!1),[Ee,ie]=(0,o.useState)(null),[De,je]=(0,o.useState)(null),me=(0,o.useRef)(null),Pe=(0,o.useRef)(null),Oe=(0,o.useRef)(null);if((0,o.useLayoutEffect)(()=>{if(b===null||typeof document>"u"){je(null);return}let le=null,ae=e(()=>{if(le&&le.isConnected)return le;try{le=document.querySelector(`[data-row-key="workspace:${CSS.escape(b.workspaceId)}"]`)}catch{le=null}return le},"getTargetRow"),z=e(()=>{let be=me.current,fe=be?.offsetWidth||290,Fe=be?.offsetHeight||160,Se=8,Be=ae();if(!Be){let Te=window.innerWidth,xe=window.innerHeight,ot=Math.max(16,(xe-Fe)/2),nt=Math.max(16,(Te-fe)/2);je(ue=>ue!==null&&ue.top===ot&&ue.left===nt?ue:{top:ot,left:nt});return}let He=Be.getBoundingClientRect(),Me=He.top-4;Me+Fe>window.innerHeight-16&&(Me=window.innerHeight-16-Fe),Me<16&&(Me=16);let Q=He.right+Se;Q+fe>window.innerWidth-16&&(Q=He.left-fe-Se),Q<16&&(Q=16),je(Te=>Te!==null&&Te.top===Me&&Te.left===Q?Te:{top:Me,left:Q})},"updatePosition");z(),window.addEventListener("scroll",z,!0),window.addEventListener("resize",z);let $=null;return typeof ResizeObserver<"u"&&me.current&&($=new ResizeObserver(z),$.observe(me.current)),()=>{$?.disconnect(),window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}},[b]),(0,o.useEffect)(()=>{if(b===null)return;Pe.current&&!Pe.current.disabled?Pe.current.focus():me.current?.focus();let le=b.workspaceId;return()=>{$e(le)}},[b]),(0,o.useEffect)(()=>{b!==null&&_&&me.current?.focus()},[b,_]),(0,o.useEffect)(()=>{if(b===null)return;let le=e(ae=>{if(ae.key==="Escape"){ae.preventDefault(),ae.stopPropagation(),"stopImmediatePropagation"in ae&&typeof ae.stopImmediatePropagation=="function"&&ae.stopImmediatePropagation(),_||(ie(null),G(null));return}if(ae.key==="Tab"){if(ae.preventDefault(),_){me.current?.focus();return}let z=Pe.current,$=Oe.current;if(!z||!$)return;ae.shiftKey?document.activeElement===z?$.focus():z.focus():document.activeElement===$?z.focus():$.focus()}},"onKey");return window.addEventListener("keydown",le,!0),()=>window.removeEventListener("keydown",le,!0)},[b,_]),b===null)return null;let St=e(()=>{_||(ie(null),G(null))},"close"),gt=e(()=>{Y(!0),ie(null);let ae=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(fe=>fe.workspaceId===b.workspaceId),z=n.sessions.list?.getSnapshot?.()?.byId??{},$=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]),be=(ae?.sessionIds??[]).filter(fe=>Gn(fe,z,$));er(n.workspaces,be,N).then(fe=>{if(Y(!1),fe.failures.length>0){ie(zn(fe.failures,p));return}G(null)}).catch(fe=>{Y(!1),ie(Tr(fe,p))})},"confirm");return(0,a.jsxs)("div",{className:"dsham_sidebarCardRoot",children:[(0,a.jsx)("div",{className:"dsham_sidebarCardBackdrop",onClick:St}),(0,a.jsxs)("div",{ref:me,role:"dialog","aria-modal":!0,"aria-label":p("menu.archiveWorkspace"),tabIndex:-1,className:"dsham_sidebarCard",style:De?{top:De.top,left:De.left,visibility:"visible"}:{visibility:"hidden",top:0,left:0},children:[(0,a.jsx)("h3",{className:"dsham_sidebarCardTitle",children:p("archiveWorkspace.title",{n:b.count})}),(0,a.jsx)("p",{className:"dsham_sidebarCardDesc",children:p("archiveWorkspace.desc",{name:b.title})}),_&&(0,a.jsx)("div",{className:"dsham_sidebarCardDesc",role:"status",children:p("archiveWorkspace.pending")}),Ee!==null&&(0,a.jsx)("div",{className:"dsham_sidebarCardError",role:"alert",children:Ee}),(0,a.jsxs)("div",{className:"dsham_sidebarCardFooter",children:[(0,a.jsx)("button",{ref:Pe,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnCancel",disabled:_,onClick:St,children:p("cancel")}),(0,a.jsx)("button",{ref:Oe,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnDanger",disabled:_,onClick:gt,children:p("archiveWorkspace.confirm")})]})]})]})}e(cn,"ArchiveWorkspaceOverlay");function Rt(p){if(typeof document>"u"||typeof document.addEventListener!="function"||typeof MutationObserver>"u")return()=>{};let b=null,_=!1,Y=new Map,Ee=!1,ie=e(z=>{let be=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(Se=>Se.workspaceId===z);if(be===void 0)return[];let fe=n.sessions.list?.getSnapshot?.()?.byId??{},Fe=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]);return be.sessionIds.filter(Se=>Gn(Se,fe,Fe))},"workspaceCandidateIds"),De=e(()=>{if(Ee=!1,!_)for(let[z,$]of Y){if(!z.isConnected){Y.delete(z);continue}let be=ie($.workspaceId).length===0;z.disabled=be,z.style.opacity=be?"0.5":"",z.style.cursor=be?"not-allowed":""}},"revalidateItems"),je=e(()=>{if(Y.size===0||Ee||_)return;Ee=!0;let z=e(()=>De(),"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(z):setTimeout(z,16)},"scheduleRevalidate"),me=e(z=>{b=Ar(z.target)},"rememberWorkspace");document.addEventListener("pointerdown",me,!0),document.addEventListener("click",me,!0);let Pe=e(()=>{if(_)return;for(let[$]of Y)$.isConnected||Y.delete($);let z=document.querySelectorAll('[role="menu"]');for(let $ of z){if($.querySelector('[data-dsham-archive-workspace="true"]'))continue;let be=Array.from($.querySelectorAll('button[role="menuitem"]'));if(be.length===0)continue;let fe=be.find(ye=>Yn(ye,!1))??be.find(ye=>Yn(ye,!0));if(!fe)continue;let Fe=be.find(ye=>ye!==fe)??fe,Se=fe.parentElement;if(!Se)continue;let Be=b;if(!Be)continue;let Me=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(ye=>ye.workspaceId===Be.workspaceId),Q=Me?.path??Me?.cwd,xe=ie(Be.workspaceId).length,ot=document.createElement("div");ot.className=Se.className;let nt=Fe.className.split(/\s+/).filter(ye=>!/(?:^|[_-])danger(?:$|[_-])/i.test(ye)).join(" "),ue=document.createElement("button");ue.type="button",ue.setAttribute("role","menuitem"),ue.dataset.dshamArchiveWorkspace="true",ue.className=nt;let Ft=Fe.querySelector("span"),$t=Fe.querySelectorAll("span")[1],Xt=document.createElement("span");Xt.setAttribute("aria-hidden","true"),Ft?.className&&(Xt.className=Ft.className),Xt.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 2.5H2.5C1.94772 2.5 1.5 2.94772 1.5 3.5V4.5C1.5 5.05228 1.94772 5.5 2.5 5.5H13.5C14.0523 5.5 14.5 5.05228 14.5 4.5V3.5C14.5 2.94772 14.0523 2.5 13.5 2.5Z"/><path d="M2.5 5.5V13.5C2.5 13.7652 2.60536 14.0196 2.79289 14.2071C2.98043 14.3946 3.23478 14.5 3.5 14.5H12.5C12.7652 14.5 13.0196 14.3946 13.2071 14.2071C13.3946 14.0196 13.5 13.7652 13.5 13.5V5.5"/><path d="M6.5 9.5H9.5"/></svg>';let kn=document.createElement("span");if($t?.className&&(kn.className=$t.className),kn.textContent=p("menu.archiveWorkspace"),ue.append(Xt,kn),ot.append(ue),xe===0&&(ue.disabled=!0,ue.style.opacity="0.5",ue.style.cursor="not-allowed"),ue.addEventListener("click",ye=>{ye.preventDefault(),ye.stopPropagation();let rt=ie(Be.workspaceId).length;rt!==0&&(document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),G({workspaceId:Be.workspaceId,title:Be.title,count:rt}))}),Q){let ye=document.createElement("div");ye.className=Se.className;let rt=document.createElement("button");rt.type="button",rt.setAttribute("role","menuitem"),rt.dataset.dshamCopyWorkspacePath="true",rt.className=nt,rt.disabled=!1,rt.style.opacity="",rt.style.cursor="";let Qt=document.createElement("span");Qt.setAttribute("aria-hidden","true"),Ft?.className&&(Qt.className=Ft.className),Qt.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M10.5 3.5V2.5C10.5 1.94772 10.0523 1.5 9.5 1.5H3.5C2.94772 1.5 2.5 1.94772 2.5 2.5V8.5C2.5 9.05228 2.94772 9.5 3.5 9.5H4.5"/></svg>';let dn=document.createElement("span");$t?.className&&(dn.className=$t.className),dn.textContent=p("menu.copyWorkspacePath"),rt.append(Qt,dn),ye.append(rt),rt.addEventListener("click",Mt=>{Mt.preventDefault(),Mt.stopPropagation(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),cr(Q).catch(()=>{})});let un=document.createElement("div");un.className=Se.className;let Et=document.createElement("button");Et.type="button",Et.setAttribute("role","menuitem"),Et.dataset.dshamOpenExplorer="true",Et.className=nt,Et.disabled=!1,Et.style.opacity="",Et.style.cursor="";let lt=document.createElement("span");lt.setAttribute("aria-hidden","true"),Ft?.className&&(lt.className=Ft.className),lt.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M1.5 3.5C1.5 2.94772 1.94772 2.5 2.5 2.5H6.5L8 4.5H13.5C14.0523 4.5 14.5 4.94772 14.5 5.5V12.5C14.5 13.0523 14.0523 13.5 13.5 13.5H2.5C1.94772 13.5 1.5 13.0523 1.5 12.5V3.5Z"/><path d="M10 8.5L12 10.5L10 12.5"/><path d="M6.5 10.5H12"/></svg>';let en=document.createElement("span");$t?.className&&(en.className=$t.className),en.textContent=p("menu.openInExplorer"),Et.append(lt,en),un.append(Et),Et.addEventListener("click",Mt=>{Mt.preventDefault(),Mt.stopPropagation(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),(async()=>{try{let Bt=await fetch(Rn("/open-in-app/open"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({app:"explorer",path:Q})}).catch(()=>null);if(Bt&&Bt.ok)return}catch{}try{await wt("/open-in-explorer",{method:"POST",body:JSON.stringify({path:Q,workspaceId:Be.workspaceId})})}catch(Bt){console.warn("archive-manager: open in explorer failed",Bt)}})()}),Se.parentNode?.insertBefore(ye,Se),Se.parentNode?.insertBefore(un,Se)}Se.parentNode?.insertBefore(ot,Se),Y.set(ue,{workspaceId:Be.workspaceId})}},"checkAndInject"),Oe=!1,St=e(()=>{if(Oe||_)return;Oe=!0;let z=e(()=>{Oe=!1,!_&&Pe()},"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(z):setTimeout(z,16)},"scheduleInject"),gt=new MutationObserver(z=>{Pn(z,'[role="menu"]')&&St()});gt.observe(document.body,{childList:!0,subtree:!0});let le=n.sessions.list?.subscribe?.(je),ae=n.workspaces.list?.subscribe?.(je);return()=>{_=!0,document.removeEventListener("pointerdown",me,!0),document.removeEventListener("click",me,!0),gt.disconnect(),le?.(),ae?.(),Y.clear();for(let z of document.querySelectorAll('[data-dsham-archive-workspace="true"], [data-dsham-copy-workspace-path="true"], [data-dsham-open-explorer="true"]'))z.parentElement?.remove()}}e(Rt,"setupWorkspaceMenuInjector");function vn(){return typeof n.slots.entries!="function"?!1:n.slots.entries("sidebar.workspaces").some(p=>p.children?.[M]!==void 0)}e(vn,"hostSidebarDeclaresSessionMenu");let mt,qt,jt,bn,yn,wn,Vt,Sn=e(()=>{let p=vn()?"menu":"waiting";p!==mt&&(mt=p,p==="menu"&&(qt??=n.slots.inject(M,()=>n.slots.register({name:M,id:"archive-manager.delete-session",order:500,locale:qe,inject:e(()=>({}),"inject")},Je)),jt??=n.slots.inject(M,()=>n.slots.register({name:M,id:"archive-manager.favorite",order:50,locale:qe,inject:e(()=>({favoriteRow:pt}),"inject")},At)),bn??=n.slots.inject(M,()=>n.slots.register({name:M,id:"archive-manager.move-session",order:480,locale:qe,inject:e(()=>({}),"inject")},Wt)),yn??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.delete-session",locale:qe,inject:e(()=>({t:n.locale.bind(qe)}),"inject")},X)),wn??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.archive-workspace",locale:qe,inject:e(()=>({t:n.locale.bind(qe)}),"inject")},cn)),Vt??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.toast",locale:qe,inject:e(()=>({}),"inject")},_e))))},"reconcileSidebar");Sn(),n.effect(()=>Rt(n.locale.bind(qe)),"archive-manager: workspace menu injector"),n.effect(()=>jr(),"archive-manager: sidebar row contextmenu trigger"),zr(n);let Nt=typeof n.on=="function"?n.on("slots/changed",p=>{if(p==="sidebar.workspaces")try{Sn()}catch(b){console.warn("archive-manager: sidebar mode switch failed",b)}}):void 0;n.effect(()=>()=>{Nt?.(),qt?.(),jt?.(),bn?.(),yn?.(),wn?.(),Vt?.()},"archive-manager: sidebar mode");let ft=e(()=>({archiveSessions:ee,archiveSession:e((p,b)=>n.workspaces.archiveSession(p,b),"archiveSession"),sessionStore:Qn(n.sessions.list),workspaceStore:Qn(n.workspaces.list),unarchiveSession:Tt,deleteSession:q,unarchiveSessions:K,deleteArchivedSessions:Le,archivedSessionMetadata:Qe,openConversation:m,focusSessionWorkspace:C,viewState:l,favoriteSessions:tt,setSessionFavorite:on,favoriteSync:pt,organizeBatch:xt,diagnoseOrphanSubagents:P,cleanOrphanSubagents:ze,diagnoseSessionCaches:B,rebuildSessionCaches:u,refreshCacheLists:Ce,searchSessionContent:yt,searchArchivedContent:pe,previewArchivedSession:st,t:n.locale.bind(qe)}),"buildArchivedSectionProps"),wt=e(async(p,b)=>{let _=Rn(`/api/michengai/dsh-archive-manager${p}`),Y=Object.assign({"content-type":"application/json","x-michengai-plugin-update":"1"},b?.headers),Ee=await fetch(_,Object.assign({},b,{headers:Y})),ie=await Ee.json();if(!Ee.ok||!ie||ie.ok===!1)throw new Error((ie&&typeof ie=="object"&&typeof ie.error=="string"?ie.error:void 0)||`HTTP ${Ee.status}`);return ie},"callSettingsApi"),Dt=null,Ct=!1,Jt=e(()=>{if(!(!Ct||Dt)&&!(Ge&&!Ge.isSettingsSectionEnabled()))try{let p=n.slots.register({name:"settings.section",id:"archive-manager",order:45,label:e(()=>n.locale.bind(qe)("archived.badge"),"label"),icon:"archive",locale:qe,inject:ft},Dn);Dt=typeof p=="function"?p:()=>{}}catch(p){console.warn("archive-manager: register settings.section failed:",p),Dt=null}},"mountSettingsSection"),Ot=e(()=>{if(Dt){try{Dt()}catch{}Dt=null}},"unmountSettingsSection"),xn=e(()=>{Ge?.isSettingsSectionEnabled?.()??!0?Jt():Ot()},"syncSettingsSection");Ge=vr(n,{callApi:wt,renderPanel:e(p=>(0,a.jsx)(Dn,Object.assign({},ft(),p)),"renderPanel"),injectProps:ft,ns:qe,onOnlineUpdateChange:e(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("dsham-update-toggle"))},"onOnlineUpdateChange"),onSidebarFavoriteStarChange:e(p=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("dsham-favorite-star-toggle",{detail:{enabled:p}}))},"onSidebarFavoriteStarChange"),onLocationChange:e(()=>{xn()},"onLocationChange")}),n.effect(()=>()=>{Ge?.destroy(),Ot()},"archive-manager: sidebar entry"),n.effect(()=>Oa({endpoint:"/api/michengai/dsh-archive-manager/update",packageName:"@michengai/dsh-archive-manager",titleRowSelector:".dsham_settingsTitleRow",linksSelector:".dsham_settingsLinks",zhName:"\u5F52\u6863\u4F1A\u8BDD",enName:"Archived sessions",ruName:"\u0410\u0440\u0445\u0438\u0432 \u0441\u0435\u0441\u0441\u0438\u0439",createIcon:V,isEnabled:e(()=>Ge.isOnlineUpdateEnabled(),"isEnabled")}),"dsh-archive-manager: plugin update ui"),n.slots.inject("settings.section",()=>{Ct=!0;try{if(Ge&&!Ge.isSettingsSectionEnabled())return()=>{Ct=!1,Ot()};let p=n.slots.register({name:"settings.section",id:"archive-manager",order:45,label:e(()=>n.locale.bind(qe)("archived.badge"),"label"),icon:"archive",locale:qe,inject:ft},Dn);return Dt=typeof p=="function"?p:()=>{},()=>{Ct=!1,Ot()}}catch(p){return console.warn("archive-manager: register settings.section failed:",p),()=>{Ct=!1}}})}e(ks,"applyWorkspaceBrowser");async function Cs(n,s,l,h){try{await s(n)}catch(v){l(es(v,h))}}return e(Cs,"forkWithFeedback"),i.__test={computeSubmenuPosition:Yr,forkWithFeedback:Cs,favoritesOnlyVisibility:wr,favoriteGroupPredicate:Sr,createFavoriteRowStore:kr,unarchivedSessionIds:Ur,ArchiveSelectionToolbar:Lr,ArchivedSessionsSection:Dn,zh:Vr,en:$r,displayTitle:et,isUnknownSessionError:Mn,deriveArchivedGroups:Wr,sortArchivedGroups:qr,deriveArchivedBatchIds:fn,archivedSessionIdsInGroups:Fr,pruneArchivedSelection:Br,toggleArchivedSelection:Xn,archivedDeleteFeedback:Hr,isWorkspaceTaskCandidate:Gn,isWorkspaceDeleteMenuItem:Yn,workspaceMenuTriggerFrom:Ar,findRowMenuButton:Kn,isRowMenuButton:Rr,setupSidebarRowContextMenu:jr,applySettingsNavIcon:Dr,restoreSettingsNavIcon:Mr,installSettingsNavIcon:zr,mutationTouches:Pn,resolveRowHasStatus:Yt,activeSessionActivity:Ln,activeSessionRefusal:Ir,activeArchiveFromMessage:_r,archiveSessionsViaOfficial:er,unarchiveSessionsViaOfficial:Kr,createUnarchiveSession:Gr,bindObservable:Qn,ARCHIVE_MANAGER_REMOTE:ut,currentSessionId:qn,setupSidebarEntry:vr,ArchiveBundleConfigCard:fr,ArchiveBundleConfigCardWrapper:gr,setupWorkspaceFavoritesOnly:xr},i.apply=xs,i.inject=Ss,r.exports}e(pi,"startArchiveClient");
|
|
22
|
+
`;function Ha(){if(typeof document>"u"||typeof document.getElementById!="function"||document.getElementById(Ba)!==null||typeof document.createElement!="function")return;let t=document.createElement("style");t.id=Ba,t.textContent=li,(document.head??document.documentElement)?.appendChild?.(t)}e(Ha,"ensureSidebarEntryStyle");function ci(t){let r=t&&typeof t.size=="number"?t.size:16;return Be(tn.IconArchiveOutlineMedium,{size:r})}e(ci,"ArchiveSidebarIcon");function gr(t){Ha();let{t:r,location:i,onLocationChange:a,errorMessage:o,enabled:f=!1,onToggle:c,disabled:k,onlineUpdateEnabled:y=!0,onToggleOnlineUpdate:A,onlineUpdateDisabled:w,onlineUpdateLocked:g=!1,sidebarFavoriteStarEnabled:S=!0,onToggleSidebarFavoriteStar:D,sidebarFavoriteStarDisabled:j}=t,W=i??(f?"both":"settings"),z=e(pe=>{(pe==="both"||pe==="sidebar"||pe==="settings")&&(typeof a=="function"?a(pe):typeof c=="function"&&c(pe!=="settings"))},"handleLocationChange"),U=[Be("div",{key:"entry-location",className:"dsham_bundle_row"},Be("div",{className:"dsham_bundle_label_box"},Be("span",{className:"dsham_bundle_title"},r("entry.location.title")),Be("span",{className:"dsham_bundle_desc"},r("entry.location.desc")),o?Be("span",{className:"dsham_bundle_error",role:"alert"},o):null),Be(tn.SegmentedControl,{id:"dsham-bundle-entry-location",value:W,onChange:z,label:r("entry.location.title"),disabled:k,options:[{value:"both",label:r("entry.location.both")},{value:"sidebar",label:r("entry.location.sidebar")},{value:"settings",label:r("entry.location.settings")}]}))];if(typeof A=="function"){let pe=g?`${r("update.entry.desc")} (${r("update.entry.locked")})`:r("update.entry.desc");U.push(Be("div",{key:"online-update",className:"dsham_bundle_row"},Be("div",{className:"dsham_bundle_label_box"},Be("span",{className:"dsham_bundle_title"},r("update.entry.title")),Be("span",{className:"dsham_bundle_desc"},pe)),Be(tn.Switch,{checked:y,onChange:A,label:r("update.entry.toggle"),disabled:w||g,title:g?r("update.entry.locked"):void 0})))}return typeof D=="function"&&U.push(Be("div",{key:"sidebar-favorite-star",className:"dsham_bundle_row"},Be("div",{className:"dsham_bundle_label_box"},Be("span",{className:"dsham_bundle_title"},r("sidebar.favoriteStar.title")),Be("span",{className:"dsham_bundle_desc"},r("sidebar.favoriteStar.desc"))),Be(tn.Switch,{checked:S,onChange:D,label:r("sidebar.favoriteStar.toggle"),disabled:j}))),Be(ia,null,U)}e(gr,"ArchiveBundleConfigCard");function vr(t){let[r,i]=Ut(t.getLocation),[a,o]=Ut(t.getOnlineUpdateEnabled?t.getOnlineUpdateEnabled:()=>!0),[f,c]=Ut(t.getOnlineUpdateLocked?t.getOnlineUpdateLocked:()=>!1),[k,y]=Ut(t.getSidebarFavoriteStarEnabled?t.getSidebarFavoriteStarEnabled:()=>!0),[A,w]=Ut(null),[g,S]=Ut(!1),[D,j]=Ut(!1),[W,z]=Ut(!1);la(()=>{let $=e(()=>{i(t.getLocation()),w(null),t.getOnlineUpdateEnabled&&o(t.getOnlineUpdateEnabled()),t.getOnlineUpdateLocked&&c(t.getOnlineUpdateLocked()),t.getSidebarFavoriteStarEnabled&&y(t.getSidebarFavoriteStarEnabled())},"syncState");return $(),t.subscribe($)},[t]);let U=e($=>{S(!0),w(null),i($),t.setLocation($).catch(ue=>{console.error("archive-manager: setLocation failed:",ue),i(t.getLocation()),w(t.t("entry.location.saveFailed")||"\u4FDD\u5B58\u5165\u53E3\u8BBE\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u91CD\u542F\u5BBF\u4E3B\u8FDB\u7A0B")}).finally(()=>{S(!1)})},"onLocationChange"),pe=t.setOnlineUpdate?$=>{t.getOnlineUpdateLocked?.()||(j(!0),o($),t.setOnlineUpdate($).catch(()=>{t.getOnlineUpdateEnabled&&o(t.getOnlineUpdateEnabled())}).finally(()=>{j(!1)}))}:void 0,ie=t.setSidebarFavoriteStar?$=>{z(!0),y($),t.setSidebarFavoriteStar($).catch(()=>{t.getSidebarFavoriteStarEnabled&&y(t.getSidebarFavoriteStarEnabled())}).finally(()=>{z(!1)})}:void 0;return Be(gr,{t:t.t,location:r,errorMessage:A,disabled:g,onLocationChange:U,onlineUpdateEnabled:a,onlineUpdateDisabled:D||f,onlineUpdateLocked:f,onToggleOnlineUpdate:pe,sidebarFavoriteStarEnabled:k,sidebarFavoriteStarDisabled:W,onToggleSidebarFavoriteStar:ie})}e(vr,"ArchiveBundleConfigCardWrapper");function br(t,r){if(Ha(),!t.locale)return{getLocation:e(()=>"settings","getLocation"),setLocation:e(async()=>"settings","setLocation"),isSettingsSectionEnabled:e(()=>!0,"isSettingsSectionEnabled"),isEnabled:e(()=>!1,"isEnabled"),isSupported:e(()=>!1,"isSupported"),setEnabled:e(async()=>!1,"setEnabled"),isOnlineUpdateEnabled:e(()=>!0,"isOnlineUpdateEnabled"),isOnlineUpdateLocked:e(()=>!1,"isOnlineUpdateLocked"),setOnlineUpdate:e(async()=>!1,"setOnlineUpdate"),isSidebarFavoriteStarEnabled:e(()=>!0,"isSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:e(async()=>!1,"setSidebarFavoriteStar"),destroy:e(()=>{},"destroy")};let{callApi:i,renderPanel:a,ns:o}=r,f="settings",c=!1,k=!1,y=null,A=null,w=0,g=!1,S,D=new Set,j=e(()=>f==="both"||f==="sidebar","isSidebarEnabled"),W=e(()=>f==="both"||f==="settings","isSettingsSectionEnabled"),z=e(()=>{if(!g)for(let O of D)try{O()}catch{}},"notify"),U=e(()=>{if(g||!k||!j()||y)return;let O=t.slots.register({name:"main",key:fr,locale:o,inject:e(()=>{let je=typeof r.injectProps=="function"?r.injectProps():{};return Object.assign({t:t.locale?.bind?t.locale.bind(o):void 0},je)},"inject")},je=>Be("div",{className:"dsham_mainPanel"},a(je)));y=typeof O=="function"?O:()=>{}},"mountMain"),pe=e(()=>{if(y){try{y()}catch{}y=null}},"unmountMain"),ie=e(()=>{if(g||!c||!j()||A)return;let O=t.slots.register({name:"sidebar.panellist",id:fr,order:oi,label:e(()=>t.locale.bind(o)("archives.title"),"label"),locale:o},je=>ci(je&&typeof je=="object"&&"size"in je?je:void 0));A=typeof O=="function"?O:()=>{}},"mountRow"),$=e(()=>{if(A){try{A()}catch{}A=null}},"unmountRow"),ue=e(()=>{if(!g)if(j())U(),ie();else{if(S?.panelInfo&&typeof S.selectPanel=="function")try{S.panelInfo.getSnapshot().activePanelId===fr&&S.selectPanel(null)}catch{}$(),pe()}},"sync"),he=e(async O=>{if(g)return f;let je=++w,T=f;if(f=O,ue(),z(),typeof r.onLocationChange=="function")try{r.onLocationChange(O)}catch{}try{return await i("/sidebar-entry",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({location:O})}),O}catch(re){if(je===w&&(f=T,ue(),z(),typeof r.onLocationChange=="function"))try{r.onLocationChange(T)}catch{}throw re}},"setLocation"),Qe=e(async O=>(await he(O?"both":"settings"),j()),"setEnabled"),ne=!0,Q=!1,pt=0,xt=e(async O=>{if(g||Q)return ne;let je=++pt;if(ne=O,z(),typeof r.onOnlineUpdateChange=="function")try{r.onOnlineUpdateChange(O)}catch{}try{if(await i("/online-update",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:O})}),je===pt&&typeof r.onOnlineUpdateChange=="function")try{r.onOnlineUpdateChange(O)}catch{}return O}catch(T){if(je===pt&&(ne=!O,z(),typeof r.onOnlineUpdateChange=="function"))try{r.onOnlineUpdateChange(!O)}catch{}throw T}},"setOnlineUpdate"),Ke=!0,ke=0,mt=e(async O=>{if(g)return Ke;let je=++ke;if(Ke=O,z(),typeof r.onSidebarFavoriteStarChange=="function")try{r.onSidebarFavoriteStarChange(O)}catch{}try{return await i("/sidebar-favorite-star",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({enabled:O})}),O}catch(T){if(je===ke&&(Ke=!O,z(),typeof r.onSidebarFavoriteStarChange=="function"))try{r.onSidebarFavoriteStarChange(!O)}catch{}throw T}},"setSidebarFavoriteStar"),ot=w;i("/sidebar-entry").then(O=>{if(!g&&w===ot&&O&&(O.location==="both"||O.location==="sidebar"||O.location==="settings"?f=O.location:typeof O.enabled=="boolean"&&(f=O.enabled?"both":"settings"),ue(),z(),typeof r.onLocationChange=="function"))try{r.onLocationChange(f)}catch{}}).catch(()=>{});let nn=pt;i("/online-update").then(O=>{if(!g&&pt===nn&&O&&typeof O.enabled=="boolean"&&(ne=O.enabled,O.locked===!0&&(Q=!0),z(),typeof r.onOnlineUpdateChange=="function"))try{r.onOnlineUpdateChange(ne)}catch{}}).catch(()=>{});let Pt=ke;i("/sidebar-favorite-star").then(O=>{if(!g&&ke===Pt&&O&&typeof O.enabled=="boolean"&&(Ke=O.enabled,z(),typeof r.onSidebarFavoriteStarChange=="function"))try{r.onSidebarFavoriteStarChange(Ke)}catch{}}).catch(()=>{});let rn=t;return typeof rn.inject=="function"&&rn.inject(["layout"],O=>{!g&&O.layout&&(S=O.layout)}),t.slots.inject("main",()=>{if(!g)return k=!0,U(),()=>{k=!1,pe()}}),t.slots.inject("sidebar.panellist",()=>{if(!g)return c=!0,ie(),()=>{c=!1,$()}}),t.slots.inject("plugins.bundle.config",()=>{if(!g)return t.slots.register({name:"plugins.bundle.config",key:ii,locale:o},O=>O&&O.view==="summary"?null:Be(vr,{t:t.locale.bind(o),getLocation:e(()=>f,"getLocation"),setLocation:he,getEnabled:e(()=>j(),"getEnabled"),setSidebar:Qe,getOnlineUpdateEnabled:e(()=>ne,"getOnlineUpdateEnabled"),setOnlineUpdate:xt,getOnlineUpdateLocked:e(()=>Q,"getOnlineUpdateLocked"),getSidebarFavoriteStarEnabled:e(()=>Ke,"getSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:mt,subscribe:e(je=>(D.add(je),()=>{D.delete(je)}),"subscribe")}))}),{getLocation:e(()=>f,"getLocation"),setLocation:he,isSettingsSectionEnabled:W,isEnabled:e(()=>j(),"isEnabled"),isSupported:e(()=>c,"isSupported"),setEnabled:Qe,isOnlineUpdateEnabled:e(()=>ne,"isOnlineUpdateEnabled"),isOnlineUpdateLocked:e(()=>Q,"isOnlineUpdateLocked"),setOnlineUpdate:xt,isSidebarFavoriteStarEnabled:e(()=>Ke,"isSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:mt,destroy:e(()=>{g||(g=!0,w++,pt++,ke++,S=void 0,D.clear(),$(),pe())},"destroy")}}e(br,"setupSidebarEntry");function yr(t){if(typeof t!="string"||t.length===0||t.length>1024)throw new TypeError("\u4F1A\u8BDD ID \u957F\u5EA6\u987B\u4E3A 1\uFF5E1024 \u4E2A\u5B57\u7B26");return t}e(yr,"checkedId");var di={parse(t){let r=le(t);if(!r||typeof r!="object"||typeof r.favorite!="boolean")throw new TypeError("\u6536\u85CF\u72B6\u6001\u5FC5\u987B\u4E3A\u5E03\u5C14\u503C");return{sessionId:yr(r.sessionId),favorite:r.favorite}}},ui={parse(t){let r=le(t);if(!r||!Array.isArray(r.favoriteSessionIds)||r.favoriteSessionIds.length>1e5)throw new TypeError("\u6536\u85CF\u96C6\u5408\u65E0\u6548");return{favoriteSessionIds:[...new Set(r.favoriteSessionIds.map(yr))]}},safeParse(t){try{return{success:!0,data:this.parse(t)}}catch(r){return{success:!1,error:r}}}};function Ua(){let t=e((r,i)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${r}`,create:e(()=>i,"create"),schema:i}),"codec");return["favoriteSessions","setSessionFavorite"].map(r=>({id:`@michengai/dsh-archive-manager#workspaceRegistry/${r}`,service:"workspaceRegistry",namespace:"workspaceRegistry",method:r,invocation:{kind:"direct"},parameters:r==="favoriteSessions"?[]:[{name:"input",wire:"input",source:"json",codec:t("FavoriteInput",di)}],result:t("FavoriteState",ui),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(Ua,"favoriteInvocations");function wr(t,{days:r,now:i=Date.now(),favorites:a=new Set,currentId:o,pending:f=new Map}){if(!t||!Number.isInteger(r)||r<1||r>36500||a.has(t.id)||t.id===o||(t.retainedBy?.mainView??0)>0||t.running||(t.runningSubagentCount??0)>0||t.pendingInteraction!=null||f.has(t.id))return!1;let c=typeof t.updatedAt=="number"?t.updatedAt:Date.parse(t.updatedAt??"");return Number.isFinite(c)&&c<=i-r*864e5}e(wr,"idleArchiveCandidate");async function Kn(t,r,{onProgress:i,refresh:a}={}){let o=[...new Set(t.map(yr))],f={requested:o,succeeded:[],skipped:[],failures:[],remaining:[],refreshError:null},c=e(()=>i?.({total:o.length,done:f.succeeded.length+f.skipped.length+f.failures.length,succeeded:f.succeeded.length,skipped:f.skipped.length,failed:f.failures.length}),"report");c();for(let k of o){try{(await r(k)?f.succeeded:f.skipped).push(k)}catch(y){f.failures.push({sessionId:k,message:y instanceof Error?y.message:String(y)}),f.remaining.push(k)}c()}try{await a?.()}catch(k){f.refreshError=k instanceof Error?k.message:String(k)}return f}e(Kn,"runSessionBatch");function Wa({workspaces:t,sessions:r,archive:i,restore:a,deleteOne:o,getFavorites:f,refresh:c,currentSessionId:k}){return async(y,A,w={})=>{if(!["archive","restore","undo","delete"].includes(y))throw new TypeError("\u672A\u77E5\u6279\u91CF\u64CD\u4F5C");return Kn(A,async g=>{let D=t.getSnapshot().archivedSessionIds.includes(g);if(y==="archive"){if(D||!r.getSnapshot().byId[g])return!1;if(w.idleDays!==void 0){let pe=new Set((await f()).favoriteSessionIds),ie=r.getSnapshot();if(!wr(ie.byId[g],{days:w.idleDays,favorites:pe,currentId:k(ie),pending:w.getPending?.()??w.pending}))return!1}return await i(g),t.getSnapshot().archivedSessionIds.includes(g)}return D?y==="delete"?(await o(g),!0):!((await a(g))?.archivedSessionIds??t.getSnapshot().archivedSessionIds).includes(g):!1},{onProgress:w.onProgress,refresh:c})}}e(Wa,"createSessionOrganizer");function hi(t){return!t||t<=0?"0 B":t<1024?t+" B":t<1024*1024?(t/1024).toFixed(1)+" KB":(t/(1024*1024)).toFixed(1)+" MB"}e(hi,"formatBytes");function qa(t,r){let i=t.createElement;function a(f,c){return i(r??(y=>i("button",{type:"button",disabled:y.disabled,onClick:y.onClick},y.children)),{variant:"outline",size:"sm",...c},f)}e(a,"textButton");function o({title:f,failures:c,separator:k}){let[y,A]=t.useState(!1),w=i("ul",null,c.map(g=>i("li",{key:g.sessionId},g.sessionId,k,g.message)));return i(qn,{title:f,open:y,onToggle:e(()=>A(g=>!g),"onToggle")},w)}return e(o,"FailureDetails"),e(function({t:c,archived:k,busy:y,ready:A,days:w,onDays:g,count:S,onPreview:D,progress:j,result:W,onRetry:z,undoCount:U,onUndo:pe,onReload:ie,orphanCount:$=0,orphanSizeBytes:ue=0,orphanCleaning:he=!1,onCleanOrphans:Qe,cacheCount:ne=0,cacheRepair:Q,onRebuildCaches:pt,onRetryCaches:xt,onReloadCaches:Ke,onDismissCaches:ke}){return i(t.Fragment,null,i("style",null,".dsham_organizer,.dsham_batchFeedback{display:grid;gap:12px;margin:0 0 16px;padding:14px 16px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2)}.dsham_organizerControls{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.dsham_organizer label{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--dsw-alias-label-primary)}.dsham_number{width:88px;height:32px;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}.dsham_number:hover{border-color:var(--dsw-alias-border-l3)}.dsham_number:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}.dsham_disclosure{display:inline-flex;align-items:center;gap:6px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;cursor:pointer}.dsham_foldChevron{transition:transform 150ms ease}.dsham_foldChevron.is-open{transform:rotate(180deg)}.dsham_organizer p,.dsham_batchFeedback p{margin:0;font-size:12px;color:var(--dsw-alias-label-secondary)}.dsham_batchFeedback progress{width:100%}.dsham_batchFeedback details{font-size:12px;overflow-wrap:anywhere}.dsham_archivePreview{max-height:260px;overflow:auto;display:grid;gap:8px;padding:8px 0}.dsham_archivePreview label{display:flex;gap:8px;align-items:center;overflow-wrap:anywhere}"),(!k||!A)&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},!A&&a(c("organizer.reloadFavorites"),{disabled:y,onClick:ie}),!k&&i(t.Fragment,null,i("label",null,c("organizer.idleDays"),i(da,{min:1,max:36500,value:w===""?null:Number(w),disabled:y,"aria-label":c("organizer.idleDays"),onChange:e(mt=>g(mt==null?"":String(mt)),"onChange")})),a(c("organizer.preview",{n:S}),{disabled:y||!A||S===0,onClick:D}))),!k&&i("p",null,c("organizer.rules"))),$>0&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},i("strong",null,c("organizer.orphanTitle",{n:$})),Qe&&a(c(he?"organizer.cleaning":"organizer.cleanOrphans"),{disabled:y||he,onClick:Qe})),i("p",null,c("organizer.orphanDesc",{size:hi(ue)}))),ne>0&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},i("strong",null,c("organizer.cacheTitle",{n:ne})),pt&&a(c(Q?.busy?"organizer.cacheRebuilding":"organizer.cacheRebuild"),{disabled:y||Q?.busy,onClick:pt})),i("p",null,c("organizer.cacheDesc"))),Q&&(Q.result||Q.progress||Q.error||Q.refreshError)&&i("section",{className:"dsham_batchFeedback","aria-label":c("organizer.cacheRebuild")},Q.progress&&i("div",{role:"status"},i("progress",{value:Q.progress.done,max:Math.max(1,Q.progress.total)}),c("organizer.progressCount",Q.progress)),Q.result&&i("div",{role:"status"},i("p",null,c("organizer.result",{succeeded:Q.result.rebuiltSessionIds.length,skipped:Q.result.skippedSessionIds.length,failed:Q.result.failures.length})),Q.result.failures.length>0&&i(o,{title:c("organizer.failureDetails"),failures:Q.result.failures,separator:c("common.separator")}),Q.result.failures.length>0&&xt&&a(c("organizer.cacheRetry",{n:Q.result.failures.length}),{disabled:y||Q.busy,onClick:xt})),Q.error&&i("p",{role:"alert"},c("organizer.cacheError",{detail:Q.error})),Q.refreshError&&i("p",{role:"alert"},c("organizer.refreshError",{detail:Q.refreshError})),i("div",{className:"dsham_organizerControls"},Ke&&a(c("organizer.cacheCheck"),{disabled:y||Q.busy,onClick:Ke}),ke&&a(c("organizer.dismiss"),{disabled:y||Q.busy,onClick:ke}))),(j||W||U>0)&&i("section",{className:"dsham_batchFeedback","aria-label":c("organizer.feedback")},j&&i("div",{role:"status","aria-live":"polite"},i("progress",{value:j.done,max:Math.max(1,j.total),"aria-label":c("organizer.progress")}),c("organizer.progressCount",{done:j.done,total:j.total})),W&&i("div",{role:"status"},i("strong",null,c(`organizer.${W.kind??"archive"}Result`)),i("p",null,c("organizer.result",{succeeded:W.succeeded.length,skipped:W.skipped.length,failed:W.failures.length})),W.failures.length>0&&i(o,{title:c("organizer.failureDetails"),failures:W.failures,separator:c("common.separator")}),W.refreshError&&i("p",{role:"alert"},c("organizer.refreshError",{detail:W.refreshError})),W.remaining.length>0&&a(c("organizer.retry",{n:W.remaining.length}),{disabled:y,onClick:z})),U>0&&i("div",{className:"dsham_organizerControls"},a(c("organizer.undo",{n:U}),{disabled:y,onClick:pe}),i("p",null,c("organizer.undoHint")))))},"OrganizerPanel")}e(qa,"createOrganizerPanel");var Va={"organizer.cacheTitle":"\u53D1\u73B0 {n} \u4E2A\u4F1A\u8BDD\u7F3A\u5C11\u53EF\u7528\u5217\u8868\u7F13\u5B58","organizer.cacheDesc":"\u68C0\u67E5\u5DE5\u4F5C\u533A\u3001\u672A\u5206\u7EC4\u53CA\u5F52\u6863\u666E\u901A\u4F1A\u8BDD\u7684\u5934\u90E8\u4E0E\u5B98\u65B9\u7F13\u5B58\u3002\u70B9\u51FB\u540E\u9010\u6761\u53EA\u8BFB\u65E5\u5FD7\u5E76\u91CD\u5EFA\u5B98\u65B9\u5217\u8868\u7F13\u5B58\uFF1B\u8DF3\u8FC7\u6D3B\u52A8\u4F1A\u8BDD\uFF0C\u4E0D\u6253\u5F00\u4F1A\u8BDD\u3001\u4E0D\u8C03\u7528\u6A21\u578B\uFF0C\u4E5F\u4E0D\u6539\u53D8\u5F52\u6863\u6216\u5B9A\u65F6\u4EFB\u52A1\u3002\u8D85\u65F6\u8868\u793A\u4FDD\u5B58\u672A\u786E\u8BA4\uFF0C\u53EF\u91CD\u8BD5\u3002","organizer.cacheRebuild":"\u91CD\u5EFA\u5217\u8868\u7F13\u5B58","organizer.cacheRebuilding":"\u91CD\u5EFA\u4E2D\u2026","organizer.cacheRetry":"\u91CD\u8BD5\u5931\u8D25 {n} \u6761","organizer.cacheCheck":"\u5237\u65B0\u5217\u8868\u5E76\u91CD\u65B0\u68C0\u6D4B","organizer.cacheError":"\u7F13\u5B58\u68C0\u6D4B\u5931\u8D25\uFF1A{detail}","organizer.dismiss":"\u5B8C\u6210","organizer.feedback":"\u64CD\u4F5C\u53CD\u9988","organizer.allSessions":"\u5168\u90E8\u4F1A\u8BDD","organizer.favoriteFilter":"\u6536\u85CF\u7B5B\u9009","organizer.archiveResult":"\u5F52\u6863\u7ED3\u679C","organizer.restoreResult":"\u6062\u590D\u7ED3\u679C","organizer.deleteResult":"\u5220\u9664\u7ED3\u679C","organizer.undoResult":"\u64A4\u56DE\u7ED3\u679C","organizer.favorite":"\u6536\u85CF","organizer.unfavorite":"\u53D6\u6D88\u6536\u85CF","organizer.favoritesOnly":"\u53EA\u770B\u6536\u85CF","organizer.reloadFavorites":"\u91CD\u65B0\u52A0\u8F7D\u6536\u85CF","organizer.idleDays":"\u95F2\u7F6E\u5929\u6570","organizer.preview":"\u9884\u89C8\u95F2\u7F6E\u5F52\u6863\uFF08{n}\uFF09","organizer.rules":"\u6309\u6700\u540E\u6D3B\u52A8\u65F6\u95F4\u7B5B\u9009\uFF0C\u9075\u5FAA\u5F53\u524D\u5217\u8868\u7B5B\u9009\u6761\u4EF6\uFF1B\u6392\u9664\u6536\u85CF\u3001\u5F53\u524D\u6253\u5F00\u3001\u6B63\u5728\u6267\u884C\u53CA\u7B49\u5F85\u4EA4\u4E92\u7684\u4F1A\u8BDD\u3002","organizer.progress":"\u6279\u91CF\u64CD\u4F5C\u8FDB\u5EA6","organizer.progressCount":"\u5DF2\u5904\u7406 {done} / {total}","organizer.result":"\u6210\u529F {succeeded} \xB7 \u8DF3\u8FC7 {skipped} \xB7 \u5931\u8D25 {failed}","organizer.failureDetails":"\u67E5\u770B\u5931\u8D25\u8BE6\u60C5","organizer.refreshError":"\u64CD\u4F5C\u7ED3\u679C\u5DF2\u4FDD\u7559\uFF0C\u4F46\u5217\u8868\u5237\u65B0\u5931\u8D25\uFF1A{detail}","organizer.retry":"\u91CD\u8BD5\u5269\u4F59 {n} \u6761","organizer.undo":"\u64A4\u56DE\u672C\u6B21\u5F52\u6863\uFF08{n}\uFF09","organizer.undoHint":"\u4EC5\u4FDD\u7559\u672C\u6B21\u6253\u5F00\u7BA1\u7406\u9875\u671F\u95F4\u6700\u8FD1\u4E00\u6279\u5F52\u6863\uFF1B\u5173\u95ED\u9875\u9762\u6216\u5237\u65B0\u540E\u6E05\u9664\u3002\u64A4\u56DE\u4E0D\u4F1A\u6062\u590D\u5DF2\u5220\u9664\u7684\u4F1A\u8BDD\u3002","organizer.idleConfirm":"\u8BF7\u68C0\u67E5\u4EE5\u4E0B\u5019\u9009\uFF0C\u53EF\u53D6\u6D88\u52FE\u9009\uFF1B\u6267\u884C\u524D\u518D\u6B21\u6392\u9664\u6536\u85CF\u53CA\u6D3B\u8DC3\u4F1A\u8BDD\u3002","organizer.manualConfirm":"\u4EC5\u5F52\u6863\u4EE5\u4E0B\u52FE\u9009\u4F1A\u8BDD\uFF1B\u53EF\u9010\u6761\u53D6\u6D88\u3002\u5F52\u6863\u540E\u53EF\u64A4\u56DE\u672C\u6279\u64CD\u4F5C\u3002","organizer.orphanTitle":"\u53D1\u73B0 {n} \u4E2A\u65E0\u4E3B\u5B64\u513F\u5B50\u4EE3\u7406","organizer.orphanDesc":"\u6BCD\u4F1A\u8BDD\u5DF2\u88AB\u5916\u90E8\u5220\u9664\uFF0C\u8FD9\u4E9B\u5B50\u4EE3\u7406\u5728\u65E5\u5E38\u804A\u5929\u5217\u8868\u4E2D\u4E0D\u53EF\u89C1\uFF0C\u5171\u5360\u7528\u7EA6 {size} \u78C1\u76D8\u7A7A\u95F4\u3002\u6E05\u7406\u4E0D\u53EF\u64A4\u9500\u3002","organizer.cleanOrphans":"\u6E05\u7406\u5168\u90E8\u5B64\u513F","organizer.cleaning":"\u6E05\u7406\u4E2D\u2026","organizer.orphanCleanSuccess":"\u5DF2\u6210\u529F\u6E05\u7406 {n} \u4E2A\u65E0\u4E3B\u5B50\u4EE3\u7406\u4F1A\u8BDD\u3002"},$a={"organizer.cacheTitle":"Found {n} sessions without usable list caches","organizer.cacheDesc":"Checks headers and official caches for workspace, ungrouped, and archived ordinary sessions. On click, reads logs one at a time and rebuilds official caches. Skips active sessions; never opens sessions, calls models or changes archives or schedules. Timeout means persistence is unconfirmed and can be retried.","organizer.cacheRebuild":"Rebuild list caches","organizer.cacheRebuilding":"Rebuilding\u2026","organizer.cacheRetry":"Retry {n} failed","organizer.cacheCheck":"Refresh lists and check again","organizer.cacheError":"Cache check failed: {detail}","organizer.dismiss":"Done","organizer.feedback":"Operation feedback","organizer.allSessions":"All sessions","organizer.favoriteFilter":"Favorites filter","organizer.archiveResult":"Archive results","organizer.restoreResult":"Restore results","organizer.deleteResult":"Delete results","organizer.undoResult":"Undo results","organizer.favorite":"Favorite","organizer.unfavorite":"Unfavorite","organizer.favoritesOnly":"Favorites only","organizer.reloadFavorites":"Reload favorites","organizer.idleDays":"Idle days","organizer.preview":"Preview idle archives ({n})","organizer.rules":"Uses last activity, the current list filters. Excludes favorites, open, running and waiting sessions.","organizer.progress":"Batch progress","organizer.progressCount":"Processed {done} / {total}","organizer.result":"Succeeded {succeeded} \xB7 Skipped {skipped} \xB7 Failed {failed}","organizer.failureDetails":"Failure details","organizer.refreshError":"Results retained, but refresh failed: {detail}","organizer.retry":"Retry remaining {n}","organizer.undo":"Undo this archive batch ({n})","organizer.undoHint":"Only the latest archive batch while this page is open is retained. Closing or refreshing clears undo. Deleted sessions cannot be restored.","organizer.idleConfirm":"Review and deselect candidates. Favorites and active sessions are checked again before archiving.","organizer.manualConfirm":"Only checked sessions below will be archived. You can undo this batch afterward.","organizer.orphanTitle":"Found {n} orphan subagents","organizer.orphanDesc":"Parent sessions were deleted externally. These subagents are hidden from normal chat lists and occupy ~{size} disk space. Removal cannot be undone.","organizer.cleanOrphans":"Clean up all orphans","organizer.cleaning":"Cleaning up\u2026","organizer.orphanCleanSuccess":"Successfully cleaned up {n} orphan subagent sessions."},Ga={"organizer.cacheTitle":"\u041D\u0430\u0439\u0434\u0435\u043D\u043E {n} \u0441\u0435\u0441\u0441\u0438\u0439 \u0431\u0435\u0437 \u043F\u0440\u0438\u0433\u043E\u0434\u043D\u043E\u0433\u043E \u043A\u0435\u0448\u0430 \u0441\u043F\u0438\u0441\u043A\u0430","organizer.cacheDesc":"\u041F\u0440\u043E\u0432\u0435\u0440\u044F\u044E\u0442\u0441\u044F \u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043A\u0438 \u0438 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u043A\u0435\u0448 \u0441\u0435\u0441\u0441\u0438\u0439 \u0440\u0430\u0431\u043E\u0447\u0438\u0445 \u043E\u0431\u043B\u0430\u0441\u0442\u0435\u0439, \u0431\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B \u0438 \u0430\u0440\u0445\u0438\u0432\u0430. \u041F\u043E \u043D\u0430\u0436\u0430\u0442\u0438\u044E \u0436\u0443\u0440\u043D\u0430\u043B\u044B \u0447\u0438\u0442\u0430\u044E\u0442\u0441\u044F \u043F\u043E \u043E\u0434\u043D\u043E\u043C\u0443 \u0434\u043B\u044F \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u043A\u0435\u0448\u0430. \u0410\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u043F\u0440\u043E\u043F\u0443\u0441\u043A\u0430\u044E\u0442\u0441\u044F; \u0441\u0435\u0441\u0441\u0438\u0438 \u043D\u0435 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u044E\u0442\u0441\u044F, \u043C\u043E\u0434\u0435\u043B\u0438 \u043D\u0435 \u0432\u044B\u0437\u044B\u0432\u0430\u044E\u0442\u0441\u044F, \u0430\u0440\u0445\u0438\u0432\u044B \u0438 \u0440\u0430\u0441\u043F\u0438\u0441\u0430\u043D\u0438\u044F \u043D\u0435 \u043C\u0435\u043D\u044F\u044E\u0442\u0441\u044F. \u0422\u0430\u0439\u043C-\u0430\u0443\u0442 \u043E\u0437\u043D\u0430\u0447\u0430\u0435\u0442 \u043D\u0435\u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043D\u043D\u043E\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435; \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u043F\u043E\u0432\u0442\u043E\u0440.","organizer.cacheRebuild":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043A\u0435\u0448 \u0441\u043F\u0438\u0441\u043A\u043E\u0432","organizer.cacheRebuilding":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435\u2026","organizer.cacheRetry":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C {n} \u043E\u0448\u0438\u0431\u043E\u043A","organizer.cacheCheck":"\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u043F\u0438\u0441\u043A\u0438 \u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C","organizer.cacheError":"\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043A\u0435\u0448\u0430: {detail}","organizer.dismiss":"\u0413\u043E\u0442\u043E\u0432\u043E","organizer.feedback":"\u041E\u0442\u0437\u044B\u0432 \u043E\u0431 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438","organizer.allSessions":"\u0412\u0441\u0435 \u0441\u0435\u0441\u0441\u0438\u0438","organizer.favoriteFilter":"\u0424\u0438\u043B\u044C\u0442\u0440 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E","organizer.archiveResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438","organizer.restoreResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F","organizer.deleteResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u044F","organizer.undoResult":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u043E\u0442\u043C\u0435\u043D\u044B","organizer.favorite":"\u0412 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435","organizer.unfavorite":"\u0423\u0431\u0440\u0430\u0442\u044C \u0438\u0437 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E","organizer.favoritesOnly":"\u0422\u043E\u043B\u044C\u043A\u043E \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435","organizer.reloadFavorites":"\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435","organizer.idleDays":"\u0414\u043D\u0438 \u043F\u0440\u043E\u0441\u0442\u043E\u044F","organizer.preview":"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0430\u0440\u0445\u0438\u0432\u0430 \u043F\u0440\u043E\u0441\u0442\u043E\u044F ({n})","organizer.rules":"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044E\u044E \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C \u0438 \u0442\u0435\u043A\u0443\u0449\u0438\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B \u0441\u043F\u0438\u0441\u043A\u0430. \u0418\u0441\u043A\u043B\u044E\u0447\u0430\u0435\u0442 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435, \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435, \u0437\u0430\u043F\u0443\u0449\u0435\u043D\u043D\u044B\u0435 \u0438 \u043E\u0436\u0438\u0434\u0430\u044E\u0449\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438.","organizer.progress":"\u0425\u043E\u0434 \u043F\u0430\u043A\u0435\u0442\u043D\u043E\u0439 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438","organizer.progressCount":"\u041E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043E {done} / {total}","organizer.result":"\u0423\u0441\u043F\u0435\u0448\u043D\u043E {succeeded} \xB7 \u041F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u043E {skipped} \xB7 \u041E\u0448\u0438\u0431\u043E\u043A {failed}","organizer.failureDetails":"\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438 \u043E\u0448\u0438\u0431\u043E\u043A","organizer.refreshError":"\u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B, \u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043F\u0438\u0441\u043A\u0430 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C: {detail}","organizer.retry":"\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C \u043E\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044F {n}","organizer.undo":"\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u044D\u0442\u0443 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044E ({n})","organizer.undoHint":"\u0421\u043E\u0445\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u0442\u043E\u043B\u044C\u043A\u043E \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u043F\u0430\u043A\u0435\u0442\u043D\u0430\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F, \u043F\u043E\u043A\u0430 \u043E\u0442\u043A\u0440\u044B\u0442\u0430 \u044D\u0442\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430. \u0417\u0430\u043A\u0440\u044B\u0442\u0438\u0435 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u0431\u0440\u0430\u0441\u044B\u0432\u0430\u0435\u0442 \u043E\u0442\u043C\u0435\u043D\u0443. \u0423\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043D\u0435\u043B\u044C\u0437\u044F.","organizer.idleConfirm":"\u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043A\u0430\u043D\u0434\u0438\u0434\u0430\u0442\u043E\u0432, \u043C\u043E\u0436\u043D\u043E \u0441\u043D\u044F\u0442\u044C \u043E\u0442\u043C\u0435\u0442\u043A\u0443. \u041F\u0435\u0440\u0435\u0434 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0435\u0439 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0435 \u0438 \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u044F\u044E\u0442\u0441\u044F \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E.","organizer.manualConfirm":"\u0411\u0443\u0434\u0443\u0442 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u044B \u0442\u043E\u043B\u044C\u043A\u043E \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435 \u043D\u0438\u0436\u0435 \u0441\u0435\u0441\u0441\u0438\u0438. \u042D\u0442\u0443 \u043F\u0430\u043A\u0435\u0442\u043D\u0443\u044E \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044E \u043C\u043E\u0436\u043D\u043E \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u043E\u0437\u0436\u0435.","organizer.orphanTitle":"\u041D\u0430\u0439\u0434\u0435\u043D\u043E {n} \u043E\u0441\u0438\u0440\u043E\u0442\u0435\u0432\u0448\u0438\u0445 \u043F\u043E\u0434\u0430\u0433\u0435\u043D\u0442\u043E\u0432","organizer.orphanDesc":"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0431\u044B\u043B\u0438 \u0443\u0434\u0430\u043B\u0435\u043D\u044B \u0438\u0437\u0432\u043D\u0435. \u041F\u043E\u0434\u0430\u0433\u0435\u043D\u0442\u044B \u0441\u043A\u0440\u044B\u0442\u044B \u0438\u0437 \u043E\u0431\u044B\u0447\u043D\u044B\u0445 \u0441\u043F\u0438\u0441\u043A\u043E\u0432 \u0447\u0430\u0442\u043E\u0432 \u0438 \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 ~{size} \u0434\u0438\u0441\u043A\u043E\u0432\u043E\u0433\u043E \u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0441\u0442\u0432\u0430. \u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","organizer.cleanOrphans":"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0432\u0441\u0435\u0445 \u0441\u0438\u0440\u043E\u0442","organizer.cleaning":"\u041E\u0447\u0438\u0441\u0442\u043A\u0430\u2026","organizer.orphanCleanSuccess":"\u0423\u0441\u043F\u0435\u0448\u043D\u043E \u043E\u0447\u0438\u0449\u0435\u043D\u043E {n} \u043E\u0441\u0438\u0440\u043E\u0442\u0435\u0432\u0448\u0438\u0445 \u043F\u043E\u0434\u0430\u0433\u0435\u043D\u0442\u043E\u0432."};var fn=Function("return globalThis.__dshArchiveReactDOM")(),Ka=Function("return globalThis.__dshArchiveReactDOMClient")(),Ya=fn.createPortal,Do=fn.flushSync,Mo=Ka?.createRoot,Lo=Ka?.hydrateRoot,zo=fn.findDOMNode,Po=fn.unmountComponentAtNode,Oo=fn.unstable_batchedUpdates,Fo=fn.version;function pi(t){var r={exports:{}},i=r.exports;Object.defineProperty(i,Symbol.toStringTag,{value:"Module"});let a=t("react/jsx-runtime"),o=t("react"),f=t("react-dom"),c=t("@deepseek-ai/dsh-client-ui-primitives");function k({open:n,onClose:s,title:l,description:h,footer:v,children:m,className:C,width:E,portalToBody:N=!1,closeLabel:B,t:_}){let P=o.useRef(null),H=o.useCallback(()=>P.current?.closest(".dsham_settings")??document.body,[]),[u,Ce]=o.useState(null);o.useEffect(()=>{if(!n){Ce(null);return}Ce(N?typeof document<"u"?document.body:null:H())},[n,H,N]),o.useEffect(()=>{if(!n)return;let Ct=e(lt=>{lt.key==="Escape"&&(lt.preventDefault(),lt.stopPropagation(),"stopImmediatePropagation"in lt&&typeof lt.stopImmediatePropagation=="function"&<.stopImmediatePropagation(),s())},"onKey");return window.addEventListener("keydown",Ct,!0),()=>window.removeEventListener("keydown",Ct,!0)},[n,s]);let Me=B||_("common.close"),fe=(0,a.jsxs)("div",{className:"dsham_modalRoot",role:"presentation",children:[(0,a.jsx)("div",{className:"dsham_modalMask",onClick:s}),(0,a.jsxs)("div",{role:"dialog","aria-modal":!0,"aria-label":typeof l=="string"?l:void 0,className:es("dsham_modalDialog",C),style:{width:E??560},children:[(0,a.jsxs)("div",{className:"dsham_modalHeader",children:[(0,a.jsx)("h2",{title:typeof l=="string"?l:void 0,children:l}),(0,a.jsx)("button",{type:"button",className:"dsham_modalClose",onClick:s,"aria-label":Me,title:Me,children:(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:14,height:14,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M3.5 3.5l9 9M12.5 3.5l-9 9"})})})]}),h!=null&&(0,a.jsx)("p",{children:h}),m!=null&&(0,a.jsx)("div",{className:"dsham_modalBody",children:m}),v!=null&&(0,a.jsx)("div",{className:"dsham_modalFooter",children:v})]})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{refObject:P,getContainer:H}),n&&u?Ya(fe,u):null]})}e(k,"SettingsModal");function y({refObject:n,getContainer:s}){return(0,a.jsx)("span",{hidden:!0,ref:n,"data-get-container":s})}e(y,"SettingsModalAnchor");function A({variant:n="outline",icon:s,children:l,className:h,disabled:v,title:m,onClick:C,"aria-label":E,"aria-pressed":N,"aria-expanded":B,"aria-haspopup":_}){return(0,a.jsx)(c.Button,{variant:n,size:"sm",className:h,disabled:v,title:m,onClick:C,"aria-label":E,"aria-pressed":N,"aria-expanded":B,"aria-haspopup":_,icon:s,children:l})}e(A,"settingsButton");function w({variant:n="outline",danger:s=!1,disabled:l,onClick:h,children:v}){return(0,a.jsx)(c.Button,{variant:s?"outline":n,className:s?"dsham_btnDanger":void 0,disabled:l,onClick:h,children:v})}e(w,"modalFooterButton");function g(n,s){let l={className:n?"dsham_archiveTabsLocked":void 0,children:s};return n&&(l.inert=""),l}e(g,"tabsShell");let S=qa(o,c.Button),{HighlightedText:D,useArchiveSearch:j,useArchivePreview:W,DiscoveryFilters:z,SearchStatus:U,PreviewContent:pe}=wa(o,{Button:c.Button,SegmentedControl:c.SegmentedControl}),ie={refresh:["M13.5 5.5V2.5m0 0h-3m3 0-2.1 2.1A5.5 5.5 0 1 0 13.2 12"],download:["M8 2v8m0 0 3-3m-3 3-3-3M3 13v2h10v-2"],copy:["M5 5h8v8H5z","M3 3h8"],close:["m4 4 8 8M12 4 4 12"]};function $(n){let s=document.createElement("span"),l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("viewBox","0 0 16 16"),l.setAttribute("width","16"),l.setAttribute("height","16"),l.setAttribute("fill","none"),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width","1.5"),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),l.setAttribute("aria-hidden","true");for(let h of ie[n]){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",h),l.append(v)}return s.append(l),s}e($,"createPluginUpdateIcon");let ue={parse(n){if(typeof n!="string"||n.length===0)throw new TypeError(`sessionId must be a non-empty string, got ${String(n)}`);return n}},he={parse(n){let s=le(n);if(typeof s!="object"||s===null||Array.isArray(s))throw new TypeError("result must be an object");let l=s.archivedSessionIds;if(!Array.isArray(l)||l.some(h=>typeof h!="string"))throw new TypeError("archivedSessionIds must be a string array");return s}},Qe={parse(n){let s=le(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.deleted!==!0)throw new TypeError("deleted must be true");return s}},ne={parse(n){let s=le(n);if(typeof s!="object"||s===null||Array.isArray(s))throw new TypeError("target must be an object");if(s.scope==="all"||s.scope==="ungrouped"||s.scope==="workspace"&&typeof s.workspaceId=="string"&&s.workspaceId.length>0||s.scope==="sessions"&&Array.isArray(s.sessionIds)&&s.sessionIds.length>0&&s.sessionIds.every(l=>typeof l=="string"&&l.length>0))return s;throw new TypeError("target.scope must be all, ungrouped, workspace with a non-empty workspaceId, or sessions with non-empty sessionIds")}},Q={parse(n){let s=le(n);if(typeof s!="object"||s===null||Array.isArray(s))throw new TypeError("result must be an object");for(let l of["requestedSessionIds","deletedSessionIds","skippedSessionIds"])if(!Array.isArray(s[l])||s[l].some(h=>typeof h!="string"))throw new TypeError(`${l} must be a string array`);if(!Array.isArray(s.failures)||s.failures.some(l=>typeof l!="object"||l===null||typeof l.sessionId!="string"||typeof l.message!="string"))throw new TypeError("failures must contain sessionId/message objects");return s}},pt={parse(n){let s=le(n);if(typeof s!="object"||s===null||Array.isArray(s)||!Array.isArray(s.items))throw new TypeError("result.items must be an array");if(s.items.some(l=>typeof l!="object"||l===null||typeof l.sessionId!="string"||typeof l.createdAt!="number"||!Number.isFinite(l.createdAt)))throw new TypeError("items must contain sessionId/createdAt objects");return s}},xt={parse(n){let s=le(n);if(!s||typeof s.sessionId!="string"||!s.sessionId||typeof s.targetWorkspaceId!="string"||!s.targetWorkspaceId)throw new TypeError("sessionId and targetWorkspaceId must be non-empty strings");return{sessionId:s.sessionId,targetWorkspaceId:s.targetWorkspaceId}}},Ke={parse(n){let s=le(n);if(!s||s.ok!==!0)throw new TypeError("session move result must be ok: true");return s}};function ke(n,s){return{mode:"strict",typeSymbol:n,create:e(()=>s,"create"),schema:s}}e(ke,"strictCodec");let mt={package:"@michengai/dsh-archive-manager",descriptors:[...Ua(),...ga(),...Ia(),{id:"@michengai/dsh-archive-manager#workspaceRegistry/unarchiveSession",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"unarchiveSession",invocation:{kind:"direct"},parameters:[{name:"sessionId",wire:"sessionId",source:"json",codec:ke("@deepseek-ai/dsh-session/types#SessionId",ue)}],result:ke("@michengai/dsh-archive-manager/types#ArchivedSessionIds",he),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/deleteSession",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"deleteSession",invocation:{kind:"direct"},parameters:[{name:"sessionId",wire:"sessionId",source:"json",codec:ke("@deepseek-ai/dsh-session/types#SessionId",ue)}],result:ke("@michengai/dsh-archive-manager/types#Deleted",Qe),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/deleteArchivedSessions",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"deleteArchivedSessions",invocation:{kind:"direct"},parameters:[{name:"target",wire:"target",source:"json",codec:ke("@michengai/dsh-archive-manager/types#ArchivedBatchTarget",ne)}],result:ke("@michengai/dsh-archive-manager/types#DeletedBatch",Q),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/archivedSessionMetadata",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"archivedSessionMetadata",invocation:{kind:"direct"},parameters:[],result:ke("@michengai/dsh-archive-manager/types#ArchivedSessionMetadata",pt),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/diagnoseOrphanSubagents",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"diagnoseOrphanSubagents",invocation:{kind:"direct"},parameters:[],result:ke("@michengai/dsh-archive-manager/types#OrphanSubagentDiagnosis",{parse(n){let s=le(n);if(!s||typeof s.count!="number"||!Array.isArray(s.items)||typeof s.totalSizeBytes!="number")throw new TypeError("invalid orphan subagent diagnosis");return s}}),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/cleanOrphanSubagents",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"cleanOrphanSubagents",invocation:{kind:"direct"},parameters:[{name:"target",wire:"target",source:"json",acceptsUndefined:!0,codec:ke("@michengai/dsh-archive-manager/types#CleanOrphanTarget",{parse(n){if(n==null)return{};let s=le(n);if(!s)throw new TypeError("target must be an object");if(s.sessionIds!==void 0&&(!Array.isArray(s.sessionIds)||s.sessionIds.some(l=>typeof l!="string")))throw new TypeError("sessionIds must be an array of strings");return s}})}],result:ke("@michengai/dsh-archive-manager/types#CleanOrphanResult",{parse(n){let s=le(n);if(!s||!Array.isArray(s.cleanedSessionIds)||!Array.isArray(s.skippedSessionIds)||!Array.isArray(s.failures))throw new TypeError("invalid orphan subagent clean result");return s}}),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}},{id:"@michengai/dsh-archive-manager#workspaceRegistry/moveSessionToWorkspace",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"moveSessionToWorkspace",invocation:{kind:"direct"},parameters:[{name:"input",wire:"input",source:"json",codec:ke("@michengai/dsh-archive-manager/types#SessionMoveInput",xt)}],result:ke("@michengai/dsh-archive-manager/types#SessionMoveResult",Ke),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}]};function ot(n,s){if(typeof document>"u"||document.querySelector("style[data-plugin-css="+JSON.stringify(n)+"]")!==null)return;let l=document.createElement("style");l.dataset.plugin="@michengai/dsh-archive-manager",l.dataset.pluginCss=n,l.textContent=s,document.head.appendChild(l)}e(ot,"ensurePluginStyle");function nn(n){if(typeof document>"u")return;document.querySelector("style[data-plugin-css="+JSON.stringify(n)+"]")?.remove()}e(nn,"removePluginStyle"),ot("dsh-archive-manager/DangerButton.css",".dsham_btnDanger:not(:disabled){color:var(--dsw-alias-state-error-primary,#ef7272);border-color:var(--dsw-alias-state-error-primary,#ef7272)}"),ot("dsh-archive-manager/IconAction.css",".dsham_iconAction{display:inline-flex!important;align-items:center!important;justify-content:center!important;box-sizing:border-box!important;width:22px!important;min-width:22px!important;height:22px!important;padding:0!important;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px)!important;background:transparent;color:var(--dsw-alias-label-secondary)}.dsham_iconAction:not(:disabled):hover{color:var(--dsw-alias-link,#4176e6)!important;border-color:var(--dsw-alias-link,#4176e6)!important}.dsham_iconAction.dsham_iconDanger{color:var(--dsw-alias-state-error-primary,#ef7272)!important;border-color:var(--dsw-alias-state-error-primary,#ef7272)!important}.dsham_iconAction.dsham_iconDanger:not(:disabled):hover{color:var(--dsw-alias-state-error-primary,#ef7272)!important;border-color:var(--dsw-alias-state-error-primary,#ef7272)!important}.dsham_iconAction svg{width:16px!important;height:16px!important;flex:none!important}"),ot("dsh-archive-manager/Modal.css",".dsham_modalRoot{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:24px}.dsham_modalMask{position:absolute;inset:0;background:var(--dsw-alias-bg-mask-1,rgb(0 0 0 / 45%));backdrop-filter:var(--dsw-mask-blur,blur(16px));-webkit-backdrop-filter:var(--dsw-mask-blur,blur(16px))}.dsham_modalDialog{position:relative;display:flex;flex-direction:column;gap:12px;box-sizing:border-box;max-width:calc(100vw - 48px);max-height:min(85vh,760px);padding:22px 24px 20px;overflow:hidden;border:1px solid var(--dsw-alias-border-l1,rgba(128,128,128,.2));border-radius:var(--dsw-radius-panel,28px);background-color:var(--dsw-alias-surface-overlay,var(--dsw-alias-bg-base,Canvas));background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-surface-overlay,Canvas));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-prominent,0 16px 40px rgb(0 0 0 / 24%))}.dsham_modalHeader{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none}.dsham_modalHeader h2,.dsham_modalDialog h2{margin:0;font-size:16px;line-height:24px;font-weight:600;color:var(--dsw-alias-label-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.dsham_modalClose{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:28px;height:28px;padding:0;border:none;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;flex:none;transition:background-color .15s ease,color .15s ease}.dsham_modalClose:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.dsham_modalClose svg{display:block;width:14px;height:14px}.dsham_modalDialog>p{margin:0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}.dsham_modalBody{display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain}.dsham_modalFooter{display:flex;flex:none;align-items:center;justify-content:flex-end;gap:8px}.dsham_modalWide{width:min(900px,calc(100vw - 48px))!important;max-height:min(88vh,820px)!important}.dsham_modalWide .dsham_modalBody{overflow:hidden}.dsham_modalWide .dsham_previewMessages{max-height:none;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}"),ot("dsh-archive-manager/SidebarPopover.css",".dsham_sidebarCardRoot{position:fixed;inset:0;z-index:1200;pointer-events:none}.dsham_sidebarCardBackdrop{position:fixed;inset:0;pointer-events:auto;background:transparent}.dsham_sidebarCard{position:fixed;pointer-events:auto;box-sizing:border-box;width:290px;max-height:calc(100vh - 32px);overflow-y:auto;padding:16px 18px 14px;border-radius:var(--dsw-radius-lg,14px);background:var(--dsw-menu-surface-fill);backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));border:none;box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);display:flex;flex-direction:column;gap:8px}.dsham_sidebarCardTitle{margin:0;font-size:14px;font-weight:600;line-height:20px;color:var(--dsw-alias-label-primary)}.dsham_sidebarCardDesc{margin:0;font-size:13px;line-height:18px;color:var(--dsw-alias-label-secondary)}.dsham_sidebarCardError{margin-top:2px;font-size:12px;line-height:16px;color:var(--dsw-alias-state-error-primary,#ef7272);white-space:pre-line}.dsham_sidebarCardFooter{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:10px}.dsham_sidebarCardBtn{border:none;background:transparent;padding:5px 12px;border-radius:var(--dsw-radius-sm,6px);font:inherit;font-size:13px;font-weight:500;line-height:18px;cursor:pointer;transition:background-color .15s ease,opacity .15s ease}.dsham_sidebarCardBtnCancel{color:var(--dsw-alias-label-primary)}.dsham_sidebarCardBtnCancel:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.dsham_sidebarCardBtnDanger{color:var(--dsw-alias-state-error-primary,#ef7272)}.dsham_sidebarCardBtnDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger,#f25a5a26)}.dsham_sidebarCardBtn:disabled{opacity:.4;cursor:default}"),ot("dsh-archive-manager/MoveSubmenu.css",".dsham_moveSessionWrap{position:relative}.dsham_moveSubmenu{position:fixed;z-index:99999;min-width:160px;max-width:260px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,0.25) transparent;background:var(--dsw-menu-surface-fill,var(--dsw-alias-surface-overlay,#1e1e22));backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));-webkit-backdrop-filter:var(--dsw-menu-backdrop-filter,blur(40px) saturate(150%));border:1px solid var(--dsw-alias-border-l1,rgba(255,255,255,0.12));border-radius:var(--dsw-radius-md,8px);box-shadow:var(--dsw-elevation-prominent,0 6px 20px rgba(0,0,0,0.45));padding:4px;display:flex;flex-direction:column;gap:2px}.dsham_moveSubmenu::-webkit-scrollbar{width:6px}.dsham_moveSubmenu::-webkit-scrollbar-track{background:transparent}.dsham_moveSubmenu::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.2);border-radius:3px}.dsham_moveSubmenu::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,0.35)}.dsham_moveSubmenuBtn{display:flex;align-items:center;width:100%;padding:6px 10px;border:none;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-primary,#ededed);font:inherit;font-size:13px;line-height:20px;text-align:left;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background-color .12s ease}.dsham_moveSubmenuBtn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,0.08))}.dsham_moveSubmenuBtn:focus-visible:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,0.08));outline:none}");let re="M8 1.75l1.934 3.918 4.324.628-3.129 3.05.738 4.306L8 11.618l-3.867 2.034.738-4.306-3.129-3.05 4.324-.628L8 1.75z";function Ye(n){return n?'<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="'+re+'"/></svg>':'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round" aria-hidden="true"><path d="'+re+'"/></svg>'}e(Ye,"starSvg");function Yt(n){return!!n?.querySelector("[data-state]")}e(Yt,"resolveRowHasStatus");let gn="[data-row-key^='session:']{position:relative}.dsham_starSlot{display:none;position:absolute;left:calc(8px + var(--dsh-workspace-indent,0px));inset-inline-start:calc(8px + var(--dsh-workspace-indent,0px));top:50%;transform:translateY(-50%);align-items:center;justify-content:center;box-sizing:border-box;width:16px;height:20px;z-index:1;pointer-events:none}[data-row-key^='session:']:hover .dsham_starSlot,.dsham_starSlot[data-favorited='true']{display:inline-flex;pointer-events:auto}[data-row-key^='session:']:hover>span:first-child:not(:has([data-state])),[data-row-key^='session:'][data-dsham-favorited='true']:not([data-dsham-has-status='true'])>span:first-child:not(:has([data-state])){opacity:0}[data-row-key^='session:'][data-dsham-has-status='true']>span:first-child,[data-row-key^='session:']>span:first-child:has([data-state]){opacity:1}[data-row-key^='session:'][data-dsham-has-status='true'] .dsham_starSlot,[data-row-key^='session:']:has(>span:first-child [data-state]) .dsham_starSlot{width:10px;height:10px;top:auto;bottom:3px;left:calc(15px + var(--dsh-workspace-indent,0px));inset-inline-start:calc(15px + var(--dsh-workspace-indent,0px));transform:none}[data-row-key^='session:'][data-dsham-has-status='true'] .dsham_rowStar,[data-row-key^='session:']:has(>span:first-child [data-state]) .dsham_rowStar{width:10px;height:10px}[data-row-key^='session:'][data-dsham-has-status='true'] .dsham_rowStar svg,[data-row-key^='session:']:has(>span:first-child [data-state]) .dsham_rowStar svg{width:10px;height:10px;filter:drop-shadow(0 0 1px rgba(0,0,0,0.85))}.dsham_rowStar{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:16px;height:16px;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-primary);cursor:pointer;flex:none;border-radius:var(--dsw-radius-xs,4px)}.dsham_starSlot[data-favorited='true'] .dsham_rowStar{color:#e8b931}.dsham_rowStar svg{display:block;width:16px;height:16px;flex:none}";ot("dsh-archive-manager/RowFavorite.css",gn);let Nn="dsh-archive-manager:workspace-favorites-only",ft="data-dsham-favorites-hidden",an="data-dsham-favorites-only",ae="dsham_rowStar",_e="dsham_starSlot",kt=["\u4EC5\u663E\u793A\u5DF2\u5F52\u6863","Archived only","\u0422\u043E\u043B\u044C\u043A\u043E \u0430\u0440\u0445\u0438\u0432\u043D\u044B\u0435"];ot("dsh-archive-manager/FavoritesFilter.css",`[data-dsham-favorites-hidden='true']{display:none!important}button[data-dsham-favorites-only='true'][data-active='true']::after{content:"\\2713";margin-left:auto;padding-left:12px;font-size:12px;line-height:1;color:var(--dsw-alias-state-business-primary,#3b82f6)}`);function Za(){try{return window.localStorage.getItem(Nn)==="1"}catch{return!1}}e(Za,"readWorkspaceFavoritesOnly");function Ja(n){try{window.localStorage.setItem(Nn,n?"1":"0")}catch{}}e(Ja,"writeWorkspaceFavoritesOnly");function Sr(n,s){let l=e(m=>s.favorites.has(m)||s.sessions?.[m]?.blank===!0,"visibleSession"),h=new Map,v=null;for(let m of n){if(m.startsWith("workspace:")){v=m,h.set(m,!1);continue}m.startsWith("session:")&&v!==null&&l(m.slice(8))&&h.set(v,!0)}return n.map(m=>m.startsWith("session:")?l(m.slice(8)):m.startsWith("workspace:")?h.get(m)===!0||s.groupHasFavorite?.(m.slice(10))===!0:!m.startsWith("overflow:"))}e(Sr,"favoritesOnlyVisibility");function xr(n,s){let l=new Map,h=new Set;for(let m of s){let C=!1;for(let E of m.sessionIds)h.add(E),n.has(E)&&(C=!0);l.set(m.workspaceId,C)}let v=!1;for(let m of n)if(!h.has(m)){v=!0;break}return m=>m===""||m==="ungrouped"?v:l.get(m)===!0}e(xr,"favoriteGroupPredicate");function kr(n,s,l,h){let v={dispose:e(()=>{},"dispose"),setFavoriteStarEnabled:e(V=>{},"setFavoriteStarEnabled"),isFavoriteStarEnabled:e(()=>!0,"isFavoriteStarEnabled")};if(typeof document>"u"||typeof document.addEventListener!="function"||typeof MutationObserver>"u")return v;let m=Za(),C=typeof h=="function"?h():!0,E=!1,N=!1,B=e(()=>{C?ot("dsh-archive-manager/RowFavorite.css",gn):nn("dsh-archive-manager/RowFavorite.css")},"updateStarStyle");B();let _=e(V=>{let Re=V;typeof Re?.detail?.enabled=="boolean"?C=Re.detail.enabled:typeof h=="function"&&(C=h()),B(),at()},"onStarToggle");typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("dsham-favorite-star-toggle",_);let P=0,H=200,u=null,Ce=new Set,Me=e(V=>{if(!C){for(let te of V)Array.from(te.children).find(Le=>Le.classList.contains(_e))?.remove(),te.removeAttribute("data-dsham-favorited"),te.removeAttribute("data-dsham-has-status");return}let Re=s.getSnapshot();for(let te of V){let J=te.getAttribute("data-row-key")??"";if(!J.startsWith("session:"))continue;let Le=J.slice(8),et=Array.from(te.children).find(Ze=>Ze.tagName==="SPAN"&&Array.from(Ze.classList).some(Mt=>Mt==="slot"||Mt.endsWith("_slot")))??null;if(et===null){te.removeAttribute("data-dsham-has-status");continue}let M=Array.from(te.children).find(Ze=>Ze.classList.contains(_e))??null;if(!Re.ready){M?.remove(),te.removeAttribute("data-dsham-favorited"),te.removeAttribute("data-dsham-has-status");continue}M!==null&&(M.parentElement!==te||M.nextElementSibling!==null)&&te.appendChild(M),M===null&&(M=document.createElement("span"),M.className=_e,te.appendChild(M)),M.dataset.sessionId=Le,Yt(et)?te.setAttribute("data-dsham-has-status","true"):te.removeAttribute("data-dsham-has-status");let Se=M.querySelector("."+ae);Se===null&&(Se=document.createElement("button"),Se.type="button",Se.className=ae,Se.addEventListener("click",Ze=>{Ze.preventDefault(),Ze.stopPropagation(),s.toggle(M?.dataset.sessionId??"")}),M.appendChild(Se));let $e=Re.ids.has(Le);if($e?te.setAttribute("data-dsham-favorited","true"):te.removeAttribute("data-dsham-favorited"),M.dataset.favorited===String($e))continue;let ct=l()($e?"organizer.unfavorite":"organizer.favorite");M.dataset.favorited=String($e),Se.setAttribute("aria-pressed",String($e)),Se.setAttribute("aria-label",ct),Se.title=ct,Se.innerHTML=Ye($e)}},"ensureRowStars"),fe=e(V=>{let Re=s.getSnapshot();if(!m||!Re.ready){for(let M of V)M.hasAttribute(ft)&&M.removeAttribute(ft);P=0,u=null,Ce.clear();return}let te=V.map(M=>M.getAttribute("data-row-key")??""),J=xr(Re.ids,n.workspaces.list?.getSnapshot?.()?.items??[]),Le=Sr(te,{favorites:Re.ids,sessions:n.sessions.list?.getSnapshot?.()?.byId,groupHasFavorite:J});u!==null&&(V.length<=u.rows&&Ce.add(u.key),u=null);let et=!1;if(P<H)for(let M=0;M<V.length;M+=1){let Ie=V[M],Se=te[M];if(!Se.startsWith("overflow:")||Ie.getAttribute("aria-expanded")!=="false")continue;let $e=Se.slice(9);if(!(Ce.has($e)||!J($e))){try{Ie.click(),P+=1,u={key:$e,rows:V.length},et=!0}catch(ct){console.warn("archive-manager: favorites-only expand failed",ct)}break}}for(let M=0;M<V.length;M+=1){let Ie=V[M];Le[M]?Ie.hasAttribute(ft)&&Ie.removeAttribute(ft):Ie.setAttribute(ft,"true")}et&&at()},"applyVisibility"),Ct=e(V=>{let Re=V.parentElement;if(Re===null)return null;let te=Re.cloneNode(!0),J=te.querySelector('button[role="menuitem"]');if(J===null)return null;let Le=Array.from(J.querySelectorAll("span")),et=Le[0]??null,M=Le[Le.length-1]??null;et!==null&&(et.innerHTML=Ye(!1)),M!==null&&(M.textContent=l()("organizer.favoritesOnly"));for(let Ie of Array.from(J.querySelectorAll("svg")))Ie.closest("span")===null&&Ie.remove();return J.setAttribute(an,"true"),J.setAttribute("role","menuitemcheckbox"),J.dataset.active=String(m),J.setAttribute("aria-checked",String(m)),J.setAttribute("aria-label",l()("organizer.favoritesOnly")),J.onclick=Ie=>{Ie.preventDefault(),Ie.stopPropagation(),sn(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0}))},te},"buildMenuRow"),lt=e(()=>{if(!E){for(let V of Array.from(document.querySelectorAll("button["+an+"]")))V.dataset.active=String(m),V.setAttribute("aria-checked",String(m));for(let V of Array.from(document.querySelectorAll('[role="menu"]'))){let Re=Array.from(V.querySelectorAll('button[role="menuitem"]')).find(Le=>kt.some(et=>(Le.textContent??"").includes(et)));if(Re===void 0||V.querySelector("["+an+"]")!==null)continue;let te=Re.parentElement;if(te===null)continue;let J=Ct(Re);J!==null&&te.parentElement?.insertBefore(J,te.nextSibling)}}},"injectMenuRows"),at=e(()=>{if(N||E)return;N=!0;let V=e(()=>{if(N=!1,E)return;let Re=Array.from(document.querySelectorAll("[data-row-key]"));lt(),Me(Re),fe(Re),s.getSnapshot().ready||on()},"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(V):setTimeout(V,16)},"schedulePass"),sn=e(()=>{m=!m,Ve=20,P=0,u=null,Ce.clear(),Ja(m),at()},"toggle"),gt=null,Ve=20,on=e(()=>{gt!==null||E||Ve<=0||(Ve-=1,gt=setTimeout(()=>{gt=null,s.ensure(),at()},600))},"scheduleRetry"),Et=new MutationObserver(V=>{Fn(V,'[data-row-key], [role="menu"]')&&at()});Et.observe(document.body,{childList:!0,subtree:!0}),s.ensure().catch(()=>{});let _t=[s.subscribe(()=>at()),typeof n.sessions.list?.subscribe=="function"?n.sessions.list.subscribe(()=>at()):null,typeof n.workspaces.list?.subscribe=="function"?n.workspaces.list.subscribe(()=>at()):null].filter(V=>typeof V=="function");return at(),{dispose(){E=!0,typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("dsham-favorite-star-toggle",_),Et.disconnect();for(let V of _t)V();for(let V of Array.from(document.querySelectorAll("["+ft+"]")))V.removeAttribute(ft);for(let V of Array.from(document.querySelectorAll("["+an+"]")))V.parentElement?.remove();for(let V of Array.from(document.querySelectorAll("."+_e)))V.remove();for(let V of Array.from(document.querySelectorAll("[data-dsham-favorited]")))V.removeAttribute("data-dsham-favorited");for(let V of Array.from(document.querySelectorAll("[data-dsham-has-status]")))V.removeAttribute("data-dsham-has-status");gt!==null&&(clearTimeout(gt),gt=null)},setFavoriteStarEnabled(V){C=V,B(),at()},isFavoriteStarEnabled:e(()=>C,"isFavoriteStarEnabled")}}e(kr,"setupWorkspaceFavoritesOnly");function Cr(){let n,s={ready:!1,ids:new Set,pending:new Set},l,h=0,v=new Set,m=e(E=>{s=E;for(let N of v)try{N()}catch(B){console.warn("archive-manager: favorite listener failed",B)}},"publish"),C=e((E,N)=>{let B=new Set(E);for(let u of s.pending)u!==N&&(s.ids.has(u)?B.add(u):B.delete(u));let _=new Set(s.pending);N!==void 0?_.delete(N):s.pending.size===0&&_.clear();let P=s.ids.size===B.size&&[...B].every(u=>s.ids.has(u)),H=s.pending.size===_.size&&[..._].every(u=>s.pending.has(u));P&&H&&s.ready||m({ready:!0,ids:B,pending:_})},"adopt");return{bind(E){n=E},subscribe(E){return v.add(E),()=>{v.delete(E)}},getSnapshot:e(()=>s,"getSnapshot"),adopt:e(E=>C(E),"adopt"),ensure(){return n===void 0||s.ready?Promise.resolve():l!==void 0?l:Date.now()<h?Promise.resolve():(l=n.favoriteSessions().then(E=>{C(E.favoriteSessionIds)}).catch(E=>{console.warn("archive-manager: load favorites failed, will retry",E),h=Date.now()+600}).finally(()=>{l=void 0}),l)},async toggle(E){if(n===void 0||!s.ready||s.pending.has(E))return;let N=s.ids.has(E),B=!N,_=new Set(s.ids);B?_.add(E):_.delete(E);let P=new Set(s.pending);P.add(E),m({ready:!0,ids:_,pending:P});try{let H=await n.setSessionFavorite({sessionId:E,favorite:B});if(!Array.isArray(H?.favoriteSessionIds))throw new TypeError("favorite response is missing favoriteSessionIds");C(H.favoriteSessionIds,E)}catch(H){console.warn("archive-manager: sidebar favorite toggle failed",H);let u=new Set(s.ids);N?u.add(E):u.delete(E);let Ce=new Set(s.pending);Ce.delete(E),m({ready:!0,ids:u,pending:Ce})}}}}e(Cr,"createFavoriteRowStore");function Xa(){return(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,"aria-hidden":!0,focusable:"false",children:(0,a.jsx)("path",{fill:"currentColor",d:"M8 0a8 8 0 0 0-2.53 15.59c.4.074.547-.173.547-.385 0-.19-.007-.693-.01-1.36-2.226.484-2.695-1.073-2.695-1.073-.364-.924-.89-1.17-.89-1.17-.726-.496.055-.486.055-.486.803.056 1.225.824 1.225.824.714 1.223 1.872.87 2.328.665.072-.517.28-.87.508-1.07-1.777-.202-3.645-.888-3.645-3.956 0-.874.31-1.588.823-2.148-.083-.202-.357-1.017.078-2.12 0 0 .672-.215 2.2.82A7.65 7.65 0 0 1 8 4.8c.68.003 1.365.092 2.004.27 1.527-1.035 2.197-.82 2.197-.82.437 1.103.162 1.918.08 2.12.513.56.822 1.274.822 2.148 0 3.076-1.872 3.752-3.654 3.95.288.248.544.735.544 1.482 0 1.07-.01 1.932-.01 2.195 0 .214.144.463.55.384A8.001 8.001 0 0 0 8 0Z"})})}e(Xa,"GithubMark16");function Qa(){let n=c.IconEditOutlineRegular;return(0,a.jsx)(n,{size:16})}e(Qa,"FeedbackIcon");function Mn({archiveSessions:n,archiveSession:s,sessionStore:l,workspaceStore:h,unarchiveSession:v,deleteSession:m,unarchiveSessions:C,deleteArchivedSessions:E,archivedSessionMetadata:N,openConversation:B,focusSessionWorkspace:_,viewState:P,close:H,t:u,diagnoseOrphanSubagents:Ce,cleanOrphanSubagents:Me,diagnoseSessionCaches:fe,rebuildSessionCaches:Ct,refreshCacheLists:lt,searchSessionContent:at,searchArchivedContent:sn,previewArchivedSession:gt,favoriteSessions:Ve,setSessionFavorite:on,favoriteSync:Et,organizeBatch:_t,useSessionPendingInteraction:V,useSessionStatus:Re}){let te=(0,o.useSyncExternalStore)(l.subscribe,l.getSnapshot),J=(0,o.useSyncExternalStore)(h.subscribe,h.getSnapshot),[Le,et]=(0,o.useState)("archived"),M=Le==="archived",[Ie,Se]=(0,o.useState)(null),[$e,ct]=(0,o.useState)(null),[Ze,Mt]=(0,o.useState)(null),Ot=e((d,x=null)=>{K(null),Ue(null),Z(!1),ct(x),Se(d)},"requestArchive"),Zt=e(()=>{ee||(Se(null),ct(null),K(null))},"closeArchive"),Rt=(0,o.useRef)(!1),[Te,Wt]=(0,o.useState)(null),bn=(0,o.useRef)(!1),[ee,He]=(0,o.useState)(!1),[It,K]=(0,o.useState)(null),[Hn,Ue]=(0,o.useState)(null),ln=e(d=>{K(null),Ue(null),Wt(d)},"requestDelete"),[Lt,yn]=(0,o.useState)(P?.query??""),[vt,qt]=(0,o.useState)(P?.project??"all"),[zt,wn]=(0,o.useState)(P?.sortBy??"updated"),[Sn,xn]=(0,o.useState)({}),[Vt,kn]=(0,o.useState)(()=>new Set),Tt=(0,o.useRef)(new Set),[jt,dt]=(0,o.useState)([]),[cn,bt]=(0,o.useState)([]),[Nt,dn]=(0,o.useState)(!1),[Cn,Jt]=(0,o.useState)(!1),Xt=(0,o.useRef)(!1),[p,b]=(0,o.useState)(!1),[I,Y]=o.useState("content"),[ge,se]=o.useState(""),[xe,Ee]=o.useState(""),[ce,ze]=(0,o.useState)(()=>new Set),[Ne,tt]=(0,o.useState)("30"),[Je,Z]=(0,o.useState)(!1),[F,L]=(0,o.useState)(null),[oe,ve]=(0,o.useState)(null),[me,Pe]=(0,o.useState)([]),de=(0,o.useRef)(!1),We=(0,o.useRef)(null),ut=ls(V??ss,Re??is,typeof Re=="function"),Oe=(0,o.useRef)(ut.pending);Oe.current=ut.pending;let G=(0,o.useMemo)(()=>new Set(cn),[cn]),Ae=e(async()=>{if(Ve)try{let d=await Ve();bt(d.favoriteSessionIds),dn(!0),Et?.adopt(d.favoriteSessionIds)}catch(d){dn(!1),K(Fe(d))}},"loadFavorites");(0,o.useEffect)(()=>{let d=!0;return Ve&&Ve().then(x=>{d&&(bt(x.favoriteSessionIds),dn(!0),Et?.adopt(x.favoriteSessionIds))}).catch(x=>{d&&K(Fe(x))}),()=>{d=!1}},[Ve]),(0,o.useEffect)(()=>{if(Et)return Et.subscribe(()=>{let d=Et.getSnapshot();d.ready&&(bt([...d.ids]),dn(!0))})},[Et]);let qe=e(async d=>{if(!(Xt.current||ee||!Nt)){Xt.current=!0,Jt(!0),K(null);try{let x=await on({sessionId:d,favorite:!G.has(d)});bt(x.favoriteSessionIds),Et?.adopt(x.favoriteSessionIds)}catch(x){K(Fe(x))}finally{Xt.current=!1,Jt(!1)}}},"toggleFavorite"),Xe=e(async(d,x,{idle:X=!1,retry:ye=!1}={})=>{if(!(de.current||Xt.current||Tt.current.size>0||!_t)){de.current=!0,He(!0),K(null),Ue(null),ve(null),d==="archive"&&!ye&&Pe([]);try{let R=await _t(d,x,{idleDays:X?Number(Ne):void 0,getPending:e(()=>Oe.current,"getPending"),onProgress:e(we=>{L(we),d==="archive"&&we.total>0&&we.done>=we.total&&(Se(null),ct(null),Z(!1))},"onProgress")});return ve({...R,kind:d,tab:Le}),We.current=R.remaining.length?{kind:d,ids:R.remaining,idle:X}:null,d==="archive"&&Pe(we=>[...new Set([...we,...R.succeeded])]),(d==="undo"||d==="restore"||d==="delete")&&Pe(we=>we.filter(ht=>!R.succeeded.includes(ht)&&!R.skipped.includes(ht))),dt(we=>we.filter(ht=>!R.succeeded.includes(ht)&&!R.skipped.includes(ht))),d==="delete"&&bt(we=>we.filter(ht=>!R.succeeded.includes(ht))),R}catch(R){K(Fe(R))}finally{de.current=!1,He(!1),L(null)}}},"executeBatch"),[nt,be]=(0,o.useState)(null),[Ft,$t]=(0,o.useState)({diagnosis:{count:0,items:[]},busy:!1,progress:null,result:null,error:null,refreshError:null}),st=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!fe||!Ct||!lt)return;let d=Ta({diagnose:fe,rebuild:Ct,refresh:lt});st.current=d;let x=d.subscribe(()=>{$t(d.snapshot())});return d.load(),()=>{x(),d.dispose(),st.current=null}},[fe,Ct,lt]),(0,o.useEffect)(()=>{st.current?.snapshot().busy||st.current?.load()},[J.archivedSessionIds]);let un=e(async(d=!1)=>{if(!(ee||de.current||!st.current||st.current.snapshot().busy)){de.current=!0,He(!0);try{await st.current.run(d)}finally{de.current=!1,yt.current&&He(!1)}}},"runCacheRebuild"),[Ge,it]=(0,o.useState)(!1),Qt=e(()=>{typeof Ce=="function"&&Ce().then(be).catch(d=>{console.warn("archive-manager: diagnose orphan subagents failed",d)})},"loadOrphans");(0,o.useEffect)(()=>{Qt()},[J.archivedSessionIds]);let En=e(async()=>{if(!(Ge||typeof Me!="function")){it(!0),K(null),Ue(null);try{let d=await Me({});(d.cleanedSessionIds.length>0||d.skippedSessionIds.length>0)&&Qt(),d.failures.length>0?(Ue(null),K(zn(d.failures,u))):d.cleanedSessionIds.length>0&&(K(null),Ue(u("organizer.orphanCleanSuccess",{n:d.cleanedSessionIds.length})))}catch(d){K(Fe(d))}finally{it(!1)}}},"cleanOrphans"),yt=(0,o.useRef)(!0),wt=(0,o.useRef)(!1);(0,o.useEffect)(()=>(yt.current=!0,()=>{yt.current=!1}),[]);let Bt=e(async(d,x=!1)=>{if(ee||wt.current)return;wt.current=!0,He(!0),K(null);let X=!1;try{await _a({prepare:x?async ye=>{await _?.(ye)}:void 0,restore:e(async ye=>{await v(ye),X=!0},"restore"),open:e(async ye=>{await B(ye),yt.current&&H?.()},"open")},d.id,x,()=>yt.current)}catch(ye){if(!yt.current)return;if(X){et("unarchived");let R=St.find(we=>we.sessions.some(ht=>ht.id===d.id));R!==void 0&&qt(R.key)}K(Aa(ye,u))}finally{wt.current=!1,yt.current&&He(!1)}},"viewConversation");(0,o.useEffect)(()=>{P&&Object.assign(P,{query:Lt,project:vt,sortBy:zt})},[Lt,vt,zt,P]);let Gt=(0,o.useMemo)(()=>M?J.archivedSessionIds:Wr(te.byId,J.archivedSessionIds),[M,te.byId,J.archivedSessionIds]),St=(0,o.useMemo)(()=>qr(te.byId,J.items,Gt,u("group.ungrouped")),[te.byId,J,Gt,u]),hn=e(d=>{ee||Tt.current.size>0||(Dt.close(),et(d),dt([]),Se(null),ct(null),K(null),Ue(null),qt("all"),yn(""),d!=="archived"&&zt==="archived"&&wn("updated"))},"switchTab"),Jr=e(async(d,x=!1)=>{if(!(Rt.current||ee||!d?.length)){if(_t){Rt.current=!0;try{let X=await Xe("archive",d,{idle:x}),ye=X?.failures.map(R=>_r(R.sessionId,R.message)).find(R=>R!==void 0);if(ye!==void 0&&typeof s=="function"){let R=te.byId[ye.sessionId];Mt({sessionId:ye.sessionId,title:R===void 0?ye.sessionId:rt(R,u),kinds:ye.kinds.join(", ")}),Se(null),ct(null),K(null);return}X&&(Se(null),ct(null),Z(!1))}finally{Rt.current=!1}return}Rt.current=!0,He(!0),K(null),Ue(null);try{let X=await n(d);Se(null),ct(null),X.archivedSessionIdsAdded.length>0&&Ue(u("archives.archiveSuccess",{n:X.archivedSessionIdsAdded.length})),X.failures&&X.failures.length>0?K(zn(X.failures,u)):(dt([]),et("archived"),qt("all"),yn(""))}catch(X){let ye=Ar(X);if(ye!==void 0&&typeof s=="function"){let R=te.byId[ye.sessionId];Mt({sessionId:ye.sessionId,title:R===void 0?ye.sessionId:rt(R,u),kinds:ye.kinds.join(", ")}),Se(null),ct(null),K(null)}else{let R=Pn(X);K(R===void 0?u("archives.archiveBatchFailed",{detail:X instanceof Error?X.message:String(X)}):u("archives.archiveActive",{kinds:R.join(", ")}))}}finally{Rt.current=!1,He(!1)}}},"performArchive"),Is=e(()=>Jr(Ie,Je),"confirmArchive"),Ts=e(async d=>{K(null),Ue(null);try{await $n(d.id),yt.current&&Ue(u("details.copied"))}catch(x){yt.current&&K(typeof Wn(x)=="string"&&String(Wn(x)).startsWith("copy.")?u(String(Wn(x))):Fe(x))}},"copyId"),rr=(0,o.useMemo)(()=>Vr(St,zt,Sn,u,M?J.archivedSessionIds:void 0),[St,zt,Sn,u,M,J.archivedSessionIds]);(0,o.useEffect)(()=>{if(ee)return;let d=!1;return N().then(x=>{d||xn(Object.fromEntries(x.items.map(X=>[X.sessionId,X.createdAt])))}).catch(()=>{d||xn({})}),()=>{d=!0}},[N,J.archivedSessionIds,ee]),(0,o.useEffect)(()=>{vt!=="all"&&!St.some(d=>d.key===vt)&&qt("all")},[St,vt]);let Xr=!ur(ge,xe),Qr=rr.filter(d=>vt==="all"||vt===d.key).map(d=>({...d,sessions:d.sessions.filter(x=>(!p||G.has(x.id))&&ba(x.updatedAt,ge,xe))})).filter(d=>d.sessions.length),ar=I==="content"&&!Xr,In=j(Qr.flatMap(d=>d.sessions.map(x=>x.id)),Lt,ar,at??sn),sr=new Map(In.items.map(d=>[d.sessionId,d])),Dt=W(gt,M?J.archivedSessionIds:[]),ea=Lt.trim().toLocaleLowerCase(),Tn=Qr.map(d=>({...d,sessions:d.sessions.filter(x=>!ea||rt(x,u).toLocaleLowerCase().includes(ea)||sr.has(x.id))})).filter(d=>d.sessions.length),ta=Nt?Tn.flatMap(d=>d.sessions).filter(d=>wr(d,{days:Number(Ne),favorites:G,currentId:Gn(te),pending:ut.pending})).map(d=>d.id):[],An=(0,o.useMemo)(()=>Br(Tn),[Tn]),ir=(0,o.useMemo)(()=>new Set(jt),[jt]),As=(0,o.useMemo)(()=>{let d=new Set(J.archivedSessionIds);return me.reduce((x,X)=>x+(d.has(X)?1:0),0)},[me,J.archivedSessionIds]),or=An.filter(d=>ir.has(d)).length,_s=An.length>0&&or===An.length;(0,o.useEffect)(()=>{dt(d=>Hr(d,Gt))},[Gt]);let Rs=e((d,x)=>{dt(X=>er(X,[d],x))},"toggleSessionSelection"),js=e(d=>{dt(x=>er(x,An,d))},"toggleVisibleSelection"),Ns=e(d=>{ee||Tt.current.has(d)||(Tt.current.add(d),kn(new Set(Tt.current)),K(null),Ue(null),v(d).catch(x=>{K(Ir(x,u))}).finally(()=>{Tt.current.delete(d),kn(new Set(Tt.current))}))},"onUnarchive"),na=e(async d=>{if(!ee){if(_t){let x=vn(J.archivedSessionIds,J.items,d),X=await Xe("restore",x);return X&&{unarchivedSessionIds:X.succeeded}}He(!0),K(null),Ue(null);try{let x=await C(d);return x.unarchivedSessionIds.length>0&&Ue(u("archives.restoreSuccess",{n:x.unarchivedSessionIds.length})),x.failures&&x.failures.length>0&&K(zn(x.failures,u,Ir)),x}catch(x){K(u("archives.restoreBatchFailed",{detail:x instanceof Error?x.message:String(x)}))}finally{He(!1)}}},"onBatchUnarchive"),Ds=e(async()=>{if(jt.length===0)return;let d=await na({scope:"sessions",sessionIds:jt});if(d!==void 0){let x=new Set(d.unarchivedSessionIds);dt(X=>X.filter(ye=>!x.has(ye)))}},"onSelectedUnarchive"),ra=e(()=>{ee||Wt(null)},"closeDelete");(0,o.useEffect)(()=>{if(Te===null)return;let d=e(x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),"stopImmediatePropagation"in x&&typeof x.stopImmediatePropagation=="function"&&x.stopImmediatePropagation(),ee||Wt(null))},"onKeyDown");return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[Te,ee]);let Ms=e(async()=>{if(ee||bn.current||Te===null)return;if(Te.kind!=="batch"){bn.current=!0,He(!0),K(null),Ue(null);try{await m(Te.session.id),Wt(null)}catch(x){K(Yn(x,u))}finally{bn.current=!1,He(!1)}return}if(de.current||Xt.current||Tt.current.size>0)return;let{target:d}=Te;if(d.scope==="sessions"&&vn(J.archivedSessionIds,J.items,d).length===0){Wt(null);return}de.current=!0,He(!0),K(null),Ue(null),ve(null),L(null);try{let x=await E(d),X=Ur(x,u);X.kind==="error"?K(X.message):Ue(X.message);let ye=new Set([...x.deletedSessionIds,...x.skippedSessionIds]);Pe(we=>we.filter(ht=>!ye.has(ht))),dt(we=>we.filter(ht=>!ye.has(ht))),bt(we=>we.filter(ht=>!ye.has(ht)));let R=x.failures.map(we=>we.sessionId);We.current=R.length>0?{kind:"delete",ids:R,idle:!1}:null,ve({requested:x.requestedSessionIds,succeeded:x.deletedSessionIds,skipped:x.skippedSessionIds,failures:x.failures,remaining:R,refreshError:"refreshError"in x&&typeof x.refreshError=="string"?x.refreshError:null,kind:"delete",tab:Le}),Wt(null)}catch(x){K(Yn(x,u))}finally{de.current=!1,He(!1)}},"confirmDelete"),Ht=Te?.kind==="batch"?Te.target.scope:null,Ls=Ht==="ungrouped"?u("archives.deleteUngroupedTitle"):Ht==="workspace"?u("archives.deleteProjectTitle",{name:Te?.kind==="batch"?Te.title:""}):u(Ht==="sessions"?"archives.deleteSelectedTitle":"deleteSession.title"),aa=Te===null?void 0:Ht==="ungrouped"?u("archives.deleteUngroupedDesc",{n:Te.kind==="batch"?Te.count:0}):Ht==="workspace"?u("archives.deleteProjectDesc",{name:Te?.kind==="batch"?Te.title:"",n:Te.kind==="batch"?Te.count:0}):Ht==="sessions"?u("archives.deleteSelectedDesc",{n:Te.kind==="batch"?Te.count:0}):u("deleteSession.desc",{name:rt(Te.kind==="session"?Te.session:{},u)}),zs=u(Ht==="ungrouped"?"archives.deleteUngroupedConfirm":Ht==="workspace"?"archives.deleteProjectConfirm":Ht==="sessions"?"archives.deleteSelectedConfirm":"deleteSession.title");return(0,a.jsxs)("section",{className:"dsham_settings","aria-label":u("archives.title"),children:[(0,a.jsx)("style",{children:ds+ps+ms+fs+gs}),(0,a.jsxs)("div",{className:"dsham_settingsHeader",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"dsham_settingsTitleRow",children:[(0,a.jsx)("h2",{children:u("archives.title")}),(0,a.jsxs)("div",{className:"dsham_settingsLinks",children:[(0,a.jsx)(c.Button,{variant:"outline",size:"sm","aria-label":u("archives.viewProject"),icon:(0,a.jsx)(Xa,{}),onClick:e(()=>window.open("https://github.com/MichengAI/dsh-archive-manager","_blank","noreferrer"),"onClick"),children:u("archives.viewProject")}),(0,a.jsx)(c.Button,{variant:"outline",size:"sm","aria-label":u("archives.feedback"),icon:(0,a.jsx)(Qa,{}),onClick:e(()=>window.open("https://github.com/MichengAI/dsh-archive-manager/issues","_blank","noreferrer"),"onClick"),children:u("archives.feedback")})]})]}),(0,a.jsx)("p",{className:"dsham_settingsIntro",children:u("archives.description")})]}),o.createElement("div",g(ee||Vt.size>0,(0,a.jsx)(c.SegmentedTabs,{className:"dsham_archiveTabs",label:u("archives.title"),value:Le==="unarchived"?"unarchived":"archived",onChange:e(d=>hn(d==="unarchived"?"unarchived":"archived"),"onChange"),items:[{value:"archived",label:(0,a.jsxs)("span",{className:"dsham_tabLabel",children:[(0,a.jsx)(c.IconArchiveOutlineMedium,{size:14}),(0,a.jsx)("span",{children:u("archives.tab.archived")})]}),id:"dsham-tab-archived",panelId:"dsham-archive-panel"},{value:"unarchived",label:(0,a.jsxs)("span",{className:"dsham_tabLabel",children:[(0,a.jsx)(c.IconFolderCloseMedium,{size:14}),(0,a.jsx)("span",{children:u("archives.tab.unarchived")})]}),id:"dsham-tab-unarchived",panelId:"dsham-archive-panel"}]})))]}),(0,a.jsxs)("div",{id:"dsham-archive-panel",role:"region","aria-label":u(Le==="unarchived"?"archives.tab.unarchived":"archives.tab.archived"),children:[(0,a.jsx)("div",{className:"dsham_settingsToolbar",children:(0,a.jsxs)("div",{className:"dsham_settingsSearch",children:[(0,a.jsx)(Qn,{id:"dsham-favorite-filter",className:"dsham_srOnly",tabIndex:-1,"aria-hidden":!0,value:p?"favorites":"all",options:[{value:"all",label:u("organizer.allSessions")},{value:"favorites",label:u("organizer.favoritesOnly")}],onChange:e(d=>typeof b=="function"&&b(d==="favorites"),"onChange"),"aria-label":u("organizer.favoriteFilter")}),(0,a.jsx)(Qn,{id:"dsham-search-scope",className:"dsham_srOnly",tabIndex:-1,"aria-hidden":!0,value:I,options:[{value:"title",label:u("discovery.titleOnly")},{value:"content",label:u("discovery.titleAndContent")}],onChange:e(d=>typeof Y=="function"&&Y(d),"onChange"),"aria-label":u("discovery.scope")}),(0,a.jsx)(c.Input,{id:"dsham-search-input",className:"dsham_searchField",type:"search",icon:(0,a.jsx)(c.IconSearchOutlineMedium,{size:16,"aria-hidden":!0}),autoComplete:"off",spellCheck:!1,maxLength:200,value:Lt,onChange:e(d=>yn(d.target.value),"onChange"),placeholder:u(ar?"discovery.searchPlaceholder":M?"archives.searchPlaceholder":"archives.searchUnarchived"),"aria-label":u(ar?"discovery.searchPlaceholder":M?"archives.searchPlaceholder":"archives.searchUnarchived")}),(0,a.jsx)(vs,{id:"dsham-sort-filter",t:u,disabled:ee,favoritesOnly:p,setFavoritesOnly:b,favoriteBusy:ee||Cn||!Nt,sortBy:!M&&zt==="archived"?"updated":zt,setSortBy:wn,options:[...M?[{value:"archived",label:u("archives.sortArchived")}]:[],{value:"updated",label:u("archives.sortUpdated")},{value:"created",label:u("archives.sortCreated")},{value:"alphabetical",label:u("archives.sortAlphabetical")}]}),(0,a.jsx)(Qn,{id:"dsham-project-filter",className:"dsham_projectFilter",value:vt,title:vt==="all"?u("archives.allProjects"):rr.find(d=>d.key===vt)?.title??vt,options:[{value:"all",label:u("archives.allProjects")||"\u6240\u6709\u9879\u76EE",title:u("archives.allProjects")},...rr.map(d=>({value:d.key,label:d.title,title:d.title}))],onChange:qt,"aria-label":u("archives.projectFilter")}),o.createElement(z,{t:u,from:ge,to:xe,onFrom:se,onTo:Ee,invalid:Xr,onClear:e(()=>{se(""),Ee("")},"onClear")})]})}),o.createElement("style",null,Sa),o.createElement(U,{state:In,t:u}),_t&&(0,a.jsx)(S,{t:u,archived:M,busy:ee||Cn||Vt.size>0,ready:Nt,days:Ne,onDays:tt,count:ta.length,onPreview:e(()=>{Ot(ta),Z(!0)},"onPreview"),progress:F,result:oe?.tab===Le?oe:null,onRetry:e(()=>{let d=We.current;d&&(d.kind==="delete"?ln({kind:"batch",target:{scope:"sessions",sessionIds:d.ids},count:d.ids.length}):Xe(d.kind,d.ids,{idle:d.idle,retry:!0}))},"onRetry"),undoCount:As,onUndo:e(()=>Xe("undo",me,{retry:!0}),"onUndo"),onReload:Ae,orphanCount:nt?.count??0,cacheCount:Ft.diagnosis.count,cacheRepair:Ft,onRebuildCaches:e(()=>un(),"onRebuildCaches"),onRetryCaches:e(()=>un(!0),"onRetryCaches"),onReloadCaches:e(async()=>{try{await lt?.(),await st.current?.load(),(st.current?.snapshot().diagnosis.count??0)===0&&st.current?.dismiss()}catch(d){yt.current&&K(Fe(d))}},"onReloadCaches"),onDismissCaches:e(()=>st.current?.dismiss(),"onDismissCaches"),orphanSizeBytes:nt?.totalSizeBytes??0,orphanCleaning:Ge,onCleanOrphans:En}),St.length>0&&(0,a.jsx)(Pr,{selectedCount:jt.length,hiddenCount:jt.length-or,allVisibleSelected:_s,selectedVisibleCount:or,visibleCount:An.length,busy:ee,t:u,onToggle:js,onClear:e(()=>dt([]),"onClear"),onArchive:M?void 0:()=>Ot([...jt]),onRestore:Ds,onDelete:e(()=>ln({kind:"batch",target:{scope:"sessions",sessionIds:jt},count:jt.length}),"onDelete")}),St.length===0?(0,a.jsx)("div",{className:"dsham_settingsEmpty",children:u(M?"archives.empty":"archives.emptyUnarchived")}):Tn.length===0?(0,a.jsx)("div",{className:"dsham_settingsEmpty",children:In.status==="loading"||In.status==="error"||In.failures.length?null:u("archives.emptyFiltered")}):Tn.map(d=>{let x=ws(d.key),X=St.find(R=>R.key===d.key)?.sessions.map(R=>R.id)??[],ye=M?vn(J.archivedSessionIds,J.items,x).length:X.length;return(0,a.jsxs)("section",{className:"dsham_settingsGroup",children:[(0,a.jsxs)("div",{className:"dsham_settingsGroupHeading",children:[(0,a.jsx)("h3",{className:"dsham_settingsGroupTitle",children:(0,a.jsxs)("button",{type:"button",className:"dsham_groupToggle","aria-expanded":!ce.has(d.key),"aria-controls":"dsham-group-"+encodeURIComponent(d.key),onClick:e(()=>ze(R=>{let we=new Set(R);return we.has(d.key)?we.delete(d.key):we.add(d.key),we}),"onClick"),children:[(0,a.jsx)(ce.has(d.key)?c.IconChevronRightOutlineMedium:c.IconChevronDownOutlineMedium,{}),(0,a.jsx)(ce.has(d.key)?c.IconFolderCloseMedium:c.IconFolderOpenOutlineMedium,{}),(0,a.jsx)("span",{children:d.title})]})}),(0,a.jsxs)("div",{className:"dsham_settingsGroupMeta",children:[(0,a.jsx)("span",{className:"dsham_settingsCount",children:u("archives.sessionCount",{n:d.sessions.length})}),(0,a.jsx)(ys,{group:d,busy:ee,onArchive:M?void 0:()=>Ot(X,d),onRestore:e(()=>na(x),"onRestore"),onDelete:e(()=>ln({kind:"batch",target:x,title:d.title,count:ye}),"onDelete"),t:u})]})]}),(0,a.jsx)("div",{className:"dsham_settingsList",id:"dsham-group-"+encodeURIComponent(d.key),hidden:ce.has(d.key)||void 0,children:!ce.has(d.key)&&d.sessions.map(R=>(0,a.jsxs)("div",{className:"dsham_settingsRow","data-selected":ir.has(R.id),children:[(0,a.jsx)(Or,{checked:ir.has(R.id),disabled:ee,label:u("archives.selectSession",{name:rt(R,u)}),onChange:e(we=>Rs(R.id,we.target.checked),"onChange")}),(0,a.jsxs)("div",{className:"dsham_settingsContent",children:[(0,a.jsx)("button",{type:"button",className:"dsham_settingsTitleLink",title:rt(R,u),"aria-label":u("archives.openSession")+u("common.separator")+rt(R,u),disabled:ee||Vt.has(R.id),onClick:e(()=>Bt(R),"onClick"),children:rt(R,u)}),(0,a.jsx)("div",{className:"dsham_settingsMeta",children:[cs(R.updatedAt,u)]}),sr.has(R.id)&&o.createElement("button",{type:"button",className:"dsham_settingsSnippet",disabled:ee,title:u(M?"discovery.preview":"archives.openSession"),onClick:e(()=>M?Dt.open(R,Lt):Bt(R),"onClick")},o.createElement(D,{text:sr.get(R.id)?.snippet??"",query:Lt}))]}),(0,a.jsxs)("div",{className:"dsham_settingsActions",children:[typeof on=="function"&&A({variant:"outline",className:"dsham_iconAction"+(G.has(R.id)?" dsham_favoriteOn":""),title:u(G.has(R.id)?"organizer.unfavorite":"organizer.favorite"),"aria-pressed":G.has(R.id),"aria-label":u(G.has(R.id)?"organizer.unfavorite":"organizer.favorite")+u("common.separator")+rt(R,u),disabled:ee||Cn||!Nt,onClick:e(()=>qe(R.id),"onClick"),children:(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:G.has(R.id)?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round","aria-hidden":!0,style:{display:"block"},children:(0,a.jsx)("path",{d:re})})}),A({variant:"outline",className:"dsham_iconAction",title:u(M?"archives.restore":"archives.archiveSelected"),"aria-label":u(M?"archives.restore":"archives.archiveSelected"),disabled:ee||Vt.has(R.id),onClick:e(()=>M?Ns(R.id):Jr([R.id]),"onClick"),icon:(0,a.jsx)(M?c.IconRefreshOutlineMedium:c.IconArchiveOutlineMedium,{size:16})}),M&&(0,a.jsx)(bs,{busy:ee||Vt.has(R.id),t:u,title:rt(R,u),onCopyId:e(()=>Ts(R),"onCopyId"),onPreview:typeof gt=="function"?()=>Dt.open(R,Lt):void 0,onRestoreOpen:e(()=>Bt(R,!0),"onRestoreOpen"),onDelete:e(()=>ln({kind:"session",session:R}),"onDelete")})]})]},R.id))})]},d.key)}),o.createElement(k,{width:900,className:"dsham_modalWide",portalToBody:!0,t:u,open:Dt.target!==null,onClose:Dt.close,title:Dt.target?rt(Dt.target.session,u):u("discovery.preview"),footer:w({variant:"primary",disabled:ee,onClick:e(()=>{if(Dt.target){let d=Dt.target.session;return Dt.close(),Bt(d)}},"onClick"),children:u("discovery.openFull")}),children:o.createElement(pe,{preview:Dt,t:u,MarkdownText:c.MarkdownText})}),Ie===null&&It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It}),Hn!==null&&(0,a.jsx)("div",{className:"dsham_settingsStatus",role:"status",children:Hn}),(0,a.jsx)(k,{t:u,open:Ie!==null,onClose:Zt,title:u("archives.archiveTitle",{n:Ie?.length??0}),description:$e===null?u("archives.archiveSelectedDesc"):u($e.key===Bn?"archives.archiveUngroupedDesc":"archives.archiveProjectDesc",{name:$e.title,n:Ie?.length??0}),footer:(0,a.jsxs)(a.Fragment,{children:[w({disabled:ee,onClick:Zt,children:u("cancel")}),w({variant:"primary",disabled:ee||!Ie?.length,onClick:Is,children:u("archives.archiveSelected")})]}),children:(0,a.jsxs)(a.Fragment,{children:[_t&&(0,a.jsx)("p",{children:u(Je?"organizer.idleConfirm":"organizer.manualConfirm")}),_t&&(0,a.jsx)("div",{className:"dsham_archivePreview",children:(Ie??[]).map(d=>(0,a.jsxs)("label",{children:[(0,a.jsx)(lr,{checked:!0,disabled:ee,label:rt(te.byId[d]??{id:d},u),onChange:e(()=>Se(x=>(x??[]).filter(X=>X!==d)),"onChange")}),rt(te.byId[d]??{id:d},u)]},d))}),F&&(0,a.jsxs)("div",{role:"status",children:[(0,a.jsx)("progress",{value:F.done,max:Math.max(1,F.total)}),u("organizer.progressCount",{done:F.done,total:F.total})]}),It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It})]})}),(0,a.jsx)(k,{t:u,open:Ze!==null,onClose:e(()=>{ee||(Mt(null),K(null))},"onClose"),title:u("archiveActive.title"),...Ze===null?{}:{description:u("archiveActive.desc",{name:Ze.title,kinds:Ze.kinds})},footer:(0,a.jsxs)(a.Fragment,{children:[w({disabled:ee,onClick:e(()=>{ee||(Mt(null),K(null))},"onClick"),children:u("cancel")}),w({danger:!0,disabled:ee,onClick:e(async()=>{if(!(Rt.current||ee||Ze===null||typeof s!="function")){Rt.current=!0,He(!0),K(null);try{await s(Ze.sessionId,{stopActivity:!0}),dt(d=>d.filter(x=>Ze===null||x!==Ze.sessionId)),et("archived"),Ue(u("archives.archiveSuccess",{n:1})),Mt(null)}catch(d){K(d instanceof Error?d.message:String(d))}finally{Rt.current=!1,He(!1)}}},"onClick"),children:u("archiveActive.confirm")})]}),children:It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It})}),(0,a.jsx)(k,{t:u,open:Te!==null,onClose:ra,title:Ls,...aa===void 0?{}:{description:aa},footer:(0,a.jsxs)(a.Fragment,{children:[w({disabled:ee,onClick:ra,children:u("cancel")}),w({danger:!0,disabled:ee,onClick:Ms,children:zs})]}),children:(0,a.jsxs)(a.Fragment,{children:[ee&&(0,a.jsxs)("div",{role:"status",children:[Te?.kind==="batch"?u("archives.deleteBatchPending"):u("deleteSession.pending"),F&&(0,a.jsx)("progress",{value:F.done,max:Math.max(1,F.total),"aria-label":u("organizer.progress")}),F&&u("organizer.progressCount",{done:F.done,total:F.total})]}),It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It})]})})]})]})}e(Mn,"ArchivedSessionsSection");function Er(n){var s,l,h="";if(typeof n=="string"||typeof n=="number")h+=n;else if(typeof n=="object")if(Array.isArray(n)){var v=n.length;for(s=0;s<v;s++)n[s]&&(l=Er(n[s]))&&(h&&(h+=" "),h+=l)}else for(l in n)n[l]&&(h&&(h+=" "),h+=l);return h}e(Er,"r");function es(...n){for(var s,l,h=0,v="",m=arguments.length;h<m;h++)(s=arguments[h])&&(l=Er(s))&&(v&&(v+=" "),v+=l);return v}e(es,"clsx");function Ln(n){let s=n instanceof Error?n.message:String(n);return s.includes("UNKNOWN_SESSION")||s.includes("no such session")}e(Ln,"isUnknownSessionError");function Yn(n,s){if(Ln(n))return s("deleteSession.unknown");let l=n instanceof Error?n.message:String(n);return s("deleteSession.failed",{detail:l})}e(Yn,"formatDeleteError");function Ir(n,s){if(Ln(n))return s("archives.unarchiveUnknown");let l=n instanceof Error?n.message:String(n);return s("archives.unarchiveFailed",{detail:l})}e(Ir,"formatUnarchiveError");function zn(n,s,l=Tr){return n.map(h=>h.sessionId+s("common.separator")+l(new Error(h.message),s)).join(`
|
|
23
|
+
`)}e(zn,"formatBatchFailures");function Tr(n,s){if(Ln(n))return s("archives.archiveUnknown");let l=n instanceof Error?n.message:String(n);return s("archives.archiveFailed",{detail:l})}e(Tr,"formatArchiveError");function Pn(n){if(n===null||typeof n!="object")return;let s=le(n),l=s.rpcError!==null&&typeof s.rpcError=="object"?le(s.rpcError):void 0,h=s.name==="WorkspaceActiveSessionError"?s.activity:void 0,v=l?.details,m=s.name==="WorkspaceArchiveError"&&l?.code==="workspace/session-active"&&v!==null&&typeof v=="object"?le(v).activity:void 0,C=Array.isArray(h)?h:Array.isArray(m)?m:void 0;if(C===void 0)return;let E=C.flatMap(N=>{if(N===null||typeof N!="object")return[];let B=le(N).kind;return typeof B=="string"&&B.length>0?[B]:[]});return E.length>0?E:void 0}e(Pn,"activeSessionActivity");function Ar(n){let s=Pn(n);if(s===void 0||n===null||typeof n!="object")return;let l=le(n),h=l.rpcError!==null&&typeof l.rpcError=="object"?le(l.rpcError).details:void 0,v=h!==null&&typeof h=="object"?le(h).sessionId:void 0,m=typeof l.sessionId=="string"?l.sessionId:typeof v=="string"?v:void 0;return m===void 0?void 0:{sessionId:m,kinds:s}}e(Ar,"activeSessionRefusal");function _r(n,s){let l=/^cannot archive session '(?:[^'\\]|\\')*': the session is active \((.*)\)$/.exec(s);if(l===null)return;let h=l[1].split(", ").filter(v=>v.length>0);return h.length>0?{sessionId:n,kinds:h}:void 0}e(_r,"activeArchiveFromMessage");function ts(n,s){let l=n instanceof Error?n.message:String(n);return s("archives.forkFailed",{detail:l})}e(ts,"formatForkError");function On(n,s,l){if(!n||l.has(n))return!1;let h=s?.[n];return!(h===void 0||h.origin==="subagent"||h.blank)}e(On,"isWorkspaceTaskCandidate");function Rr(n){let s=n?.closest("[data-row-key]")??null;if(s===null)return null;let l=s.getAttribute("data-row-key")??"";if(!l.startsWith("workspace:"))return null;let h=l.slice(10);if(!h)return null;let v=s.querySelector(".title")??s.querySelector("[class*='title']");return{workspaceId:h,title:v?.textContent?.trim()||h}}e(Rr,"workspaceMenuTriggerFrom");function Zn(n){let s=n.querySelector('[class*="rowActions"]');if(!s)return null;let l=Array.from(s.querySelectorAll("button"));if(l.length===0)return null;let h=e(m=>!!((m.getAttribute("class")??"").includes("dsham_rowStar")||typeof m.closest=="function"&&m.closest(".dsham_starSlot")),"isStarButton");return l.find(m=>{if(h(m))return!1;if(m.getAttribute("aria-haspopup")==="menu")return!0;let C=(m.getAttribute("aria-label")??m.getAttribute("title")??"").toLowerCase();return/new|create|新建|add|\+|созда/.test(C)?!1:/action|操作|действи|more|更多|选项|options|menu/.test(C)})??null}e(Zn,"findRowMenuButton");function jr(n,s){if(Zn(s)===n)return!0;let h=(n.getAttribute("aria-label")??n.getAttribute("title")??"").toLowerCase();return/action|操作|действи|more|更多/.test(h)}e(jr,"isRowMenuButton");function Nr(){if(typeof document>"u"||typeof document.addEventListener!="function")return()=>{};let n=e(s=>{let l=s.target;if(!l||l.closest("input, textarea, [contenteditable='true']"))return;let h=l.closest('[data-row-key^="workspace:"], [data-row-key^="session:"]');if(!h)return;let v=l.closest("button");if(v&&!jr(v,h))return;let m=Zn(h);m&&(s.preventDefault(),s.stopPropagation(),m.click())},"onContextMenu");return document.addEventListener("contextmenu",n,!0),()=>{document.removeEventListener("contextmenu",n,!0)}}e(Nr,"setupSidebarRowContextMenu");function Jn(n,s=!0){let l=(n.textContent??"").toLowerCase();return l.includes("\u5220\u9664\u5DE5\u4F5C\u533A")||l.includes("delete workspace")||l.includes("\u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0440\u0430\u0431\u043E\u0447\u0435\u0435")?!0:s&&/(?:^|[_\s-])danger(?:$|[_\s-])/i.test(n.className)}e(Jn,"isWorkspaceDeleteMenuItem");let ns=new Map,rs=new Set,as=new Map;function ss(n){return n(ns)}e(ss,"useEmptySessionPendingInteraction");function is(n){return n(as)}e(is,"useEmptySessionStatus");function os(n){let s=new Map,l=new Set;if(n instanceof Map)for(let[h,v]of n)v?.pendingInteraction!==void 0&&s.set(h,v.pendingInteraction),v?.completionUnread===!0&&l.add(h);return{pending:s,completed:l}}e(os,"factsFromSessionStatus");function ls(n,s,l){let h=n(m=>m),v=s(m=>m);return l?os(v):{pending:h,completed:rs}}e(ls,"useSessionUiFacts");let Dr={listeners:new Set,request(n){for(let s of this.listeners)s(n)},subscribe(n){return this.listeners.add(n),()=>{this.listeners.delete(n)}}};function rt(n,s){return n.blank?s("session.new"):n.title??n.displayTitle??""}e(rt,"displayTitle");function cs(n,s){let l=new Date(n),h=`${String(l.getHours()).padStart(2,"0")}:${String(l.getMinutes()).padStart(2,"0")}`;return s("archives.timestamp",{date:s("date.ymd",{y:l.getFullYear(),m:l.getMonth()+1,d:l.getDate()}),time:h})}e(cs,"archiveTimeLabel");let ds=[".dsham_archiveTabsLocked{opacity:.5}",".dsham_archiveTabs{display:grid!important;box-sizing:border-box!important;height:32px!important;min-height:32px!important;max-height:32px!important;padding:2px!important;border:0!important;border-radius:var(--dsw-radius-sm,8px)!important;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l2)!important;background:var(--dsw-alias-bg-layer-1)!important}",'.dsham_archiveTabs>span[aria-hidden="true"],.dsham_archiveTabs>[class*="indicator"]{inset:2px auto 2px 2px!important;width:calc((100% - 4px)/2)!important;border-radius:6px!important;border:0.5px solid var(--dsw-alias-border-l3,rgba(255,255,255,.12))!important;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.08))!important;box-shadow:none!important}',".dsham_archiveTabs [role=tab]{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;height:28px!important;padding:0 12px!important;border-radius:6px!important;font-size:13px!important;line-height:20px!important;color:var(--dsw-alias-label-secondary)!important;text-align:center!important;box-sizing:border-box!important;transition:color 150ms ease!important}",".dsham_archiveTabs [role=tab]:hover{color:var(--dsw-alias-label-primary)!important}",'.dsham_archiveTabs [role=tab][aria-selected="true"]{color:var(--dsw-alias-label-primary)!important;font-weight:600!important}',".dsham_tabLabel{display:inline-flex;align-items:center;justify-content:center;gap:6px}",".dsham_tabLabel svg{flex:none;display:block}"].join(""),At="data-dsham-nav-icon",us='[role="dialog"] nav button',Xn=[`[${At}] > svg { display: none !important; }`,`[${At}]::before {`," content: '';"," flex: none;"," width: 16px;"," height: 16px;"," background-color: currentColor;",' -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.3%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M13.5%202.5H2.5C1.94772%202.5%201.5%202.94772%201.5%203.5V4.5C1.5%205.05228%201.94772%205.5%202.5%205.5H13.5C14.0523%205.5%2014.5%205.05228%2014.5%204.5V3.5C14.5%202.94772%2014.0523%202.5%2013.5%202.5Z%22%2F%3E%3Cpath%20d%3D%22M2.5%205.5V13.5C2.5%2013.7652%202.60536%2014.0196%202.79289%2014.2071C2.98043%2014.3946%203.23478%2014.5%203.5%2014.5H12.5C12.7652%2014.5%2013.0196%2014.3946%2013.2071%2014.2071C13.3946%2014.0196%2013.5%2013.7652%2013.5%2013.5V5.5%22%2F%3E%3Cpath%20d%3D%22M6.5%209.5H9.5%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center / contain no-repeat;',' mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.3%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M13.5%202.5H2.5C1.94772%202.5%201.5%202.94772%201.5%203.5V4.5C1.5%205.05228%201.94772%205.5%202.5%205.5H13.5C14.0523%205.5%2014.5%205.05228%2014.5%204.5V3.5C14.5%202.94772%2014.0523%202.5%2013.5%202.5Z%22%2F%3E%3Cpath%20d%3D%22M2.5%205.5V13.5C2.5%2013.7652%202.60536%2014.0196%202.79289%2014.2071C2.98043%2014.3946%203.23478%2014.5%203.5%2014.5H12.5C12.7652%2014.5%2013.0196%2014.3946%2013.2071%2014.2071C13.3946%2014.0196%2013.5%2013.7652%2013.5%2013.5V5.5%22%2F%3E%3Cpath%20d%3D%22M6.5%209.5H9.5%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center / contain no-repeat;'," -webkit-mask-repeat: no-repeat;"," mask-repeat: no-repeat;"," -webkit-mask-position: center;"," mask-position: center;"," -webkit-mask-size: 16px 16px;"," mask-size: 16px 16px;","}"].join(`
|
|
24
|
+
`);function hs(n,s){let l=String(s??"").trim();return l.length>0&&String(n??"").trim()===l}e(hs,"isOwnSettingsNavRow");function Fn(n,s){for(let l of n){if(l.type==="characterData"){let v=l.target.parentElement;if(v!==null&&v.closest(s)!==null)return!0;continue}let h=l.target;if(h&&h.nodeType===1&&(typeof h.matches=="function"&&h.matches(s)||typeof h.closest=="function"&&h.closest(s)!==null))return!0;if(l.addedNodes)for(let v of l.addedNodes){if(v.nodeType!==1)continue;let m=v;if(typeof m.matches=="function"&&m.matches(s)||typeof m.querySelector=="function"&&m.querySelector(s)!==null||typeof m.closest=="function"&&m.closest(s)!==null)return!0}if(l.removedNodes)for(let v of l.removedNodes){if(v.nodeType!==1)continue;let m=v;if(typeof m.matches=="function"&&m.matches(s)||typeof m.querySelector=="function"&&m.querySelector(s)!==null||typeof m.closest=="function"&&m.closest(s)!==null)return!0}}return!1}e(Fn,"mutationTouches");function Mr(n,s){return hs(n.textContent,s)?Array.from(n.children).some(v=>v.tagName==="SPAN"&&(v.className.includes("navIcon")||v.getAttribute("aria-hidden")==="true"))||!!n.querySelector?.('[class*="navIcon"]')?n.hasAttribute(At)?(n.removeAttribute(At),!0):!1:n.getAttribute(At)===""?!1:(n.setAttribute(At,""),!0):n.hasAttribute(At)?(n.removeAttribute(At),!0):!1}e(Mr,"applySettingsNavIcon");function Lr(n){return n.hasAttribute(At)?(n.removeAttribute(At),!0):!1}e(Lr,"restoreSettingsNavIcon");function zr(n){typeof document>"u"||typeof MutationObserver>"u"||n.effect(()=>{let s="dsham-nav-icon-style",l=document.getElementById(s);l===null?(l=document.createElement("style"),l.id=s,l.textContent=Xn,(document.head??document.documentElement).append(l)):l.textContent!==Xn&&(l.textContent=Xn);let h=!1,v=!1,m=e(()=>{if(v=!1,h)return;let N=n.locale.bind(De)("archived.badge");for(let B of document.querySelectorAll(us))Mr(B,N)},"sync"),C=e(()=>{v||h||(v=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(m):setTimeout(m,16))},"schedule");m();let E=new MutationObserver(N=>{Fn(N,'[role="dialog"] nav')&&C()});return E.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),()=>{h=!0,E.disconnect();for(let N of document.querySelectorAll(`[${At}]`))Lr(N);l?.remove()}},"archive-manager: settings nav icon")}e(zr,"installSettingsNavIcon");let ps=[".dsham_settings{container-type:inline-size;min-width:0;box-sizing:border-box;width:100%;padding:0 0 32px;color:var(--dsw-alias-label-primary)}",".dsham_settingsHeader{display:flex;flex-direction:column;align-items:stretch;gap:16px;margin-bottom:16px}",".dsham_settings h2{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap}",".dsham_settingsIntro{margin:12px 0 0;max-width:42em;color:var(--dsw-alias-label-tertiary);font-size:14px;line-height:22px}",".dsham_settingsToolbar{display:flex;align-items:center;gap:8px;margin-bottom:16px;width:100%;min-width:0}",".dsham_settingsSearch{display:flex;align-items:center;gap:8px;min-width:0;width:100%;flex-wrap:nowrap}","@container(max-width:520px){.dsham_settingsSearch{flex-wrap:wrap}}",".dsham_settingsSearch .dsham_searchField{flex:1 1 0;min-width:120px;width:auto;box-sizing:border-box}",".dsham_viewSortContainer{flex:0 0 auto;position:relative;box-sizing:border-box}",".dsham_viewSortBtn{height:32px!important;padding:0 8px!important;font-size:13px!important;box-sizing:border-box}",".dsham_viewSortBtn.has-filter{border-color:var(--dsw-alias-state-business-primary)!important;color:var(--dsw-alias-state-business-primary)!important}",".dsham_settingsFilter{display:inline-flex;position:relative}",".dsham_settingsSearch .dsham_projectFilter{flex:0 0 auto;max-width:120px;min-width:0;box-sizing:border-box}",".dsham_settingsSearch .dsham_projectFilter > span{display:inline-block;max-width:100%;box-sizing:border-box}",".dsham_settingsSearch .dsham_projectFilter .dsham_menuSelectBtn{display:inline-flex!important;width:100%;max-width:120px;padding:0 8px;box-sizing:border-box;overflow:hidden}",".dsham_settingsSearch .dsham_projectFilter .dsham_selectLabel{flex:1 1 auto;min-width:0;max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}",".dsham_settingsSearch .dsham_dateFilter{flex:0 0 125px;width:125px;min-width:125px;position:relative;box-sizing:border-box}",".dsham_dateRange{width:100%;box-sizing:border-box}",".dsham_dateTrigger{height:32px!important;padding:0 8px!important;gap:5px!important;border:0.5px solid var(--dsw-alias-border-l2)!important;border-radius:var(--dsw-radius-sm,8px)!important;background:var(--dsw-alias-bg-layer-1)!important;box-sizing:border-box}",".dsham_dateTrigger .dsham_dateText{font-size:12px!important;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".dsham_srOnly{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;opacity:0;pointer-events:none}",".dsham_menuSelectBtn{display:inline-flex!important;align-items:center;justify-content:space-between;gap:6px;width:auto!important;max-width:100%;min-width:0!important;height:32px!important;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-sizing:border-box;font:inherit;font-size:13px;cursor:pointer}",".dsham_selectLabel{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:normal;text-align:left}",".dsham_settingsGroup{margin:0 0 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-button-elevated-fill));overflow:hidden;transition:border-color 150ms ease}",".dsham_settingsGroupHeading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px;padding:0 10px;margin:0;user-select:none}",".dsham_settingsGroupTitle{display:flex;align-items:center;gap:8px;min-width:0;margin:0;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600}",".dsham_settingsGroupTitle svg{flex:none;color:var(--dsw-alias-label-secondary)}",".dsham_settingsCount{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px}",".dsham_settingsList{display:grid;overflow:hidden;border:0;border-top:1px solid var(--dsw-alias-border-l2);border-radius:0;background:transparent}",".dsham_settingsList[hidden]{display:none!important;border:0!important}",".dsham_settingsRow{display:grid;grid-template-columns:16px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:40px;padding:4px 10px;border-bottom:1px solid var(--dsw-alias-border-l2)}",".dsham_settingsRow:last-child{border-bottom:0}",".dsham_settingsContent{min-width:0;flex:1}",".dsham_settingsMeta{margin-top:1px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:13px}",".dsham_settingsActions{display:flex;align-items:center;gap:4px;flex:none}",".dsham_settingsEmpty{padding:28px 8px;color:var(--dsw-alias-label-secondary);text-align:center}",".dsham_settingsError{margin-top:10px;color:var(--dsw-alias-state-error-primary);font-size:12px;white-space:pre-line}","@container(max-width:520px){.dsham_settingsHeader{margin-bottom:16px}.dsham_settingsGroup{margin-bottom:10px}.dsham_settingsRow{padding:4px 8px}.dsham_settingsActions{gap:2px}}"].join(""),ms=".dsham_settingsTitleLink{display:block;max-width:100%;padding:0;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;font-weight:600;line-height:16px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.dsham_settingsTitleLink:hover:not(:disabled){text-decoration:underline;text-underline-offset:3px}.dsham_settingsTitleLink:disabled{cursor:default;opacity:.6}.dsham_groupToggle{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding:4px 0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.dsham_groupToggle span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsham_settingsRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.dsham_settingsRow[data-selected=true]{background:var(--dsw-alias-interactive-bg-hover)}.dsham_settingsTitleLink:focus-visible,.dsham_groupToggle:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#3b82f6);outline-offset:2px}@container(max-width:400px){.dsham_settingsRow{gap:6px;padding:4px 6px}.dsham_settingsActions{gap:0}.dsham_settingsMeta{font-size:10px}}.dsham_settingsGroupMeta{display:flex;align-items:center;gap:8px;flex:none;flex-wrap:wrap}.dsham_settingsStatus{margin-top:10px;color:var(--dsw-alias-label-secondary);font-size:12px}.dsham_checkbox{flex:none;box-sizing:border-box;width:16px;height:16px;margin:0;accent-color:var(--dsw-alias-brand-primary);cursor:pointer}.dsham_checkbox:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.dsham_checkbox:disabled{opacity:.5;cursor:default}button.dsham_favoriteOn{color:#e8b931}button.dsham_favoriteOn:not(:disabled):hover{color:#e8b931!important;border-color:#e8b931!important}",fs=".dsham_settingsTitleRow{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}.dsham_settingsLinks{display:flex;align-items:center;gap:8px;flex-wrap:wrap}@media(max-width:720px){.dsham_settingsTitleRow{flex-wrap:wrap}}",gs=".dsham_settingsSelection{margin:-8px 0 16px;padding:4px 0 12px;border-bottom:1px solid var(--dsw-alias-border-l2)}.dsham_settingsSelectionMain{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;min-height:36px}.dsham_settingsSelectionSummary{display:flex;flex-wrap:wrap;align-items:center;gap:12px;min-width:0;max-width:100%}.dsham_settingsSelectionToggle{display:inline-flex;flex:none;white-space:nowrap;align-items:center;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;cursor:pointer}.dsham_settingsSelectionActions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;max-width:100%;margin-left:auto}.dsham_settingsSelectionScope{margin:8px 0 0;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow-wrap:anywhere}";function Qn({id:n,className:s,value:l,options:h,onChange:v,disabled:m=!1,"aria-label":C,title:E,tabIndex:N,"aria-hidden":B}){let[_,P]=o.useState(!1),H=o.useMemo(()=>h.map(Me=>({id:Me.value,label:Me.label})),[h]),u=h.find(Me=>Me.value===l),Ce=u?.label??C;return(0,a.jsx)("div",{id:n,tabIndex:N,"aria-hidden":B,className:s===void 0?"dsham_settingsFilter":`dsham_settingsFilter ${s}`,children:(0,a.jsx)(c.Menu,{open:_,onClose:e(()=>P(!1),"onClose"),onSelect:e(Me=>{m||v(Me),P(!1)},"onSelect"),selectedId:l,align:"start",portal:!0,dense:!0,listClassName:"dsham_selectDropdown",anchor:(0,a.jsxs)(c.Button,{variant:"outline",size:"sm",role:"combobox","aria-label":C,"aria-expanded":_,disabled:m,tabIndex:N,"aria-hidden":B,title:E??u?.title??u?.label??C,className:"dsham_menuSelectBtn"+(_?" is-open":""),onClick:e(()=>{m||P(Me=>!Me)},"onClick"),children:[(0,a.jsx)("span",{className:"dsham_selectLabel",children:Ce}),(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:{marginLeft:4,transition:"transform 150ms ease",transform:_?"rotate(180deg)":"none",flex:"none"},children:(0,a.jsx)("path",{d:"m4 6 4 4 4-4"})})]}),items:H})})}e(Qn,"ArchiveProjectSelect");function vs({id:n,t:s,disabled:l=!1,favoritesOnly:h,setFavoritesOnly:v,favoriteBusy:m=!1,sortBy:C,setSortBy:E,options:N}){let[B,_]=o.useState(!1),P=o.useMemo(()=>{let fe=[];typeof v=="function"&&(fe.push({type:"label",id:"lbl_view_filter",text:s("organizer.favoriteFilter")||"\u7B5B\u9009\u4F1A\u8BDD"}),fe.push({id:"filter:all",label:s("organizer.allSessions")||"\u5168\u90E8\u4F1A\u8BDD"}),fe.push({id:"filter:favorites",label:s("organizer.favoritesOnly")||"\u53EA\u770B\u6536\u85CF"}),fe.push({type:"separator",id:"sep_view_filter"})),fe.push({type:"label",id:"lbl_view_sort",text:s("archives.sortLabel")||"\u6392\u5E8F\u65B9\u5F0F"});for(let Ct of N)fe.push({id:`sort:${Ct.value}`,label:Ct.label});return fe},[s,v,N]),H=e(fe=>{fe.startsWith("filter:")?typeof v=="function"&&!m&&v(fe==="filter:favorites"):fe.startsWith("sort:")&&E(fe.slice(5)),_(!1)},"onSelect"),u=N.find(fe=>fe.value===C),Ce=h?s("organizer.favoritesOnly")||"\u53EA\u770B\u6536\u85CF":s("organizer.allChats")||"\u5168\u90E8\u804A\u5929",Me=`${Ce} \xB7 ${u?.label??C}`;return(0,a.jsxs)("div",{className:"dsham_viewSortContainer",children:[(0,a.jsx)(c.Menu,{open:B,onClose:e(()=>_(!1),"onClose"),onSelect:H,selectedIds:[h?"filter:favorites":"filter:all",`sort:${C}`],align:"end",portal:!0,dense:!0,listClassName:"dsham_viewSortDropdown",anchor:(0,a.jsxs)(c.Button,{variant:"outline",size:"sm",role:"combobox","aria-label":s("archives.viewOptions")||"\u89C6\u56FE\u9009\u9879","aria-expanded":B,disabled:l,title:Me,className:"dsham_menuSelectBtn dsham_viewSortBtn"+(B?" is-open":"")+(h?" has-filter":""),onClick:e(()=>{l||_(fe=>!fe)},"onClick"),children:[(0,a.jsxs)("svg",{viewBox:"0 0 16 16",width:13,height:13,fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none",marginRight:4},children:[(0,a.jsx)("line",{x1:2.5,y1:4.5,x2:13.5,y2:4.5}),(0,a.jsx)("circle",{cx:5,cy:4.5,r:1.5,fill:"var(--dsw-alias-bg-layer-1)"}),(0,a.jsx)("line",{x1:2.5,y1:11.5,x2:13.5,y2:11.5}),(0,a.jsx)("circle",{cx:11,cy:11.5,r:1.5,fill:"var(--dsw-alias-bg-layer-1)"})]}),(0,a.jsx)("span",{className:"dsham_selectLabel",children:Ce}),(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:11,height:11,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:{marginLeft:3,transition:"transform 150ms ease",transform:B?"rotate(180deg)":"none",flex:"none"},children:(0,a.jsx)("path",{d:"m4 6 4 4 4-4"})})]}),items:P})]})}e(vs,"ArchiveViewSortMenu");function Pr({selectedCount:n,hiddenCount:s,allVisibleSelected:l,selectedVisibleCount:h,visibleCount:v,busy:m,t:C,onToggle:E,onClear:N,onRestore:B,onDelete:_,onArchive:P}){let H=n>0;return(0,a.jsxs)("div",{className:"dsham_settingsSelection",children:[(0,a.jsxs)("div",{className:"dsham_settingsSelectionMain",children:[(0,a.jsxs)("div",{className:"dsham_settingsSelectionSummary",children:[(0,a.jsxs)("label",{className:"dsham_settingsSelectionToggle",title:C("archives.selectAllFiltered"),children:[(0,a.jsx)(Or,{checked:l,indeterminate:h>0&&!l,disabled:m||v===0,label:C("archives.selectAllFiltered"),onChange:e(u=>E(u.target.checked),"onChange")}),(0,a.jsx)("span",{"aria-live":"polite",children:H?C("archives.selectedCount",{n}):C("archives.selectAllFiltered")})]}),H&&A({disabled:m,"aria-label":C("archives.clearSelection"),onClick:N,children:C("archives.clearSelectionShort")})]}),H&&(0,a.jsxs)("div",{className:"dsham_settingsSelectionActions",children:P?[A({disabled:m,onClick:P,children:C("archives.archiveSelected")})]:[A({disabled:m,"aria-label":C("archives.restoreSelected"),onClick:B,children:C("archives.restore")}),A({disabled:m,className:"dsham_btnDanger","aria-label":C("archives.deleteSelected"),onClick:_,children:C("archives.deleteSelectionShort")})]})]}),s>0&&(0,a.jsx)("p",{className:"dsham_settingsSelectionScope",role:"status",children:C("archives.selectionHiddenHint",{hidden:s})})]})}e(Pr,"ArchiveSelectionToolbar");function Or({checked:n,indeterminate:s=!1,disabled:l=!1,label:h,onChange:v}){return(0,a.jsx)(lr,{checked:n,indeterminate:s,disabled:l,label:h,onChange:v})}e(Or,"ArchiveSelectionCheckbox");function Fr(){return(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,"aria-hidden":!0,focusable:"false",children:[3.5,8,12.5].map(n=>(0,a.jsx)("circle",{cx:n,cy:8,r:1.15,fill:"none",stroke:"currentColor",strokeWidth:1.5},n))})}e(Fr,"moreIcon");function bs({busy:n,title:s,t:l,onPreview:h,onRestoreOpen:v,onDelete:m,onCopyId:C}){let[E,N]=(0,o.useState)(!1),B=e(P=>{if(!n){if(N(!1),P==="copyId")return C?.();if(P==="preview")return h?.();if(P==="restoreOpen")return v?.();P==="delete"&&m?.()}},"choose"),_=[...h?[{id:"preview",label:l("discovery.preview"),icon:(0,a.jsx)(c.IconBrowseOutlineMedium,{size:16}),danger:!1}]:[],...v?[{id:"restoreOpen",label:l("archives.restoreOpen"),icon:(0,a.jsx)(c.IconUnarchiveOutlineMedium,{size:16}),danger:!1}]:[],...C?[{id:"copyId",label:l("details.copyId"),icon:(0,a.jsx)(c.IconCopyOutlineMedium,{size:16}),danger:!1}]:[],...m?[{id:"delete",label:l("menu.deleteSession"),icon:(0,a.jsx)(c.IconTrashOutlineMedium,{size:16}),danger:!0}]:[]];return(0,a.jsx)(c.Menu,{open:!n&&E,align:"end",portal:!0,dense:!0,items:_,onSelect:B,onClose:e(()=>N(!1),"onClose"),anchor:A({variant:"outline",className:"dsham_iconAction",disabled:n,title:l("archives.moreActions"),"aria-label":l("archives.moreActions")+l("common.separator")+s,"aria-haspopup":"menu","aria-expanded":E&&!n,icon:Fr(),onClick:e(()=>{n||N(P=>!P)},"onClick")})})}e(bs,"ArchivedSessionMenu");function ys({group:n,busy:s,onArchive:l,onRestore:h,onDelete:v,t:m}){let C=n.key===Bn,E=l?[{id:"archive",label:m(C?"archives.archiveUngrouped":"archives.archiveProject"),icon:(0,a.jsx)(c.IconArchiveOutlineMedium,{size:16}),danger:!0}]:[{id:"restore",label:m(C?"archives.restoreUngrouped":"archives.restoreProject"),icon:(0,a.jsx)(c.IconUnarchiveOutlineMedium,{size:16}),danger:!1},{id:"delete",label:m(C?"archives.deleteUngrouped":"archives.deleteProject"),icon:(0,a.jsx)(c.IconTrashOutlineMedium,{size:16}),danger:!0}],[N,B]=(0,o.useState)(!1),_=m(C?"archives.ungroupedActions":"archives.projectActions",{name:n.title}),P=e(H=>{s||(H==="archive"?l?.():H==="restore"?h?.():H==="delete"&&v?.())},"choose");return(0,a.jsx)(c.Menu,{open:!s&&N,align:"end",portal:!0,dense:!0,items:E,onSelect:e(H=>{B(!1),P(H)},"onSelect"),onClose:e(()=>B(!1),"onClose"),anchor:A({variant:"outline",className:"dsham_iconAction",disabled:s,"aria-label":_,"aria-haspopup":"menu","aria-expanded":N&&!s,icon:Fr(),onClick:e(()=>{s||B(H=>!H)},"onClick")})})}e(ys,"ArchivedGroupActions");let Bn="__ungrouped__";function ws(n){return n===Bn?{scope:"ungrouped"}:{scope:"workspace",workspaceId:n}}e(ws,"archivedBatchTargetForGroup");function vn(n,s,l){let h=[...new Set(n??[])];if(l.scope==="all")return h;if(l.scope==="sessions"){let m=new Set(l.sessionIds??[]);return h.filter(C=>m.has(C))}if(l.scope==="workspace"){let m=new Set(s.find(C=>C.workspaceId===l.workspaceId)?.sessionIds??[]);return h.filter(C=>m.has(C))}let v=new Set(s.flatMap(m=>m.sessionIds));return h.filter(m=>!v.has(m))}e(vn,"deriveArchivedBatchIds");function Br(n){return[...new Set(n.flatMap(s=>s.sessions.map(l=>l.id)))]}e(Br,"archivedSessionIdsInGroups");function Hr(n,s){let l=new Set(s);return[...new Set(n)].filter(h=>l.has(h))}e(Hr,"pruneArchivedSelection");function er(n,s,l){let h=new Set(n);for(let v of s)l?h.add(v):h.delete(v);return[...h]}e(er,"toggleArchivedSelection");function Ur(n,s){let l=n.deletedSessionIds.length,h=n.skippedSessionIds.length;return n.failures.length>0?{kind:"error",message:s("archives.deletePartial",{deleted:l,skipped:h,failed:n.failures.length,detail:n.failures[0].message})}:h>0&&l>0?{kind:"notice",message:s("archives.deleteSuccessWithSkipped",{deleted:l,skipped:h})}:h>0?{kind:"notice",message:s("archives.deleteSkipped",{n:h})}:{kind:"notice",message:s("archives.deleteSuccess",{n:l})}}e(Ur,"archivedDeleteFeedback");function Wr(n,s){let l=new Set(s);return Object.values(n).filter(h=>h.origin!=="subagent"&&!h.blank&&!l.has(h.id)).map(h=>h.id)}e(Wr,"unarchivedSessionIds");function qr(n,s,l,h){let v=s.map(E=>({key:E.workspaceId,title:E.title,ids:new Set(E.sessionIds),sessions:[]})),m=[];for(let E of l){let N=n[E];if(N===void 0||N.origin==="subagent")continue;let B=v.find(_=>_.ids?.has(E));(B===void 0?m:B.sessions).push(N)}let C=v.filter(E=>E.sessions.length>0);return m.length>0&&C.push({key:Bn,title:h,sessions:m}),C}e(qr,"deriveArchivedGroups");function Vr(n,s,l,h,v=[]){let m=e((_,P)=>String(_).localeCompare(String(P),void 0,{numeric:!0,sensitivity:"base"}),"compareText"),C=new Map;if(Array.isArray(v))for(let _=0;_<v.length;_++)C.set(v[_],_);let E=e(_=>{let P=s==="created"?l[_.id]:_.updatedAt;return typeof P=="number"&&Number.isFinite(P)?P:Number.NEGATIVE_INFINITY},"timestampOf"),N=e((_,P)=>{if(s==="archived"){let H=C.get(_.id)??-1,Ce=(C.get(P.id)??-1)-H;if(Ce!==0)return Ce}if(s!=="alphabetical"){let H=E(P)-E(_);if(Number.isFinite(H)&&H!==0)return H}return m(rt(_,h),rt(P,h))||m(_.id,P.id)},"compareSessions");return n.map(_=>({..._,sessions:[..._.sessions].sort(N)})).sort((_,P)=>{if(s==="archived"){let H=_.sessions[0]?.id,u=P.sessions[0]?.id,Ce=H!==void 0?C.get(H)??-1:-1,fe=(u!==void 0?C.get(u)??-1:-1)-Ce;if(fe!==0)return fe}if(s!=="alphabetical"){let H=E(P.sessions[0])-E(_.sessions[0]);if(Number.isFinite(H)&&H!==0)return H}return m(_.title,P.title)||m(_.key,P.key)})}e(Vr,"sortArchivedGroups");let $r={...Va,...xa,"locale.language":"zh","service.unavailable":"\u670D\u52A1\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u91CD\u8BD5","common.close":"\u5173\u95ED","entry.location.title":"\u5165\u53E3\u5C55\u793A\u4F4D\u7F6E","entry.location.desc":"\u9009\u62E9\u5F52\u6863\u7BA1\u7406\u5165\u53E3\u7684\u5C55\u793A\u4F4D\u7F6E\uFF08\u81F3\u5C11\u4FDD\u7559\u4E00\u5904\uFF0C\u9632\u6B62\u65E0\u6CD5\u6253\u5F00\u9762\u677F\uFF09\u3002","entry.location.both":"\u4E24\u8FB9\u663E\u793A","entry.location.sidebar":"\u4EC5\u4FA7\u8FB9\u680F","entry.location.settings":"\u4EC5\u8BBE\u7F6E","entry.location.saveFailed":"\u4FDD\u5B58\u5165\u53E3\u8BBE\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u91CD\u542F\u5BBF\u4E3B\u8FDB\u7A0B","sidebar.favoriteStar.title":"\u4FA7\u680F\u6536\u85CF\u661F\u6807","sidebar.favoriteStar.desc":"\u5728\u4F1A\u8BDD\u5217\u8868\u884C\u524D\u663E\u793A\u6536\u85CF\u661F\u6807\u3002\u5173\u95ED\u540E\u4E0D\u663E\u793A\u56FE\u6807\uFF0C\u4ECD\u53EF\u901A\u8FC7\u83DC\u5355\u6536\u85CF\u548C\u7B5B\u9009\u3002","sidebar.favoriteStar.toggle":"\u5207\u6362\u4FA7\u680F\u6536\u85CF\u661F\u6807","update.entry.title":"\u5728\u7EBF\u66F4\u65B0","update.entry.desc":"\u5141\u8BB8\u68C0\u67E5\u5E76\u5728\u7EBF\u5B89\u88C5\u5F52\u6863\u7BA1\u7406\u5668\u7684\u65B0\u7248\u672C\u3002\u5173\u95ED\u540E\u9690\u85CF\u66F4\u65B0\u5165\u53E3\u3002","update.entry.toggle":"\u5207\u6362\u5728\u7EBF\u66F4\u65B0","update.entry.locked":"\u5728\u7EBF\u66F4\u65B0\u5DF2\u88AB\u5BBF\u4E3B\u914D\u7F6E\u9501\u5B9A\u7981\u7528","archives.archiveProject":"\u5F52\u6863\u8BE5\u9879\u76EE\u7684\u5168\u90E8\u804A\u5929","archives.archiveUngrouped":"\u5F52\u6863\u5168\u90E8\u672A\u5206\u7EC4\u804A\u5929","archives.archiveProjectDesc":"\u5C06\u201C{name}\u201D\u4E2D\u5168\u90E8 {n} \u6761\u672A\u5F52\u6863\u4F1A\u8BDD\u5F52\u6863\uFF0C\u4E0D\u53D7\u5F53\u524D\u641C\u7D22\u7B5B\u9009\u5F71\u54CD\u3002\u4E4B\u540E\u53EF\u5728\u201C\u5DF2\u5F52\u6863\u201D\u4E2D\u6062\u590D\u3002","archives.archiveUngroupedDesc":"\u5C06\u5168\u90E8 {n} \u6761\u672A\u5206\u7EC4\u7684\u672A\u5F52\u6863\u4F1A\u8BDD\u5F52\u6863\uFF0C\u4E0D\u53D7\u5F53\u524D\u641C\u7D22\u7B5B\u9009\u5F71\u54CD\u3002\u4E4B\u540E\u53EF\u5728\u201C\u5DF2\u5F52\u6863\u201D\u4E2D\u6062\u590D\u3002","archives.tab.archived":"\u5DF2\u5F52\u6863","archives.tab.unarchived":"\u672A\u5F52\u6863","archives.searchUnarchived":"\u641C\u7D22\u672A\u5F52\u6863\u804A\u5929","archives.emptyUnarchived":"\u6682\u65E0\u672A\u5F52\u6863\u4F1A\u8BDD\u3002","archives.archiveSelected":"\u5F52\u6863","archives.openSession":"\u6253\u5F00","archives.moreActions":"\u66F4\u591A\u64CD\u4F5C","archives.archiveSelectedDesc":"\u5C06\u9009\u4E2D\u7684\u4F1A\u8BDD\u5F52\u6863\uFF0C\u5305\u542B\u5F53\u524D\u7B5B\u9009\u9690\u85CF\u7684\u5DF2\u9009\u9879\u3002\u4E4B\u540E\u53EF\u5728\u201C\u5DF2\u5F52\u6863\u201D\u4E2D\u67E5\u770B\u548C\u6062\u590D\u3002","archives.archiveSuccess":"\u5DF2\u5F52\u6863 {n} \u6761\u4F1A\u8BDD\u3002","archives.archiveBatchFailed":"\u6279\u91CF\u5F52\u6863\u5931\u8D25\uFF1A{detail}","archives.navigationUnavailable":"\u5F53\u524D\u5BBF\u4E3B\u65E0\u6CD5\u4FDD\u6301\u5F52\u6863\u5BF9\u8BDD\uFF0C\u8BF7\u4F7F\u7528\u201C\u6062\u590D\u5E76\u6253\u5F00\u201D\u3002","archives.sessionNotRetained":"\u5BBF\u4E3B\u672A\u4FDD\u7559\u76EE\u6807\u4F1A\u8BDD\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u6216\u6062\u590D\u540E\u518D\u8BD5\u3002","archives.restoreOpen":"\u6062\u590D\u6253\u5F00","archives.selectedCount":"\u5DF2\u9009 {n} \u6761","archives.selectionHiddenHint":"\u542B\u5F53\u524D\u672A\u663E\u793A\u7684 {hidden} \u6761\uFF0C\u4E5F\u5C06\u53C2\u4E0E\u64CD\u4F5C","archives.clearSelectionShort":"\u6E05\u7A7A","archives.restore":"\u6062\u590D","archives.archiveTitle":"\u5F52\u6863 {n} \u4E2A\u804A\u5929\uFF1F","archives.deleteSelectionShort":"\u5220\u9664","archives.clearSelection":"\u6E05\u7A7A\u9009\u62E9","group.ungrouped":"\u672A\u5206\u7EC4","session.new":"\u65B0\u4F1A\u8BDD","menu.deleteSession":"\u5220\u9664\u4F1A\u8BDD","archived.badge":"\u5F52\u6863\u4F1A\u8BDD","archives.title":"\u5F52\u6863\u4F1A\u8BDD","archives.description":"\u7BA1\u7406\u5DF2\u5F52\u6863\u4F1A\u8BDD\uFF0C\u6216\u9009\u62E9\u672A\u5F52\u6863\u4F1A\u8BDD\u8FDB\u884C\u6279\u91CF\u5F52\u6863\u3002","archives.viewProject":"GitHub","archives.feedback":"\u95EE\u9898\u53CD\u9988","archives.empty":"\u6682\u65E0\u5DF2\u5F52\u6863\u4F1A\u8BDD","archives.emptyFiltered":"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u804A\u5929","archives.searchPlaceholder":"\u641C\u7D22\u5DF2\u5F52\u6863\u804A\u5929","archives.sortLabel":"\u6392\u5E8F\u65B9\u5F0F","archives.viewOptions":"\u89C6\u56FE\u9009\u9879","archives.sortArchived":"\u6700\u8FD1\u5F52\u6863","archives.sortUpdated":"\u66F4\u65B0\u65F6\u95F4","archives.sortCreated":"\u521B\u5EFA\u65F6\u95F4","archives.sortAlphabetical":"\u6309\u5B57\u6BCD\u987A\u5E8F","archives.projectFilter":"\u6309\u9879\u76EE\u7B5B\u9009","archives.allProjects":"\u6240\u6709\u9879\u76EE","discovery.timeRange":"\u65F6\u95F4\u8303\u56F4","organizer.allChats":"\u5168\u90E8\u804A\u5929","archives.sessionCount":"{n} \u4E2A\u804A\u5929","archives.selectAllFiltered":"\u5168\u9009\u5F53\u524D\u7B5B\u9009\u7ED3\u679C","archives.selectSession":"\u9009\u62E9\u4F1A\u8BDD\u201C{name}\u201D","archives.restoreSelected":"\u6062\u590D\u6240\u9009","archives.deleteSelected":"\u5220\u9664\u6240\u9009","archives.timestamp":"{date}\uFF0C{time}","archives.restoreProject":"\u6062\u590D\u9879\u76EE\u5168\u90E8\u804A\u5929","archives.restoreUngrouped":"\u5168\u90E8\u6062\u590D","archives.deleteProject":"\u5220\u9664\u9879\u76EE\u5168\u90E8\u804A\u5929","archives.deleteUngrouped":"\u5168\u90E8\u5220\u9664","archives.projectActions":"\u9879\u76EE\u201C{name}\u201D\u7684\u5F52\u6863\u64CD\u4F5C","archives.ungroupedActions":"\u672A\u5206\u7EC4\u804A\u5929\u7684\u5F52\u6863\u64CD\u4F5C","archives.restoreSuccess":"\u5DF2\u6062\u590D {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u3002","archives.restoreBatchFailed":"\u6279\u91CF\u6062\u590D\u5931\u8D25\uFF1A{detail}","archives.deleteSelectedTitle":"\u5220\u9664\u6240\u9009\u5DF2\u5F52\u6863\u804A\u5929","archives.deleteSelectedDesc":"\u5C06\u6C38\u4E45\u5220\u9664\u6240\u9009\u7684 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u53CA\u5176\u5B50\u4EE3\u7406\uFF08\u542B\u6B63\u5728\u8FD0\u884C\u7684\uFF09\u548C\u8BB0\u5F55\u3002\u5176\u4ED6\u804A\u5929\u4E0D\u4F1A\u53D7\u5F71\u54CD\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","archives.deleteSelectedConfirm":"\u5220\u9664\u6240\u9009\u804A\u5929","archives.deleteProjectTitle":"\u5220\u9664\u201C{name}\u201D\u4E2D\u7684\u5DF2\u5F52\u6863\u804A\u5929","archives.deleteProjectDesc":"\u5C06\u6C38\u4E45\u5220\u9664\u201C{name}\u201D\u4E2D\u7684 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u53CA\u5176\u5B50\u4EE3\u7406\u548C\u8BB0\u5F55\u3002\u9879\u76EE\u76EE\u5F55\u548C\u672A\u5F52\u6863\u804A\u5929\u4E0D\u4F1A\u53D7\u5F71\u54CD\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","archives.deleteProjectConfirm":"\u5220\u9664\u9879\u76EE\u5168\u90E8\u804A\u5929","archives.deleteUngroupedTitle":"\u5220\u9664\u672A\u5206\u7EC4\u7684\u5DF2\u5F52\u6863\u804A\u5929","archives.deleteUngroupedDesc":"\u5C06\u6C38\u4E45\u5220\u9664\u672A\u5206\u7EC4\u4E2D\u7684 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u53CA\u5176\u5B50\u4EE3\u7406\u548C\u8BB0\u5F55\u3002\u5176\u4ED6\u9879\u76EE\u548C\u672A\u5F52\u6863\u804A\u5929\u4E0D\u4F1A\u53D7\u5F71\u54CD\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","archives.deleteUngroupedConfirm":"\u5220\u9664\u672A\u5206\u7EC4\u7684\u5168\u90E8\u804A\u5929","archives.deleteBatchPending":"\u6B63\u5728\u5220\u9664\u5DF2\u5F52\u6863\u804A\u5929\u2026","archives.deleteSuccess":"\u5DF2\u5220\u9664 {n} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\u3002","archives.deleteSuccessWithSkipped":"\u5DF2\u5220\u9664 {deleted} \u4E2A\u5DF2\u5F52\u6863\u804A\u5929\uFF1B\u53E6\u6E05\u7406 {skipped} \u4E2A\u5DF2\u4E0D\u5B58\u5728\u4F1A\u8BDD\u7684\u5F52\u6863\u8BB0\u5F55\u3002","archives.deleteSkipped":"\u5DF2\u6E05\u7406 {n} \u4E2A\u5DF2\u4E0D\u5B58\u5728\u4F1A\u8BDD\u7684\u5F52\u6863\u8BB0\u5F55\u3002","archives.deletePartial":"\u5DF2\u5220\u9664 {deleted} \u4E2A\u804A\u5929\uFF0C\u6E05\u7406 {skipped} \u4E2A\u5DF2\u4E0D\u5B58\u5728\u4F1A\u8BDD\u7684\u5F52\u6863\u8BB0\u5F55\uFF1B{failed} \u4E2A\u5220\u9664\u5931\u8D25\uFF1A{detail}","archives.unarchiveUnknown":"\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u53D6\u6D88\u5F52\u6863\u3002","archives.unarchiveFailed":"\u53D6\u6D88\u5F52\u6863\u5931\u8D25\uFF1A{detail}","archives.archiveUnknown":"\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u5F52\u6863\u3002","archives.archiveFailed":"\u5F52\u6863\u5931\u8D25\uFF1A{detail}","archives.archiveActive":"\u4F1A\u8BDD\u4ECD\u5728\u8FD0\u884C\uFF08{kinds}\uFF09\u3002","archiveActive.title":"\u505C\u6B62\u5E76\u5F52\u6863","archiveActive.desc":"\u201C{name}\u201D\u4ECD\u6709\u6B63\u5728\u8FDB\u884C\u7684\u5DE5\u4F5C\uFF1A{kinds}\u3002\u5F52\u6863\u524D\u4F1A\u505C\u6B62\u8FD9\u4E9B\u5DE5\u4F5C\u3002","archiveActive.confirm":"\u505C\u6B62\u5E76\u5F52\u6863","archives.forkFailed":"\u5206\u53C9\u4F1A\u8BDD\u5931\u8D25\uFF1A{detail}","deleteSession.title":"\u5220\u9664\u4F1A\u8BDD","deleteSession.confirmTitle":"\u5220\u9664\u4F1A\u8BDD\uFF1F","deleteSession.desc":"\u5C06\u6C38\u4E45\u5220\u9664\u4F1A\u8BDD\u201C{name}\u201D\u53CA\u5176\u5B50\u4EE3\u7406\uFF08\u542B\u6B63\u5728\u8FD0\u884C\u7684\uFF09\u548C\u5168\u90E8\u8BB0\u5F55\uFF08\u5BF9\u8BDD\u5185\u5BB9\u3001\u7EDF\u8BA1\u3001\u7F13\u5B58\uFF09\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","deleteSession.pending":"\u6B63\u5728\u5220\u9664\u4F1A\u8BDD\u2026","deleteSession.unknown":"\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u5220\u9664\u3002","deleteSession.failed":"\u5220\u9664\u4F1A\u8BDD\u5931\u8D25\uFF1A{detail}","menu.archiveWorkspace":"\u5F52\u6863\u4F1A\u8BDD","menu.copyWorkspacePath":"\u590D\u5236\u76EE\u5F55","menu.openInExplorer":"\u6253\u5F00\u76EE\u5F55","menu.moveSession":"\u79FB\u52A8\u5230\u5DE5\u4F5C\u533A","moveSession.noOtherWorkspaces":"\u6682\u65E0\u53EF\u79FB\u52A8\u7684\u5176\u4ED6\u5DE5\u4F5C\u533A","moveSession.success":"\u4F1A\u8BDD\u5DF2\u6210\u529F\u79FB\u52A8\u5230\u201C{name}\u201D","archiveWorkspace.title":"\u5F52\u6863 {n} \u4E2A\u4F1A\u8BDD\uFF1F","archiveWorkspace.desc":"\u8FD9\u4F1A\u5C06\u201C{name}\u201D\u4E2D\u7684\u4F1A\u8BDD\u5F52\u6863\u3002\u4E4B\u540E\u53EF\u4EE5\u5728\u201C\u8BBE\u7F6E \u2192 \u5F52\u6863\u4F1A\u8BDD\u201D\u4E2D\u627E\u5230\u5B83\u4EEC\u3002","archiveWorkspace.confirm":"\u5168\u90E8\u5F52\u6863","archiveWorkspace.pending":"\u6B63\u5728\u5F52\u6863\u4F1A\u8BDD\u2026","date.ymd":"{y}\u5E74{m}\u6708{d}\u65E5"},Gr={...$a,...ka,"locale.language":"en","service.unavailable":"The service is not ready. Please retry.","common.close":"Close","entry.location.title":"Entry placement","entry.location.desc":"Choose where to show the entry (at least one is retained to avoid losing access).","entry.location.both":"Both","entry.location.sidebar":"Sidebar only","entry.location.settings":"Settings only","entry.location.saveFailed":"Failed to save entry location. Please check your network or restart the host.","sidebar.favoriteStar.title":"Sidebar favorite star","sidebar.favoriteStar.desc":"Show favorite star on session rows in the sidebar. When disabled, the star is hidden while menu actions and filters stay available.","sidebar.favoriteStar.toggle":"Toggle sidebar favorite star","update.entry.title":"Online updates","update.entry.desc":"Allow checking and installing new versions online. Hides the update entry when disabled.","update.entry.toggle":"Toggle online updates","update.entry.locked":"Online updates are disabled by the host configuration.","archives.moreActions":"More actions","archives.archiveProject":"Archive all chats in this project","archives.archiveUngrouped":"Archive all ungrouped chats","archives.archiveProjectDesc":"Archive all {n} unarchived sessions in \u201C{name}\u201D, regardless of the current search filter. You can restore them in Archived.","archives.archiveUngroupedDesc":"Archive all {n} ungrouped, unarchived sessions, regardless of the current search filter. You can restore them in Archived.","archives.tab.archived":"Archived","archives.tab.unarchived":"Unarchived","archives.searchUnarchived":"Search unarchived chats","archives.emptyUnarchived":"No unarchived sessions.","archives.archiveSelected":"Archive","archives.openSession":"Open session","archives.archiveSelectedDesc":"Archive the selected sessions, including selections hidden by the current filter. You can view and restore them in Archived.","archives.archiveSuccess":"Archived {n} sessions.","archives.archiveBatchFailed":"Batch archive failed: {detail}","archives.navigationUnavailable":"This host cannot keep the conversation archived while opening it. Use \u201CRestore and open\u201D instead.","archives.sessionNotRetained":"The host did not keep the requested conversation open. Try again, or restore it before opening.","archives.restoreOpen":"Restore and open","archives.selectedCount":"{n} selected","archives.selectionHiddenHint":"Includes {hidden} hidden by the current filter; actions apply to them too.","archives.clearSelectionShort":"Clear","archives.restore":"Restore","archives.archiveTitle":"Archive {n} chats?","archives.deleteSelectionShort":"Delete","archives.clearSelection":"Clear selection","group.ungrouped":"Ungrouped","session.new":"New Session","menu.deleteSession":"Delete session","archived.badge":"Archived sessions","archives.title":"Archived sessions","archives.description":"Manage archived sessions or select unarchived sessions to archive in bulk.","archives.viewProject":"GitHub","archives.feedback":"Issues","archives.empty":"No archived sessions.","archives.emptyFiltered":"No chats match your filters.","archives.searchPlaceholder":"Search archived chats","archives.sortLabel":"Sort order","archives.viewOptions":"View options","archives.sortArchived":"Recently archived","archives.sortUpdated":"Last updated","archives.sortCreated":"Created","archives.sortAlphabetical":"Alphabetical","archives.projectFilter":"Filter by project","archives.allProjects":"All projects","discovery.timeRange":"Date range","organizer.allChats":"All chats","archives.sessionCount":"{n} chats","archives.selectAllFiltered":"Select all results","archives.selectSession":"Select chat {name}","archives.restoreSelected":"Restore selected","archives.deleteSelected":"Delete selected","archives.timestamp":"{date}, {time}","archives.restoreProject":"Restore all chats in this project","archives.restoreUngrouped":"Restore all","archives.deleteProject":"Delete all chats in this project","archives.deleteUngrouped":"Delete all","archives.projectActions":"Archive actions for project {name}","archives.ungroupedActions":"Archive actions for ungrouped chats","archives.restoreSuccess":"Restored {n} archived chats.","archives.restoreBatchFailed":"Could not restore the archived chats: {detail}","archives.deleteSelectedTitle":"Delete selected archived chats","archives.deleteSelectedDesc":"This permanently deletes the selected {n} archived chats, their child agents (including any that are still running), and their records. Other chats are not affected. This cannot be undone.","archives.deleteSelectedConfirm":"Delete selected chats","archives.deleteProjectTitle":"Delete archived chats in {name}","archives.deleteProjectDesc":"This permanently deletes the {n} archived chats in {name}, their child agents, and their records. The project directory and unarchived chats are not affected. This cannot be undone.","archives.deleteProjectConfirm":"Delete all project chats","archives.deleteUngroupedTitle":"Delete ungrouped archived chats","archives.deleteUngroupedDesc":"This permanently deletes the {n} ungrouped archived chats, their child agents, and their records. Other projects and unarchived chats are not affected. This cannot be undone.","archives.deleteUngroupedConfirm":"Delete all ungrouped chats","archives.deleteBatchPending":"Deleting archived chats\u2026","archives.deleteSuccess":"Deleted {n} archived chats.","archives.deleteSuccessWithSkipped":"Deleted {deleted} archived chats and cleared {skipped} stale archive entries for sessions that no longer exist.","archives.deleteSkipped":"Cleared {n} stale archive entries for sessions that no longer exist.","archives.deletePartial":"Deleted {deleted} chats and cleared {skipped} stale archive entries; {failed} could not be deleted: {detail}","archives.unarchiveUnknown":"This session no longer exists, so it cannot be unarchived.","archives.unarchiveFailed":"Could not unarchive the session: {detail}","archives.archiveUnknown":"This session no longer exists, so it cannot be archived.","archives.archiveFailed":"Could not archive the session: {detail}","archives.archiveActive":"This conversation is still running ({kinds}).","archiveActive.title":"Stop and archive","archiveActive.desc":"\u201C{name}\u201D still has work in progress: {kinds}. Archiving stops that work first.","archiveActive.confirm":"Stop and archive","archives.forkFailed":"Could not fork the session: {detail}","deleteSession.title":"Delete session","deleteSession.confirmTitle":"Delete session?","deleteSession.desc":"This permanently deletes session \u201C{name}\u201D, its child agents (including any that are still running), and all of its records (conversation, stats, cache). This cannot be undone.","deleteSession.pending":"Deleting session\u2026","deleteSession.unknown":"This session no longer exists or was already deleted.","deleteSession.failed":"Could not delete the session: {detail}","menu.archiveWorkspace":"Archive sessions","menu.copyWorkspacePath":"Copy folder path","menu.openInExplorer":"Open folder","menu.moveSession":"Move to workspace","moveSession.noOtherWorkspaces":"No other workspaces available","moveSession.success":"Session successfully moved to \u201C{name}\u201D","archiveWorkspace.title":"Archive {n} conversations?","archiveWorkspace.desc":"This archives all conversations in \u201C{name}\u201D. You can find them later in Archived sessions.","archiveWorkspace.confirm":"Archive all","archiveWorkspace.pending":"Archiving conversations\u2026","date.ymd":"{y}-{m}-{d}"},Ss={...Ga,...Ca,"locale.language":"ru","service.unavailable":"\u0421\u0435\u0440\u0432\u0438\u0441 \u0435\u0449\u0451 \u043D\u0435 \u0433\u043E\u0442\u043E\u0432. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435.","common.close":"\u0417\u0430\u043A\u0440\u044B\u0442\u044C","entry.location.title":"\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u0443\u043D\u043A\u0442\u0430","entry.location.desc":"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435, \u0433\u0434\u0435 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C \u043F\u0443\u043D\u043A\u0442 \u0432\u0445\u043E\u0434\u0430 (\u0445\u043E\u0442\u044F \u0431\u044B \u043E\u0434\u0438\u043D \u043E\u0441\u0442\u0430\u0435\u0442\u0441\u044F \u0430\u043A\u0442\u0438\u0432\u043D\u044B\u043C).","entry.location.both":"\u041E\u0431\u0430 \u043C\u0435\u0441\u0442\u0430","entry.location.sidebar":"\u0422\u043E\u043B\u044C\u043A\u043E \u0431\u043E\u043A\u043E\u0432\u0430\u044F \u043F\u0430\u043D\u0435\u043B\u044C","entry.location.settings":"\u0422\u043E\u043B\u044C\u043A\u043E \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438","entry.location.saveFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0440\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u043F\u0443\u043D\u043A\u0442\u0430. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0441\u0435\u0442\u044C \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0435 \u0445\u043E\u0441\u0442.","sidebar.favoriteStar.title":"\u0417\u0432\u0435\u0437\u0434\u0430 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","sidebar.favoriteStar.desc":"\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C \u0437\u0432\u0435\u0437\u0434\u0443 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0443 \u0441\u0442\u0440\u043E\u043A \u0441\u0435\u0441\u0441\u0438\u0439 \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438. \u041F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438 \u0437\u043D\u0430\u0447\u043E\u043A \u0441\u043A\u0440\u044B\u0432\u0430\u0435\u0442\u0441\u044F, \u0430 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043C\u0435\u043D\u044E \u0438 \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u0446\u0438\u044F \u043E\u0441\u0442\u0430\u044E\u0442\u0441\u044F \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u043C\u0438.","sidebar.favoriteStar.toggle":"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0437\u0432\u0435\u0437\u0434\u0443 \u0438\u0437\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0432 \u0431\u043E\u043A\u043E\u0432\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438","update.entry.title":"\u041E\u043D\u043B\u0430\u0439\u043D-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435","update.entry.desc":"\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0443 \u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0439 \u043E\u043D\u043B\u0430\u0439\u043D. \u0421\u043A\u0440\u044B\u0432\u0430\u0435\u0442 \u043F\u0443\u043D\u043A\u0442 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043F\u0440\u0438 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0438.","update.entry.toggle":"\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043E\u043D\u043B\u0430\u0439\u043D-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435","update.entry.locked":"\u041E\u043D\u043B\u0430\u0439\u043D-\u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E \u043A\u043E\u043D\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0445\u043E\u0441\u0442\u0430.","archives.moreActions":"\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E","archives.archiveProject":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.archiveUngrouped":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.archiveProjectDesc":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 {n} \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439 \u0432 \xAB{name}\xBB, \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0444\u0438\u043B\u044C\u0442\u0440\u0430 \u043F\u043E\u0438\u0441\u043A\u0430. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archives.archiveUngroupedDesc":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435 {n} \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439, \u043D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E \u043E\u0442 \u0442\u0435\u043A\u0443\u0449\u0435\u0433\u043E \u0444\u0438\u043B\u044C\u0442\u0440\u0430 \u043F\u043E\u0438\u0441\u043A\u0430. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archives.tab.archived":"\u0410\u0440\u0445\u0438\u0432","archives.tab.unarchived":"\u041D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435","archives.searchUnarchived":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u043C \u0447\u0430\u0442\u0430\u043C","archives.emptyUnarchived":"\u041D\u0435\u0442 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.archiveSelected":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C","archives.openSession":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E","archives.archiveSelectedDesc":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0441\u0435\u0441\u0441\u0438\u0438, \u0432\u043A\u043B\u044E\u0447\u0430\u044F \u0441\u043A\u0440\u044B\u0442\u044B\u0435 \u0442\u0435\u043A\u0443\u0449\u0438\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u043C. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0438 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archives.archiveSuccess":"\u0417\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043E \u0441\u0435\u0441\u0441\u0438\u0439: {n}.","archives.archiveBatchFailed":"\u041F\u0430\u043A\u0435\u0442\u043D\u0430\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F \u043D\u0435 \u0443\u0434\u0430\u043B\u0430\u0441\u044C: {detail}","archives.navigationUnavailable":"\u042D\u0442\u043E\u0442 \u0445\u043E\u0441\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0434\u0435\u0440\u0436\u0430\u0442\u044C \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0432 \u0430\u0440\u0445\u0438\u0432\u0435 \u043F\u0440\u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0438. \u0412\u043C\u0435\u0441\u0442\u043E \u044D\u0442\u043E\u0433\u043E \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \xAB\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u044C\xBB.","archives.sessionNotRetained":"\u0425\u043E\u0441\u0442 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u043B \u0437\u0430\u043F\u0440\u043E\u0448\u0435\u043D\u043D\u044B\u0439 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u043C. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u0438\u043B\u0438 \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u0435\u0433\u043E \u043F\u0435\u0440\u0435\u0434 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u0435\u043C.","archives.restoreOpen":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u043E\u0442\u043A\u0440\u044B\u0442\u044C","archives.selectedCount":"\u0412\u044B\u0431\u0440\u0430\u043D\u043E: {n}","archives.selectionHiddenHint":"\u0412\u043A\u043B\u044E\u0447\u0430\u0435\u0442 {hidden}, \u0441\u043A\u0440\u044B\u0442\u044B\u0445 \u0442\u0435\u043A\u0443\u0449\u0438\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u043C; \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u043F\u0440\u0438\u043C\u0435\u043D\u044F\u044E\u0442\u0441\u044F \u0438 \u043A \u043D\u0438\u043C.","archives.clearSelectionShort":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C","archives.restore":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C","archives.archiveTitle":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C {n} \u0447\u0430\u0442\u043E\u0432?","archives.deleteSelectionShort":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C","archives.clearSelection":"\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u044B\u0431\u043E\u0440","group.ungrouped":"\u0411\u0435\u0437 \u0433\u0440\u0443\u043F\u043F\u044B","session.new":"\u041D\u043E\u0432\u0430\u044F \u0441\u0435\u0441\u0441\u0438\u044F","menu.deleteSession":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E","archived.badge":"\u0410\u0440\u0445\u0438\u0432 \u0441\u0435\u0441\u0441\u0438\u0439","archives.title":"\u0410\u0440\u0445\u0438\u0432 \u0441\u0435\u0441\u0441\u0438\u0439","archives.description":"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u043C\u0438 \u0441\u0435\u0441\u0441\u0438\u044F\u043C\u0438 \u0438\u043B\u0438 \u0432\u044B\u0431\u043E\u0440 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0434\u043B\u044F \u043F\u0430\u043A\u0435\u0442\u043D\u043E\u0439 \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438.","archives.viewProject":"GitHub","archives.feedback":"\u041F\u0440\u043E\u0431\u043B\u0435\u043C\u044B","archives.empty":"\u041D\u0435\u0442 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.emptyFiltered":"\u041D\u0438 \u043E\u0434\u0438\u043D \u0447\u0430\u0442 \u043D\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0430\u0448\u0438\u043C \u0444\u0438\u043B\u044C\u0442\u0440\u0430\u043C.","archives.searchPlaceholder":"\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u043C \u0447\u0430\u0442\u0430\u043C","archives.sortLabel":"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u043A\u0430","archives.viewOptions":"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B \u0432\u0438\u0434\u0430","archives.sortArchived":"\u041D\u0435\u0434\u0430\u0432\u043D\u043E \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435","archives.sortUpdated":"\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435","archives.sortCreated":"\u0414\u0430\u0442\u0430 \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F","archives.sortAlphabetical":"\u041F\u043E \u0430\u043B\u0444\u0430\u0432\u0438\u0442\u0443","archives.projectFilter":"\u0424\u0438\u043B\u044C\u0442\u0440 \u043F\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0443","archives.allProjects":"\u0412\u0441\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B","discovery.timeRange":"\u041F\u0435\u0440\u0438\u043E\u0434","organizer.allChats":"\u0412\u0441\u0435 \u0447\u0430\u0442\u044B","archives.sessionCount":"{n} \u0447\u0430\u0442\u043E\u0432","archives.selectAllFiltered":"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442\u044B","archives.selectSession":"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0447\u0430\u0442 {name}","archives.restoreSelected":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435","archives.deleteSelected":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435","archives.timestamp":"{date}, {time}","archives.restoreProject":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.restoreUngrouped":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u0441\u0435","archives.deleteProject":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u044D\u0442\u043E\u0433\u043E \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.deleteUngrouped":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435","archives.projectActions":"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u043F\u0440\u043E\u0435\u043A\u0442\u0430 {name}","archives.ungroupedActions":"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0430\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432","archives.restoreSuccess":"\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432: {n}.","archives.restoreBatchFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B: {detail}","archives.deleteSelectedTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteSelectedDesc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 {n} \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432, \u0438\u0445 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B (\u0432\u043A\u043B\u044E\u0447\u0430\u044F \u0435\u0449\u0451 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0435) \u0438 \u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0438. \u0414\u0440\u0443\u0433\u0438\u0435 \u0447\u0430\u0442\u044B \u043D\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","archives.deleteSelectedConfirm":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteProjectTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B \u0432 {name}","archives.deleteProjectDesc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 {n} \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432 \u0432 {name}, \u0438\u0445 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B \u0438 \u0437\u0430\u043F\u0438\u0441\u0438. \u041A\u0430\u0442\u0430\u043B\u043E\u0433 \u043F\u0440\u043E\u0435\u043A\u0442\u0430 \u0438 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B \u043D\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","archives.deleteProjectConfirm":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0447\u0430\u0442\u044B \u043F\u0440\u043E\u0435\u043A\u0442\u0430","archives.deleteUngroupedTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteUngroupedDesc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 {n} \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432, \u0438\u0445 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B \u0438 \u0437\u0430\u043F\u0438\u0441\u0438. \u0414\u0440\u0443\u0433\u0438\u0435 \u043F\u0440\u043E\u0435\u043A\u0442\u044B \u0438 \u043D\u0435\u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B \u043D\u0435 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044E\u0442\u0441\u044F. \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","archives.deleteUngroupedConfirm":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u043D\u0435\u0441\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0447\u0430\u0442\u044B","archives.deleteBatchPending":"\u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432\u2026","archives.deleteSuccess":"\u0423\u0434\u0430\u043B\u0435\u043D\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432: {n}.","archives.deleteSuccessWithSkipped":"\u0423\u0434\u0430\u043B\u0435\u043D\u043E {deleted} \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0447\u0430\u0442\u043E\u0432 \u0438 \u043E\u0447\u0438\u0449\u0435\u043D\u043E {skipped} \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u0434\u043B\u044F \u043D\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.deleteSkipped":"\u041E\u0447\u0438\u0449\u0435\u043D\u043E {n} \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430 \u0434\u043B\u044F \u043D\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0445 \u0441\u0435\u0441\u0441\u0438\u0439.","archives.deletePartial":"\u0423\u0434\u0430\u043B\u0435\u043D\u043E {deleted} \u0447\u0430\u0442\u043E\u0432 \u0438 \u043E\u0447\u0438\u0449\u0435\u043D\u043E {skipped} \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0445 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u0430\u0440\u0445\u0438\u0432\u0430; {failed} \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0443\u0434\u0430\u043B\u0438\u0442\u044C: {detail}","archives.unarchiveUnknown":"\u042D\u0442\u0430 \u0441\u0435\u0441\u0441\u0438\u044F \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0435\u0451 \u043D\u0435\u043B\u044C\u0437\u044F \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430.","archives.unarchiveFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u0435\u0440\u043D\u0443\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430: {detail}","archives.archiveUnknown":"\u042D\u0442\u0430 \u0441\u0435\u0441\u0441\u0438\u044F \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0435\u0451 \u043D\u0435\u043B\u044C\u0437\u044F \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C.","archives.archiveFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E: {detail}","archives.archiveActive":"\u042D\u0442\u043E\u0442 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0435\u0442\u0441\u044F ({kinds}).","archiveActive.title":"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C","archiveActive.desc":"\u0412 \xAB{name}\xBB \u0435\u0449\u0451 \u0438\u0434\u0451\u0442 \u0440\u0430\u0431\u043E\u0442\u0430: {kinds}. \u0410\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442 \u0435\u0451.","archiveActive.confirm":"\u041E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0438 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C","archives.forkFailed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u0432\u0435\u0442\u043A\u0443 \u0441\u0435\u0441\u0441\u0438\u0438: {detail}","deleteSession.title":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E","deleteSession.confirmTitle":"\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E?","deleteSession.desc":"\u042D\u0442\u043E \u043E\u043A\u043E\u043D\u0447\u0430\u0442\u0435\u043B\u044C\u043D\u043E \u0443\u0434\u0430\u043B\u0438\u0442 \u0441\u0435\u0441\u0441\u0438\u044E \xAB{name}\xBB, \u0435\u0451 \u0434\u043E\u0447\u0435\u0440\u043D\u0438\u0435 \u0430\u0433\u0435\u043D\u0442\u044B (\u0432\u043A\u043B\u044E\u0447\u0430\u044F \u0435\u0449\u0451 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0435) \u0438 \u0432\u0441\u0435 \u0435\u0451 \u0437\u0430\u043F\u0438\u0441\u0438 (\u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0443, \u043A\u044D\u0448). \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043E\u0431\u0440\u0430\u0442\u0438\u043C\u043E.","deleteSession.pending":"\u0423\u0434\u0430\u043B\u0435\u043D\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438\u2026","deleteSession.unknown":"\u042D\u0442\u0430 \u0441\u0435\u0441\u0441\u0438\u044F \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u043B\u0438 \u0443\u0436\u0435 \u0443\u0434\u0430\u043B\u0435\u043D\u0430.","deleteSession.failed":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u044E: {detail}","menu.archiveWorkspace":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u0435\u0441\u0441\u0438\u0438","menu.copyWorkspacePath":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0443\u0442\u044C \u043A \u043F\u0430\u043F\u043A\u0435","menu.openInExplorer":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u043F\u043A\u0443","menu.moveSession":"\u041F\u0435\u0440\u0435\u043C\u0435\u0441\u0442\u0438\u0442\u044C \u0432 \u043F\u0440\u043E\u0435\u043A\u0442","moveSession.noOtherWorkspaces":"\u041D\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432","moveSession.success":"\u0421\u0435\u0441\u0441\u0438\u044F \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0430 \u0432 \xAB{name}\xBB","archiveWorkspace.title":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C {n} \u0441\u0435\u0441\u0441\u0438\u0439?","archiveWorkspace.desc":"\u042D\u0442\u043E \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \xAB{name}\xBB. \u0418\u0445 \u043C\u043E\u0436\u043D\u043E \u043D\u0430\u0439\u0442\u0438 \u043F\u043E\u0437\u0436\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043B\u0435 \xAB\u0410\u0440\u0445\u0438\u0432\xBB.","archiveWorkspace.confirm":"\u0410\u0440\u0445\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0441\u0435","archiveWorkspace.pending":"\u0410\u0440\u0445\u0438\u0432\u0430\u0446\u0438\u044F \u0441\u0435\u0441\u0441\u0438\u0439\u2026","date.ymd":"{y}-{m}-{d}"},De="archive-manager-workspace",xs=["slots","sessions","workspaces","locale","remote","typert"];function tr(n){return{getSnapshot:n.getSnapshot.bind(n),subscribe:n.subscribe.bind(n)}}e(tr,"bindObservable");function Kr(n){return async s=>{if(typeof n?.unarchiveSession!="function")throw new Error("archive-manager: host unarchiveSession is unavailable");await n.unarchiveSession(s)}}e(Kr,"createUnarchiveSession");async function nr(n,s,l){let h=new Set(n.list?.getSnapshot?.()?.archivedSessionIds??[]),v=await Kn(s,async C=>{try{await n.archiveSession(C)}catch(E){throw E!==null&&typeof E=="object"&&Pn(E)!==void 0&&typeof le(E).sessionId!="string"&&Object.assign(E,{sessionId:C}),E}return!0},{refresh:l}),m=[...n.list?.getSnapshot?.()?.archivedSessionIds??[]];return{archivedSessionIds:m,archivedSessionIdsAdded:m.filter(C=>!h.has(C)),failures:v.failures}}e(nr,"archiveSessionsViaOfficial");async function Yr(n,s,l,h){let v=new Set(n.list?.getSnapshot?.()?.archivedSessionIds??[]),m=typeof h=="function"?h:N=>n.unarchiveSession?.(N),C=await Kn(s,async N=>(await m(N),!0),{refresh:l}),E=[...n.list?.getSnapshot?.()?.archivedSessionIds??[]];return{archivedSessionIds:E,unarchivedSessionIds:[...v].filter(N=>!E.includes(N)),failures:C.failures}}e(Yr,"unarchiveSessionsViaOfficial");function Zr({triggerRect:n,viewport:s,itemCount:l,measuredHeight:h}){let v=s.width,m=s.height,C=220,E=Math.max(140,m-20),N=Math.min(360,E),B=l===0?44:34*l+8,_=Math.min(N,Math.max(20,typeof h=="number"&&h>0?h:B)),P=n.right+2;P+C>v-10&&(P=Math.max(10,n.left-C-4));let H=n.top-4;if(H+_>m-10){let u=n.bottom+4-_;u>=10?H=u:H=Math.max(10,m-_-10)}return H<10&&(H=10),{top:H,left:P,maxHeight:N}}e(Zr,"computeSubmenuPosition");async function ks(n){Cs(n);let s=n.get("remote"),l=e(()=>{},"disposeRemote");return s!==void 0&&(l=await s.$mount(mt)),async()=>{await l()}}e(ks,"apply");function Cs(n){n.effect(()=>n.locale.register(De,{zh:$r,en:Gr,ru:Ss}),"dsh-archive-manager: dictionaries");let s=e(()=>n.get("uiWorkspace"),"uiWorkspaceAt"),l={},h,v=e(p=>(h=Ra(p,n.sessions,n.workspaces,{onOpened:e(()=>n.get("layout")?.selectPanel(null),"onOpened"),beginNavigation:e(()=>n.get("layout")?.beginNavigation?.(),"beginNavigation")}),()=>h?.dispose()),"attachArchiveNavigation");n.effect(()=>v(s()),"archive-manager: explicit archived navigation");let m=e(p=>{if(h===void 0)throw new Kt("navigationUnavailable");return Dr.request(p),h.open(p)},"openConversation"),C=e(async p=>{n.get("layout")?.beginNavigation?.(),Dr.request(p)},"focusSessionWorkspace"),E=e(async(p,b)=>{let I=await n.sessions.search(p,b);if(!I.ok)throw new Error(I.error.message);return I.value},"searchSessions"),N=e(async()=>{if(typeof n.sessions.refresh!="function")return null;try{return await Ce(),null}catch(p){return console.warn("archive-manager: restored archived sessions but session list refresh failed:",p),p instanceof Error?p.message:String(p)}},"refreshSessionList"),B=Kr(n.workspaces),_=e(async(p,...b)=>{let I=n.get("remote.workspaceRegistry");if(!I||typeof I[p]!="function")throw new Error(n.locale.bind(De)("service.unavailable"));let ge=await I[p].apply(I,b);if(!ge.ok)throw new Error(ge.error.message);return ge.value},"registryCall"),P=e(()=>_("diagnoseOrphanSubagents"),"diagnoseOrphanSubagents"),H=e(()=>_("diagnoseSessionCaches"),"diagnoseSessionCaches"),u=e(p=>_("rebuildSessionCaches",p),"rebuildSessionCaches"),Ce=e(async()=>{if(typeof n.sessions.refresh!="function")throw new Error("Official session list refresh is unavailable");let p=await n.sessions.refresh(),b=n.sessions,I=b.manager;if(I?.listState==="error"&&I.listError)throw new Error(Fe(I.listError));if(b.listState==="error"&&b.listError)throw new Error(Fe(b.listError));let Y=b.list?.getSnapshot?.();if(Y?.state==="error"&&Y.error)throw new Error(Fe(Y.error));if(p&&typeof p=="object"&&"ok"in p&&p.ok===!1)throw new Error(Fe(p.error??"Session list refresh failed"))},"refreshCacheLists"),Me=e((p={})=>_("cleanOrphanSubagents",p??{}),"cleanOrphanSubagents"),fe=e(p=>_("searchArchivedContent",p),"searchArchivedContent"),Ct=e(p=>_("searchSessionContent",p),"searchSessionContent"),lt=e(p=>_("previewArchivedSession",p),"previewArchivedSession"),at=e(()=>_("favoriteSessions"),"favoriteSessions"),sn=e(p=>_("setSessionFavorite",p),"setSessionFavorite"),gt=Cr();gt.bind({favoriteSessions:at,setSessionFavorite:sn});let Ve,on=kr(n,gt,()=>n.locale.bind(De),()=>Ve?.isSidebarFavoriteStarEnabled()??!0);n.effect(()=>()=>on.dispose(),"archive-manager: favorites only filter");let Et=Wa({workspaces:n.workspaces.list,sessions:n.sessions.list,archive:e(p=>n.workspaces.archiveSession(p),"archive"),restore:e(async p=>{await B(p)},"restore"),deleteOne:e(async p=>{let b=n.get("remote.workspaceRegistry");if(!b)throw new Error(n.locale.bind(De)("service.unavailable"));let I=await b.deleteSession(p);if(!I.ok)throw new Error(I.error.message)},"deleteOne"),getFavorites:at,refresh:e(()=>n.sessions.refresh?.(),"refresh"),currentSessionId:Gn}),_t=e(async p=>{await B(p),await N()},"unarchiveSession"),V=e(async p=>{let b=n.get("remote.workspaceRegistry");if(b===void 0)throw new Error("archive-manager remote service is unavailable");let I=await b.deleteSession(p);if(!I.ok)throw new Error(I.error.message);await N()},"deleteSession"),Re=e(async(p,b)=>{let I=n.get("remote.workspaceRegistry");if(I===void 0)throw new Error("archive-manager remote service is unavailable");let Y=await I.moveSessionToWorkspace({sessionId:p,targetWorkspaceId:b});if(!Y.ok)throw new Error(Y.error?.message||"move failed");return await N(),Y.value},"moveSession"),te=e(async p=>nr(n.workspaces,p,N),"archiveSessions"),J=e(async p=>{let b=n.workspaces.list?.getSnapshot?.()??{archivedSessionIds:[],items:[]},I=vn(b.archivedSessionIds,b.items,p);return Yr(n.workspaces,I,N,B)},"unarchiveSessions"),Le=e(async p=>{let b=n.get("remote.workspaceRegistry");if(b===void 0)throw new Error("archive-manager remote service is unavailable");let I=await b.deleteArchivedSessions(p);if(!I.ok)throw new Error(I.error.message);let Y=await N();return{...I.value,refreshError:Y}},"deleteArchivedSessions"),et=e(async()=>{let p=n.get("remote.workspaceRegistry");if(p===void 0)throw new Error("archive-manager remote service is unavailable");let b=await p.archivedSessionMetadata();if(!b.ok)throw new Error(b.error.message);return b.value},"archivedSessionMetadata"),M="sidebar.workspaces.session.menu.item",Ie=null,Se=new Set,$e=e(p=>{Ie=p;for(let b of Se)b()},"publishDeleteTarget");function ct(){return o.useSyncExternalStore(p=>(Se.add(p),()=>{Se.delete(p)}),()=>Ie,()=>Ie)}e(ct,"useDeleteRequest");function Ze({sessionId:p,displayTitle:b,useMenuOpenState:I,t:Y}){let[,ge]=I(),se=c.MenuItemButton,xe=(0,a.jsx)(c.IconTrashOutlineRegular,{size:14}),Ee=e(()=>{ge(!1),$e({sessionId:p,title:b})},"onSelect");return typeof se=="function"?(0,a.jsx)(se,{danger:!0,icon:xe,onSelect:Ee,children:Y("menu.deleteSession")}):(0,a.jsx)("button",{type:"button",role:"menuitem",onClick:Ee,children:Y("menu.deleteSession")})}e(Ze,"DeleteSessionMenuItem");function Mt({sessionId:p,favoriteRow:b,useMenuOpenState:I,t:Y}){let[,ge]=I(),se=(0,o.useSyncExternalStore)(b.subscribe,b.getSnapshot),xe=se.ready&&se.ids.has(p),Ee=e(()=>{ge(!1),b.toggle(p)},"onSelect"),ce=c.MenuItemButton,ze=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:xe?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:re})}),Ne=Y(xe?"organizer.unfavorite":"organizer.favorite");return typeof ce=="function"?(0,a.jsx)(ce,{icon:ze,onSelect:Ee,children:Ne}):(0,a.jsx)("button",{type:"button",role:"menuitem",onClick:Ee,children:Ne})}e(Mt,"FavoriteMenuItem");let Ot=null,Zt=new Set;function Rt(p,b="success"){Ot={text:p,tone:b,seq:Date.now()};for(let I of Zt)I()}e(Rt,"showToast");function Te(){let p=o.useSyncExternalStore(I=>(Zt.add(I),()=>{Zt.delete(I)}),()=>Ot,()=>Ot);if(!p)return null;let b=c.Toast;return typeof b=="function"?(0,a.jsx)(b,{key:p.seq,text:p.text,tone:p.tone,holdMs:3e3,onDone:e(()=>{if(Ot?.seq===p.seq){Ot=null;for(let I of Zt)I()}},"onDone")}):(0,a.jsx)("div",{key:p.seq,style:{position:"fixed",top:16,left:"50%",transform:"translateX(-50%)",zIndex:99999,padding:"8px 16px",borderRadius:8,background:p.tone==="danger"?"#7f1d1d":"#14532d",color:"#fff",fontSize:13,boxShadow:"0 4px 16px rgba(0,0,0,0.4)"},children:p.text})}e(Te,"GlobalToastOverlay");function Wt({sessionId:p,displayTitle:b,useMenuOpenState:I,t:Y}){let[,ge]=I(),[se,xe]=o.useState(!1),[Ee,ce]=o.useState(null),[ze,Ne]=o.useState(!1),tt=o.useRef(null),Je=o.useRef(null),Z=o.useRef(null),F=n.workspaces.list?.getSnapshot?.()?.items??[],L=c.MenuItemButton,oe=e(G=>{if(!tt.current)return;let Ae=tt.current.getBoundingClientRect(),qe=typeof window<"u"?window.innerWidth:1024,Xe=typeof window<"u"?window.innerHeight:768,nt=Zr({triggerRect:Ae,viewport:{width:qe,height:Xe},itemCount:F.length,measuredHeight:G});ce(be=>be&&be.top===nt.top&&be.left===nt.left&&be.maxHeight===nt.maxHeight?be:nt)},"updatePosition"),ve=e(()=>{Z.current&&clearTimeout(Z.current),oe(),xe(!0)},"handleMouseEnter");o.useLayoutEffect(()=>{if(!se||!Je.current)return;let G=Je.current.offsetHeight;G>0&&oe(G)},[se,F.length]);let me=e(()=>{Z.current=setTimeout(()=>{xe(!1)},180)},"handleMouseLeave"),Pe=e(async(G,Ae)=>{if(!ze){Ne(!0),xe(!1),ge(!1);try{await Re(p,G),Rt(Y("moveSession.success",{name:Ae})||`\u4F1A\u8BDD\u5DF2\u6210\u529F\u79FB\u52A8\u5230\u201C${Ae}\u201D`,"success")}catch(qe){let Xe=qe instanceof Error?qe.message:String(qe);console.warn("archive-manager: move session failed",qe),Rt(Xe,"danger")}finally{Ne(!1)}}},"handleSelectWorkspace"),de=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:14,height:14,fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,a.jsx)("path",{d:"M2 3.5C2 2.67157 2.67157 2 3.5 2H6.5L8 4H12.5C13.3284 4 14 4.67157 14 5.5V12.5C14 13.3284 13.3284 14 12.5 14H3.5C2.67157 14 2 13.3284 2 12.5V3.5Z"}),(0,a.jsx)("path",{d:"M8 7.5L10.5 10L8 12.5"}),(0,a.jsx)("path",{d:"M5.5 10H10.5"})]}),We=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,style:{marginLeft:"auto",opacity:.65},children:(0,a.jsx)("path",{d:"M6 3.5L10.5 8L6 12.5"})}),ut=(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",gap:8},children:[(0,a.jsx)("span",{children:Y("menu.moveSession")}),We]}),Oe=typeof L=="function"?(0,a.jsx)(L,{icon:de,onSelect:e(()=>ve(),"onSelect"),children:ut}):(0,a.jsxs)("button",{type:"button",role:"menuitem",onClick:e(()=>ve(),"onClick"),style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"6px 8px",background:"transparent",border:"none",cursor:"pointer",color:"inherit",textAlign:"left"},children:[de,ut]});return(0,a.jsxs)("div",{ref:tt,className:"dsham_moveSessionWrap",onMouseEnter:ve,onMouseLeave:me,children:[Oe,se&&Ee&&typeof document<"u"&&typeof f?.createPortal=="function"&&(0,f.createPortal)((0,a.jsxs)("div",{ref:Je,className:"dsham_moveSubmenu",role:"menu",onPointerDown:e(G=>{G.stopPropagation()},"onPointerDown"),onMouseDown:e(G=>{G.stopPropagation()},"onMouseDown"),onMouseEnter:ve,onMouseLeave:me,style:{top:Ee.top,left:Ee.left,maxHeight:Ee.maxHeight},children:[(0,a.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:-6,width:8},"aria-hidden":!0}),F.length===0?(0,a.jsx)("div",{style:{padding:"8px 10px",fontSize:"12px",color:"var(--dsw-alias-label-tertiary, #888)"},children:Y("moveSession.noOtherWorkspaces")}):F.map(G=>{let Ae=G.title||G.path||G.workspaceId;return(0,a.jsxs)("button",{type:"button",role:"menuitem",className:"dsham_moveSubmenuBtn",disabled:ze,onPointerDown:e(qe=>{qe.preventDefault(),qe.stopPropagation(),Pe(G.workspaceId,Ae)},"onPointerDown"),onClick:e(qe=>{qe.preventDefault(),qe.stopPropagation(),Pe(G.workspaceId,Ae)},"onClick"),children:[(0,a.jsx)("span",{"aria-hidden":!0,style:{display:"inline-flex",flex:"none",marginRight:8},children:(0,a.jsx)(c.IconFolderCloseMedium,{size:14})}),(0,a.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:Ae})]},G.workspaceId)})]}),document.body)]})}e(Wt,"MoveSessionMenuItem");function bn(p){try{let b=document.querySelector(`[data-row-key="session:${CSS.escape(p)}"]`);return b?(b.hasAttribute("tabindex")||(b.setAttribute("tabindex","-1"),b.addEventListener("blur",()=>b.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(b):b.focus(),!0):!1}catch{return!1}}e(bn,"focusSessionRow");function ee({t:p}){let b=ct(),[I,Y]=(0,o.useState)(!1),[ge,se]=(0,o.useState)(null),[xe,Ee]=(0,o.useState)(null),ce=(0,o.useRef)(null),ze=(0,o.useRef)(null),Ne=(0,o.useRef)(null);if((0,o.useLayoutEffect)(()=>{if(b===null||typeof document>"u"){Ee(null);return}let Z=null,F=e(()=>{if(Z&&Z.isConnected)return Z;try{Z=document.querySelector(`[data-row-key="session:${CSS.escape(b.sessionId)}"]`)}catch{Z=null}return Z},"getTargetRow"),L=e(()=>{let ve=ce.current,me=ve?.offsetWidth||290,Pe=ve?.offsetHeight||160,de=8,We=F();if(!We){let Ae=window.innerWidth,qe=window.innerHeight,Xe=Math.max(16,(qe-Pe)/2),nt=Math.max(16,(Ae-me)/2);Ee(be=>be!==null&&be.top===Xe&&be.left===nt?be:{top:Xe,left:nt});return}let ut=We.getBoundingClientRect(),Oe=ut.top-4;Oe+Pe>window.innerHeight-16&&(Oe=window.innerHeight-16-Pe),Oe<16&&(Oe=16);let G=ut.right+de;G+me>window.innerWidth-16&&(G=ut.left-me-de),G<16&&(G=16),Ee(Ae=>Ae!==null&&Ae.top===Oe&&Ae.left===G?Ae:{top:Oe,left:G})},"updatePosition");L(),window.addEventListener("scroll",L,!0),window.addEventListener("resize",L);let oe=null;return typeof ResizeObserver<"u"&&ce.current&&(oe=new ResizeObserver(L),oe.observe(ce.current)),()=>{oe?.disconnect(),window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)}},[b]),(0,o.useEffect)(()=>{if(b===null)return;ze.current&&!ze.current.disabled?ze.current.focus():ce.current?.focus();let Z=b.sessionId;return()=>{if(!bn(Z)){let L=document.querySelector('[role="treeitem"][aria-selected="true"]');L&&(L.hasAttribute("tabindex")||(L.setAttribute("tabindex","-1"),L.addEventListener("blur",()=>L.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(L):L.focus())}}},[b]),(0,o.useEffect)(()=>{b!==null&&I&&ce.current?.focus()},[b,I]),(0,o.useEffect)(()=>{if(b===null)return;let Z=e(F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),"stopImmediatePropagation"in F&&typeof F.stopImmediatePropagation=="function"&&F.stopImmediatePropagation(),I||(se(null),$e(null));return}if(F.key==="Tab"){if(F.preventDefault(),I){ce.current?.focus();return}let L=ze.current,oe=Ne.current;if(!L||!oe)return;F.shiftKey?document.activeElement===L?oe.focus():L.focus():document.activeElement===oe?L.focus():oe.focus()}},"onKey");return window.addEventListener("keydown",Z,!0),()=>window.removeEventListener("keydown",Z,!0)},[b,I]),b===null)return null;let tt=e(()=>{I||(se(null),$e(null))},"close"),Je=e(()=>{Y(!0),se(null),V(b.sessionId).then(()=>{Y(!1),$e(null)}).catch(Z=>{Y(!1),se(Yn(Z,p))})},"confirm");return(0,a.jsxs)("div",{className:"dsham_sidebarCardRoot",children:[(0,a.jsx)("div",{className:"dsham_sidebarCardBackdrop",onClick:tt}),(0,a.jsxs)("div",{ref:ce,role:"dialog","aria-modal":!0,"aria-label":p("deleteSession.title"),tabIndex:-1,className:"dsham_sidebarCard",style:xe?{top:xe.top,left:xe.left,visibility:"visible"}:{visibility:"hidden",top:0,left:0},children:[(0,a.jsx)("h3",{className:"dsham_sidebarCardTitle",children:p("deleteSession.confirmTitle")}),(0,a.jsx)("p",{className:"dsham_sidebarCardDesc",children:p("deleteSession.desc",{name:b.title})}),I&&(0,a.jsx)("div",{className:"dsham_sidebarCardDesc",role:"status",children:p("deleteSession.pending")}),ge!==null&&(0,a.jsx)("div",{className:"dsham_sidebarCardError",role:"alert",children:ge}),(0,a.jsxs)("div",{className:"dsham_sidebarCardFooter",children:[(0,a.jsx)("button",{ref:ze,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnCancel",disabled:I,onClick:tt,children:p("cancel")}),(0,a.jsx)("button",{ref:Ne,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnDanger",disabled:I,onClick:Je,children:p("deleteSession.title")})]})]})]})}e(ee,"DeleteSessionOverlay");let He=null,It=new Set,K=e(p=>{He=p;for(let b of It)b()},"publishArchiveWsTarget");function Hn(){return o.useSyncExternalStore(p=>(It.add(p),()=>{It.delete(p)}),()=>He,()=>He)}e(Hn,"useArchiveWsRequest");function Ue(p){try{let b=document.querySelector(`[data-row-key="workspace:${CSS.escape(p)}"]`);return b?(b.hasAttribute("tabindex")||(b.setAttribute("tabindex","-1"),b.addEventListener("blur",()=>b.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(b):b.focus(),!0):!1}catch{return!1}}e(Ue,"focusWorkspaceRow");function ln({t:p}){let b=Hn(),[I,Y]=(0,o.useState)(!1),[ge,se]=(0,o.useState)(null),[xe,Ee]=(0,o.useState)(null),ce=(0,o.useRef)(null),ze=(0,o.useRef)(null),Ne=(0,o.useRef)(null);if((0,o.useLayoutEffect)(()=>{if(b===null||typeof document>"u"){Ee(null);return}let Z=null,F=e(()=>{if(Z&&Z.isConnected)return Z;try{Z=document.querySelector(`[data-row-key="workspace:${CSS.escape(b.workspaceId)}"]`)}catch{Z=null}return Z},"getTargetRow"),L=e(()=>{let ve=ce.current,me=ve?.offsetWidth||290,Pe=ve?.offsetHeight||160,de=8,We=F();if(!We){let Ae=window.innerWidth,qe=window.innerHeight,Xe=Math.max(16,(qe-Pe)/2),nt=Math.max(16,(Ae-me)/2);Ee(be=>be!==null&&be.top===Xe&&be.left===nt?be:{top:Xe,left:nt});return}let ut=We.getBoundingClientRect(),Oe=ut.top-4;Oe+Pe>window.innerHeight-16&&(Oe=window.innerHeight-16-Pe),Oe<16&&(Oe=16);let G=ut.right+de;G+me>window.innerWidth-16&&(G=ut.left-me-de),G<16&&(G=16),Ee(Ae=>Ae!==null&&Ae.top===Oe&&Ae.left===G?Ae:{top:Oe,left:G})},"updatePosition");L(),window.addEventListener("scroll",L,!0),window.addEventListener("resize",L);let oe=null;return typeof ResizeObserver<"u"&&ce.current&&(oe=new ResizeObserver(L),oe.observe(ce.current)),()=>{oe?.disconnect(),window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)}},[b]),(0,o.useEffect)(()=>{if(b===null)return;ze.current&&!ze.current.disabled?ze.current.focus():ce.current?.focus();let Z=b.workspaceId;return()=>{Ue(Z)}},[b]),(0,o.useEffect)(()=>{b!==null&&I&&ce.current?.focus()},[b,I]),(0,o.useEffect)(()=>{if(b===null)return;let Z=e(F=>{if(F.key==="Escape"){F.preventDefault(),F.stopPropagation(),"stopImmediatePropagation"in F&&typeof F.stopImmediatePropagation=="function"&&F.stopImmediatePropagation(),I||(se(null),K(null));return}if(F.key==="Tab"){if(F.preventDefault(),I){ce.current?.focus();return}let L=ze.current,oe=Ne.current;if(!L||!oe)return;F.shiftKey?document.activeElement===L?oe.focus():L.focus():document.activeElement===oe?L.focus():oe.focus()}},"onKey");return window.addEventListener("keydown",Z,!0),()=>window.removeEventListener("keydown",Z,!0)},[b,I]),b===null)return null;let tt=e(()=>{I||(se(null),K(null))},"close"),Je=e(()=>{Y(!0),se(null);let F=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(me=>me.workspaceId===b.workspaceId),L=n.sessions.list?.getSnapshot?.()?.byId??{},oe=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]),ve=(F?.sessionIds??[]).filter(me=>On(me,L,oe));nr(n.workspaces,ve,N).then(me=>{if(Y(!1),me.failures.length>0){se(zn(me.failures,p));return}K(null)}).catch(me=>{Y(!1),se(Tr(me,p))})},"confirm");return(0,a.jsxs)("div",{className:"dsham_sidebarCardRoot",children:[(0,a.jsx)("div",{className:"dsham_sidebarCardBackdrop",onClick:tt}),(0,a.jsxs)("div",{ref:ce,role:"dialog","aria-modal":!0,"aria-label":p("menu.archiveWorkspace"),tabIndex:-1,className:"dsham_sidebarCard",style:xe?{top:xe.top,left:xe.left,visibility:"visible"}:{visibility:"hidden",top:0,left:0},children:[(0,a.jsx)("h3",{className:"dsham_sidebarCardTitle",children:p("archiveWorkspace.title",{n:b.count})}),(0,a.jsx)("p",{className:"dsham_sidebarCardDesc",children:p("archiveWorkspace.desc",{name:b.title})}),I&&(0,a.jsx)("div",{className:"dsham_sidebarCardDesc",role:"status",children:p("archiveWorkspace.pending")}),ge!==null&&(0,a.jsx)("div",{className:"dsham_sidebarCardError",role:"alert",children:ge}),(0,a.jsxs)("div",{className:"dsham_sidebarCardFooter",children:[(0,a.jsx)("button",{ref:ze,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnCancel",disabled:I,onClick:tt,children:p("cancel")}),(0,a.jsx)("button",{ref:Ne,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnDanger",disabled:I,onClick:Je,children:p("archiveWorkspace.confirm")})]})]})]})}e(ln,"ArchiveWorkspaceOverlay");function Lt(p){if(typeof document>"u"||typeof document.addEventListener!="function"||typeof MutationObserver>"u")return()=>{};let b=null,I=!1,Y=new Map,ge=!1,se=e(L=>{let ve=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(de=>de.workspaceId===L);if(ve===void 0)return[];let me=n.sessions.list?.getSnapshot?.()?.byId??{},Pe=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]);return ve.sessionIds.filter(de=>On(de,me,Pe))},"workspaceCandidateIds"),xe=e(()=>{if(ge=!1,!I)for(let[L,oe]of Y){if(!L.isConnected){Y.delete(L);continue}let ve=se(oe.workspaceId).length===0;L.disabled=ve,L.style.opacity=ve?"0.5":"",L.style.cursor=ve?"not-allowed":""}},"revalidateItems"),Ee=e(()=>{if(Y.size===0||ge||I)return;ge=!0;let L=e(()=>xe(),"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(L):setTimeout(L,16)},"scheduleRevalidate"),ce=e(L=>{b=Rr(L.target)},"rememberWorkspace");document.addEventListener("pointerdown",ce,!0),document.addEventListener("click",ce,!0);let ze=e(()=>{if(I)return;for(let[oe]of Y)oe.isConnected||Y.delete(oe);let L=document.querySelectorAll('[role="menu"]');for(let oe of L){if(oe.querySelector('[data-dsham-archive-workspace="true"]'))continue;let ve=Array.from(oe.querySelectorAll('button[role="menuitem"]'));if(ve.length===0)continue;let me=ve.find(Ge=>Jn(Ge,!1))??ve.find(Ge=>Jn(Ge,!0));if(!me)continue;let Pe=ve.find(Ge=>Ge!==me)??me,de=me.parentElement;if(!de)continue;let We=b;if(!We)continue;let Oe=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(Ge=>Ge.workspaceId===We.workspaceId),G=Oe?.path??Oe?.cwd,qe=se(We.workspaceId).length,Xe=document.createElement("div");Xe.className=de.className;let nt=Pe.className.split(/\s+/).filter(Ge=>!/(?:^|[_-])danger(?:$|[_-])/i.test(Ge)).join(" "),be=document.createElement("button");be.type="button",be.setAttribute("role","menuitem"),be.dataset.dshamArchiveWorkspace="true",be.className=nt;let Ft=Pe.querySelector("span"),$t=Pe.querySelectorAll("span")[1],st=document.createElement("span");st.setAttribute("aria-hidden","true"),Ft?.className&&(st.className=Ft.className),st.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 2.5H2.5C1.94772 2.5 1.5 2.94772 1.5 3.5V4.5C1.5 5.05228 1.94772 5.5 2.5 5.5H13.5C14.0523 5.5 14.5 5.05228 14.5 4.5V3.5C14.5 2.94772 14.0523 2.5 13.5 2.5Z"/><path d="M2.5 5.5V13.5C2.5 13.7652 2.60536 14.0196 2.79289 14.2071C2.98043 14.3946 3.23478 14.5 3.5 14.5H12.5C12.7652 14.5 13.0196 14.3946 13.2071 14.2071C13.3946 14.0196 13.5 13.7652 13.5 13.5V5.5"/><path d="M6.5 9.5H9.5"/></svg>';let un=document.createElement("span");if($t?.className&&(un.className=$t.className),un.textContent=p("menu.archiveWorkspace"),be.append(st,un),Xe.append(be),qe===0&&(be.disabled=!0,be.style.opacity="0.5",be.style.cursor="not-allowed"),be.addEventListener("click",Ge=>{Ge.preventDefault(),Ge.stopPropagation();let it=se(We.workspaceId).length;it!==0&&(document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),K({workspaceId:We.workspaceId,title:We.title,count:it}))}),G){let Ge=document.createElement("div");Ge.className=de.className;let it=document.createElement("button");it.type="button",it.setAttribute("role","menuitem"),it.dataset.dshamCopyWorkspacePath="true",it.className=nt,it.disabled=!1,it.style.opacity="",it.style.cursor="";let Qt=document.createElement("span");Qt.setAttribute("aria-hidden","true"),Ft?.className&&(Qt.className=Ft.className),Qt.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M10.5 3.5V2.5C10.5 1.94772 10.0523 1.5 9.5 1.5H3.5C2.94772 1.5 2.5 1.94772 2.5 2.5V8.5C2.5 9.05228 2.94772 9.5 3.5 9.5H4.5"/></svg>';let En=document.createElement("span");$t?.className&&(En.className=$t.className),En.textContent=p("menu.copyWorkspacePath"),it.append(Qt,En),Ge.append(it),it.addEventListener("click",St=>{St.preventDefault(),St.stopPropagation(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),$n(G).catch(()=>{})});let yt=document.createElement("div");yt.className=de.className;let wt=document.createElement("button");wt.type="button",wt.setAttribute("role","menuitem"),wt.dataset.dshamOpenExplorer="true",wt.className=nt,wt.disabled=!1,wt.style.opacity="",wt.style.cursor="";let Bt=document.createElement("span");Bt.setAttribute("aria-hidden","true"),Ft?.className&&(Bt.className=Ft.className),Bt.innerHTML='<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M1.5 3.5C1.5 2.94772 1.94772 2.5 2.5 2.5H6.5L8 4.5H13.5C14.0523 4.5 14.5 4.94772 14.5 5.5V12.5C14.5 13.0523 14.0523 13.5 13.5 13.5H2.5C1.94772 13.5 1.5 13.0523 1.5 12.5V3.5Z"/><path d="M10 8.5L12 10.5L10 12.5"/><path d="M6.5 10.5H12"/></svg>';let Gt=document.createElement("span");$t?.className&&(Gt.className=$t.className),Gt.textContent=p("menu.openInExplorer"),wt.append(Bt,Gt),yt.append(wt),wt.addEventListener("click",St=>{St.preventDefault(),St.stopPropagation(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),(async()=>{try{let hn=await fetch(mn("/open-in-app/open"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({app:"explorer",path:G})}).catch(()=>null);if(hn&&hn.ok)return}catch{}try{await cn("/open-in-explorer",{method:"POST",body:JSON.stringify({path:G,workspaceId:We.workspaceId})})}catch(hn){console.warn("archive-manager: open in explorer failed",hn)}})()}),de.parentNode?.insertBefore(Ge,de),de.parentNode?.insertBefore(yt,de)}de.parentNode?.insertBefore(Xe,de),Y.set(be,{workspaceId:We.workspaceId})}},"checkAndInject"),Ne=!1,tt=e(()=>{if(Ne||I)return;Ne=!0;let L=e(()=>{Ne=!1,!I&&ze()},"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(L):setTimeout(L,16)},"scheduleInject"),Je=new MutationObserver(L=>{Fn(L,'[role="menu"]')&&tt()});Je.observe(document.body,{childList:!0,subtree:!0});let Z=n.sessions.list?.subscribe?.(Ee),F=n.workspaces.list?.subscribe?.(Ee);return()=>{I=!0,document.removeEventListener("pointerdown",ce,!0),document.removeEventListener("click",ce,!0),Je.disconnect(),Z?.(),F?.(),Y.clear();for(let L of document.querySelectorAll('[data-dsham-archive-workspace="true"], [data-dsham-copy-workspace-path="true"], [data-dsham-open-explorer="true"]'))L.parentElement?.remove()}}e(Lt,"setupWorkspaceMenuInjector");function yn(){if(typeof n.slots.entries!="function")return!1;if(n.slots.entries("sidebar.workspaces").some(I=>I.children?.[M]!==void 0)||n.slots.entries("contextMenu.content").some(I=>I.children?.[M]!==void 0))return!0;try{if(n.get("contextMenus")!==void 0)return!0}catch{}return!1}e(yn,"hostSidebarDeclaresSessionMenu");let vt,qt,zt,wn,Sn,xn,Vt,kn=e(()=>{let p=yn()?"menu":"waiting";p!==vt&&(vt=p,p==="menu"&&(qt??=n.slots.inject(M,()=>n.slots.register({name:M,id:"archive-manager.delete-session",order:500,locale:De,inject:e(()=>({}),"inject")},Ze)),zt??=n.slots.inject(M,()=>n.slots.register({name:M,id:"archive-manager.favorite",order:50,locale:De,inject:e(()=>({favoriteRow:gt}),"inject")},Mt)),wn??=n.slots.inject(M,()=>n.slots.register({name:M,id:"archive-manager.move-session",order:480,locale:De,inject:e(()=>({}),"inject")},Wt)),Sn??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.delete-session",locale:De,inject:e(()=>({t:n.locale.bind(De)}),"inject")},ee)),xn??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.archive-workspace",locale:De,inject:e(()=>({t:n.locale.bind(De)}),"inject")},ln)),Vt??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.toast",locale:De,inject:e(()=>({}),"inject")},Te))))},"reconcileSidebar");kn();let Tt=(()=>{try{return n.get("contextMenus")}catch{return}})();Tt&&typeof Tt.register=="function"?n.effect(()=>{let p;try{p=n.slots.register({name:"contextMenu.icon",key:"archive-manager.explorer"},()=>(0,a.jsx)("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M1.5 3.5C1.5 2.94772 1.94772 2.5 2.5H6.5L8 4.5H13.5C14.0523 4.5 14.5 4.94772 14.5 5.5V12.5C14.5 13.0523 14.0523 13.5 13.5 13.5H2.5C1.94772 13.5 1.5 13.0523 1.5 12.5V3.5Z"}),(0,a.jsx)("path",{d:"M10 8.5L12 10.5L10 12.5"}),(0,a.jsx)("path",{d:"M6.5 10.5H12"})]}))}catch{}let b=Tt.register({id:"archive-manager.workspace-actions",target:"workspace",order:250,observe:e(()=>[n.workspaces.list,n.sessions.list,n.locale],"observe"),resolve:e(({workspaceId:I,path:Y,displayTitle:ge})=>{let xe=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(F=>F.workspaceId===I),Ee=n.sessions.list?.getSnapshot?.()?.byId??{},ce=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]),Ne=(xe?xe.sessionIds.filter(F=>On(F,Ee,ce)):[]).length,tt=n.locale.bind(De),Je=Y??xe?.path??xe?.cwd,Z=[];return Je&&(Z.push({id:"copy-workspace-path",label:tt("menu.copyWorkspacePath"),icon:{key:"workspace.copy"},run:e(()=>{$n(Je).catch(()=>{})},"run")}),Z.push({id:"open-in-explorer",label:tt("menu.openInExplorer"),icon:{key:"archive-manager.explorer"},run:e(()=>{(async()=>{try{let F=await fetch(mn("/open-in-app/open"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({app:"explorer",path:Je})}).catch(()=>null);if(F&&F.ok)return}catch{}try{await cn("/open-in-explorer",{method:"POST",body:JSON.stringify({path:Je,workspaceId:I})})}catch(F){console.warn("archive-manager: open in explorer failed",F)}})()},"run")})),Z.push({id:"archive-workspace",label:tt("menu.archiveWorkspace"),icon:{key:"workspace.archive"},disabled:Ne===0,run:e(()=>{Ne!==0&&K({workspaceId:I,title:ge||I,count:Ne})},"run")}),Z},"resolve")});return()=>{b?.(),p?.()}},"archive-manager: native workspace context menu"):n.effect(()=>Lt(n.locale.bind(De)),"archive-manager: workspace menu injector"),n.effect(()=>Nr(),"archive-manager: sidebar row contextmenu trigger"),zr(n);let jt=typeof n.on=="function"?n.on("slots/changed",p=>{if(!(p!=="sidebar.workspaces"&&p!=="contextMenu.content"))try{kn()}catch(b){console.warn("archive-manager: sidebar mode switch failed",b)}}):void 0;n.effect(()=>()=>{jt?.(),qt?.(),zt?.(),wn?.(),Sn?.(),xn?.(),Vt?.()},"archive-manager: sidebar mode");let dt=e(()=>({archiveSessions:te,archiveSession:e((p,b)=>n.workspaces.archiveSession(p,b),"archiveSession"),sessionStore:tr(n.sessions.list),workspaceStore:tr(n.workspaces.list),unarchiveSession:_t,deleteSession:V,unarchiveSessions:J,deleteArchivedSessions:Le,archivedSessionMetadata:et,openConversation:m,focusSessionWorkspace:C,viewState:l,favoriteSessions:at,setSessionFavorite:sn,favoriteSync:gt,organizeBatch:Et,diagnoseOrphanSubagents:P,cleanOrphanSubagents:Me,diagnoseSessionCaches:H,rebuildSessionCaches:u,refreshCacheLists:Ce,searchSessionContent:Ct,searchArchivedContent:fe,previewArchivedSession:lt,t:n.locale.bind(De)}),"buildArchivedSectionProps"),cn=e(async(p,b)=>{let I=mn(`/api/michengai/dsh-archive-manager${p}`),Y=Object.assign({"content-type":"application/json","x-michengai-plugin-update":"1"},b?.headers),ge=await fetch(I,Object.assign({},b,{headers:Y})),se=await ge.json();if(!ge.ok||!se||se.ok===!1)throw new Error((se&&typeof se=="object"&&typeof se.error=="string"?se.error:void 0)||`HTTP ${ge.status}`);return se},"callSettingsApi"),bt=null,Nt=!1,dn=e(({size:p=16})=>(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:p,height:p,fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M13.5 2.5H2.5C1.94772 2.5 1.5 2.94772 1.5 3.5V4.5C1.5 5.05228 1.94772 5.5 2.5 5.5H13.5C14.0523 5.5 14.5 5.05228 14.5 4.5V3.5C14.5 2.94772 14.0523 2.5 13.5 2.5Z"}),(0,a.jsx)("path",{d:"M2.5 5.5V13.5C2.5 13.7652 2.60536 14.0196 2.79289 14.2071C2.98043 14.3946 3.23478 14.5 3.5 14.5H12.5C12.7652 14.5 13.0196 14.3946 13.2071 14.2071C13.3946 14.0196 13.5 13.7652 13.5 13.5V5.5"}),(0,a.jsx)("path",{d:"M6.5 9.5H9.5"})]}),"ArchiveNavIcon"),Cn=e(()=>{if(!(!Nt||bt)&&!(Ve&&!Ve.isSettingsSectionEnabled()))try{n.slots.register({name:"settings.section.icon",id:"archive-manager",locale:De},dn);let p=n.slots.register({name:"settings.section",id:"archive-manager",order:45,label:e(()=>n.locale.bind(De)("archived.badge"),"label"),icon:"archive",locale:De,inject:dt},Mn);bt=typeof p=="function"?p:()=>{}}catch(p){console.warn("archive-manager: register settings.section failed:",p),bt=null}},"mountSettingsSection"),Jt=e(()=>{if(bt){try{bt()}catch{}bt=null}},"unmountSettingsSection"),Xt=e(()=>{Ve?.isSettingsSectionEnabled?.()??!0?Cn():Jt()},"syncSettingsSection");Ve=br(n,{callApi:cn,renderPanel:e(p=>(0,a.jsx)(Mn,Object.assign({},dt(),p)),"renderPanel"),injectProps:dt,ns:De,onOnlineUpdateChange:e(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("dsham-update-toggle"))},"onOnlineUpdateChange"),onSidebarFavoriteStarChange:e(p=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("dsham-favorite-star-toggle",{detail:{enabled:p}}))},"onSidebarFavoriteStarChange"),onLocationChange:e(()=>{Xt()},"onLocationChange")}),n.effect(()=>()=>{Ve?.destroy(),Jt()},"archive-manager: sidebar entry"),n.effect(()=>Fa({endpoint:"/api/michengai/dsh-archive-manager/update",packageName:"@michengai/dsh-archive-manager",titleRowSelector:".dsham_settingsTitleRow",linksSelector:".dsham_settingsLinks",zhName:"\u5F52\u6863\u4F1A\u8BDD",enName:"Archived sessions",ruName:"\u0410\u0440\u0445\u0438\u0432 \u0441\u0435\u0441\u0441\u0438\u0439",createIcon:$,isEnabled:e(()=>Ve.isOnlineUpdateEnabled(),"isEnabled")}),"dsh-archive-manager: plugin update ui"),n.slots.inject("settings.section",()=>{Nt=!0;try{if(Ve&&!Ve.isSettingsSectionEnabled())return()=>{Nt=!1,Jt()};let p=n.slots.register({name:"settings.section",id:"archive-manager",order:45,label:e(()=>n.locale.bind(De)("archived.badge"),"label"),icon:"archive",locale:De,inject:dt},Mn);return bt=typeof p=="function"?p:()=>{},()=>{Nt=!1,Jt()}}catch(p){return console.warn("archive-manager: register settings.section failed:",p),()=>{Nt=!1}}})}e(Cs,"applyWorkspaceBrowser");async function Es(n,s,l,h){try{await s(n)}catch(v){l(ts(v,h))}}return e(Es,"forkWithFeedback"),i.__test={computeSubmenuPosition:Zr,forkWithFeedback:Es,favoritesOnlyVisibility:Sr,favoriteGroupPredicate:xr,createFavoriteRowStore:Cr,unarchivedSessionIds:Wr,ArchiveSelectionToolbar:Pr,ArchivedSessionsSection:Mn,zh:$r,en:Gr,displayTitle:rt,isUnknownSessionError:Ln,deriveArchivedGroups:qr,sortArchivedGroups:Vr,deriveArchivedBatchIds:vn,archivedSessionIdsInGroups:Br,pruneArchivedSelection:Hr,toggleArchivedSelection:er,archivedDeleteFeedback:Ur,isWorkspaceTaskCandidate:On,isWorkspaceDeleteMenuItem:Jn,workspaceMenuTriggerFrom:Rr,findRowMenuButton:Zn,isRowMenuButton:jr,setupSidebarRowContextMenu:Nr,applySettingsNavIcon:Mr,restoreSettingsNavIcon:Lr,installSettingsNavIcon:zr,mutationTouches:Fn,resolveRowHasStatus:Yt,activeSessionActivity:Pn,activeSessionRefusal:Ar,activeArchiveFromMessage:_r,archiveSessionsViaOfficial:nr,unarchiveSessionsViaOfficial:Yr,createUnarchiveSession:Kr,bindObservable:tr,ARCHIVE_MANAGER_REMOTE:mt,currentSessionId:Gn,setupSidebarEntry:br,ArchiveBundleConfigCard:gr,ArchiveBundleConfigCardWrapper:vr,setupWorkspaceFavoritesOnly:kr},i.apply=ks,i.inject=xs,r.exports}e(pi,"startArchiveClient");
|
|
25
25
|
|
|
26
26
|
return module.exports.startArchiveClient(require);
|
|
27
27
|
}
|