@michengai/dsh-archive-manager 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -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 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=`
10
+ "use strict";var qn=Object.defineProperty;var Os=Object.getOwnPropertyDescriptor;var Fs=Object.getOwnPropertyNames;var Bs=Object.prototype.hasOwnProperty;var e=(t,r)=>qn(t,"name",{value:r,configurable:!0});var Hs=(t,r)=>{for(var i in r)qn(t,i,{get:r[i],enumerable:!0})},Us=(t,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Fs(r))!Bs.call(t,o)&&o!==i&&qn(t,o,{get:()=>r[o],enumerable:!(a=Os(r,o))||a.enumerable});return t};var Ws=t=>Us(qn({},"__esModule",{value:!0}),t);var fi={};Hs(fi,{startArchiveClient:()=>mi});module.exports=Ws(fi);function ce(t){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("\u53C2\u6570\u5FC5\u987B\u4E3A\u5BF9\u8C61");return t}e(ce,"record");function Be(t){return String(t&&typeof t=="object"&&"message"in t?t.message??t:t)}e(Be,"errorMessage");function Vn(t){return t&&typeof t=="object"&&"code"in t?t.code:void 0}e(Vn,"errorCode");var ia=Function("return globalThis.__dshArchiveReact")(),{Children:wi,Component:Si,Fragment:oa,Profiler:xi,PureComponent:ki,StrictMode:Ci,Suspense:Ei,cloneElement:Ii,createContext:Ti,createElement:la,createRef:Ai,forwardRef:_i,isValidElement:Ri,lazy:ji,memo:Ni,startTransition:Mi,useCallback:Di,useContext:Li,useDebugValue:zi,useDeferredValue:Pi,useEffect:ca,useId:Oi,useImperativeHandle:Fi,useInsertionEffect:Bi,useLayoutEffect:Hi,useMemo:Ui,useReducer:Wi,useRef:qi,useState:qt,useSyncExternalStore:Vi,useTransition:$i,version:Gi}=ia,W=ia;function ua(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(ua,"NumberField");function Vs(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(Vs,"CalendarIcon");function Nn(t,r,i){let a=String(r+1).padStart(2,"0"),o=String(i).padStart(2,"0");return`${t}-${a}-${o}`}e(Nn,"formatYmd");function mn(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(mn,"parseYmd");function $s(t,r){let i=new Date(t,r,1).getDay(),a=(i===0?7:i)-1,o=new Date(t,r+1,0).getDate(),g=new Date(t,r,0).getDate(),c=[];for(let k=0;k<42;k++){let y=t,N=r,w=0,f=!1;k<a?(w=g-a+k+1,N=r-1,N<0&&(N=11,y--),f=!0):k<a+o?w=k-a+1:(w=k-a-o+1,N=r+1,N>11&&(N=0,y++),f=!0),c.push({year:y,monthIndex:N,day:w,dateStr:Nn(y,N,w),isOutside:f})}return c}e($s,"buildMonthGrid");function Gs(t,r=new Date){if(t==="all")return{from:"",to:""};let i=Nn(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:Nn(o.getFullYear(),o.getMonth(),o.getDate()),to:i}}e(Gs,"getPresetRange");function da(t,r,i,a){let o=r+a,g=new Date(t,o+1,0).getDate();return new Date(t,o,Math.min(i,g))}e(da,"shiftMonthClamped");function ha(t){let r=t.React||W;function i(T,pe){let at=T==="from"?pe:t.from,_t=T==="to"?pe:t.to;if(at===""&&_t===""){t.onClear();return}T==="from"?t.onFrom(pe):t.onTo(pe)}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[pe]=r.useState({current:T});return pe}))(null),[k,y]=r.useState(!1),N=mn(t.from||t.to)??{year:new Date().getFullYear(),monthIndex:new Date().getMonth(),day:new Date().getDate()},[w,f]=r.useState(N.year),[S,M]=r.useState(N.monthIndex),[R,U]=r.useState(null),[z,H]=r.useState(null),[me,le]=r.useState(null);r.useEffect(()=>{if(!k)return;let T=e(at=>{c.current&&!c.current.contains(at.target)&&(y(!1),U(null))},"onPointerDown"),pe=e(at=>{at.key==="Escape"&&(at.preventDefault(),at.stopPropagation(),y(!1),U(null))},"onKeyDown");return typeof document<"u"&&document.addEventListener("mousedown",T,!0),typeof window<"u"&&window.addEventListener("keydown",pe,!0),()=>{typeof document<"u"&&document.removeEventListener("mousedown",T,!0),typeof window<"u"&&window.removeEventListener("keydown",pe,!0)}},[k]),r.useEffect(()=>{if(!k||!me||!c.current)return;c.current.querySelector(`[data-date="${me}"]`)?.focus()},[k,me]);let V=t.t?t.t("discovery.today")==="Today"||(t.t("locale.language")||"").startsWith("en"):!1,fe=t.t?t.t("discovery.today")==="\u0421\u0435\u0433\u043E\u0434\u043D\u044F"||(t.t("locale.language")||"").startsWith("ru"):!1,he=V?"en-US":fe?"ru-RU":"zh-CN",et=V?["Mo","Tu","We","Th","Fr","Sa","Su"]:fe?["\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431","\u0412\u0441"]:["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u65E5"];function ae(T){T.stopPropagation(),S<=0?(M(11),f(pe=>pe-1)):M(pe=>pe-1)}e(ae,"prevMonth");function X(T){T.stopPropagation(),S>=11?(M(0),f(pe=>pe+1)):M(pe=>pe+1)}e(X,"nextMonth");function gt(T){R?(T>=R?(t.onFrom(R),t.onTo(T)):(t.onFrom(T),t.onTo(R)),U(null),y(!1)):(U(T),H(T))}e(gt,"handleDayClick");function yt(T){let pe=Gs(T);T==="all"?t.onClear():(t.onFrom(pe.from),t.onTo(pe.to)),U(null),y(!1)}e(yt,"applyPreset");function Je(T){let pe=Nn(T.getFullYear(),T.getMonth(),T.getDate());le(pe),R&&H(pe),(T.getFullYear()!==w||T.getMonth()!==S)&&(f(T.getFullYear()),M(T.getMonth()))}e(Je,"moveFocusToDate");function ot(T,pe){let at=mn(T);at&&Je(new Date(at.year,at.monthIndex,at.day+pe))}e(ot,"moveFocus");let Ne=t.from,Ft=t.to;R&&z&&(Ne=R<=z?R:z,Ft=R<=z?z:R);let vt=$s(w,S),Dt=new Date,ln=me||Ne||Nn(Dt.getFullYear(),Dt.getMonth(),Dt.getDate()),O=vt.map((T,pe)=>{let at=Ne===T.dateStr,_t=Ft===T.dateStr,vn=!!(Ne&&Ft&&T.dateStr>Ne&&T.dateStr<Ft),Ln=T.year===Dt.getFullYear()&&T.monthIndex===Dt.getMonth()&&T.day===Dt.getDate(),Bt="dsham_dateDay";T.isOutside&&(Bt+=" is-outside"),Ln&&(Bt+=" is-today"),at&&(Bt+=" is-start"),_t&&(Bt+=" is-end"),vn&&(Bt+=" is-in-range");let zn=!T.isOutside&&(T.dateStr===ln||T.day===1&&!vt.some(K=>!K.isOutside&&K.dateStr===ln));return r.createElement("div",{key:pe,className:Bt,role:"button",tabIndex:zn?0:-1,"data-date":T.dateStr,"aria-label":T.dateStr,"aria-pressed":!!(at||_t||vn),onClick:e(K=>{K.stopPropagation(),gt(T.dateStr)},"onClick"),onKeyDown:e(K=>{if(K.key==="Enter"||K.key===" ")K.preventDefault(),K.stopPropagation(),gt(T.dateStr);else if(K.key==="ArrowLeft")K.preventDefault(),K.stopPropagation(),ot(T.dateStr,-1);else if(K.key==="ArrowRight")K.preventDefault(),K.stopPropagation(),ot(T.dateStr,1);else if(K.key==="ArrowUp")K.preventDefault(),K.stopPropagation(),ot(T.dateStr,-7);else if(K.key==="ArrowDown")K.preventDefault(),K.stopPropagation(),ot(T.dateStr,7);else if(K.key==="Home"){K.preventDefault(),K.stopPropagation();let Me=mn(T.dateStr);if(Me){let bt=new Date(Me.year,Me.monthIndex,Me.day),Vt=(bt.getDay()===0?7:bt.getDay())-1;bt.setDate(bt.getDate()-Vt),Je(bt)}}else if(K.key==="End"){K.preventDefault(),K.stopPropagation();let Me=mn(T.dateStr);if(Me){let bt=new Date(Me.year,Me.monthIndex,Me.day),Vt=(bt.getDay()===0?7:bt.getDay())-1;bt.setDate(bt.getDate()+(6-Vt)),Je(bt)}}else if(K.key==="PageUp"){K.preventDefault(),K.stopPropagation();let Me=mn(T.dateStr);Me&&Je(da(Me.year,Me.monthIndex,Me.day,-1))}else if(K.key==="PageDown"){K.preventDefault(),K.stopPropagation();let Me=mn(T.dateStr);Me&&Je(da(Me.year,Me.monthIndex,Me.day,1))}},"onKeyDown"),onMouseEnter:e(()=>{R&&H(T.dateStr)},"onMouseEnter")},T.day)}),Le=`${w}\u5E74 ${S+1}\u6708`;try{Le=new Intl.DateTimeFormat(he,{year:"numeric",month:"long"}).format(new Date(w,S,1))}catch{Le=V||fe?`${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")},Vs(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"},pa(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(()=>yt("all"),"onClick")},t.t?t.t("discovery.allTime"):"\u5168\u90E8\u65F6\u95F4"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>yt("today"),"onClick")},t.t?t.t("discovery.today"):"\u4ECA\u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>yt("7d"),"onClick")},t.t?t.t("discovery.last7Days"):"\u8FD1 7 \u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>yt("30d"),"onClick")},t.t?t.t("discovery.last30Days"):"\u8FD1 30 \u5929"),r.createElement("button",{type:"button",className:"dsham_datePresetBtn",onClick:e(()=>yt("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:ae,"aria-label":"prev month"},"\u2039"),r.createElement("span",{className:"dsham_dateMonthTitle"},Le),r.createElement("button",{type:"button",className:"dsham_dateNavBtn",onClick:X,"aria-label":"next month"},"\u203A")),r.createElement("div",{className:"dsham_dateGrid"},et.map((T,pe)=>r.createElement("div",{key:pe,className:"dsham_dateWeekday"},T))),r.createElement("div",{className:"dsham_dateGrid"},O))))}e(ha,"DateRange");function $n(t){return W.createElement("div",{className:t.className},W.createElement("button",{type:"button",className:"dsham_disclosure","aria-expanded":t.open,onClick:t.onToggle},pa(W.createElement,t.open),t.title),t.open?W.createElement("div",null,t.children):null)}e($n,"Disclosure");function pa(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(pa,"foldChevron");function dr(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(dr,"SelectionCheckbox");var Mn=e(t=>{if(typeof t!="string"||!t.length||t.length>1024)throw new TypeError("\u4F1A\u8BDD ID \u65E0\u6548");return t},"id"),fa=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"),ma={parse(t){let r=ce(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(Mn))],query:fa(r.query,!0)}}},Ks={parse(t){let r=ce(t);if(!r)throw new TypeError("\u9884\u89C8\u53C2\u6570\u65E0\u6548");return{sessionId:Mn(r.sessionId),query:fa(r.query??"")}}},ur=e((t,r)=>{if(typeof t!="string"||t.length>r)throw new TypeError("\u8FD4\u56DE\u6587\u672C\u65E0\u6548");return t},"boundedString"),ga=e(t=>{if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new TypeError("\u6D88\u606F\u5E8F\u53F7\u65E0\u6548");return t},"sequence"),hr={parse(t){let r=ce(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(ce).map(i=>({sessionId:Mn(i.sessionId),seq:ga(i.seq),snippet:ur(i.snippet,400)})),failures:r.failures.map(ce).map(i=>({sessionId:Mn(i.sessionId),message:ur(i.message,500)}))}}},Ys={parse(t){let r=ce(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:Mn(r.sessionId),hasEarlier:r.hasEarlier,hasLater:r.hasLater,messages:r.messages.map(ce).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:ga(i.seq),role:i.role,text:ur(i.text,2e3),truncated:i.truncated}})}}};async function Kn(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(Kn,"copySessionText");function va(){let t=e((i,a)=>({mode:"strict",typeSymbol:`@michengai/dsh-archive-manager/types#${i}`,create:e(()=>a,"create"),schema:a}),"codec");return[["searchSessionContent",ma,hr],["searchArchivedContent",ma,hr],["previewArchivedSession",Ks,Ys]].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(va,"discoveryInvocations");function ba(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,g=0,c;for(let k of t){let y=g+k.toLowerCase().length;if(c===void 0&&y>a&&(c=o),o+=k.length,y>=a+i.length)return{start:c??o,end:o};g=y}return null}e(ba,"findTextRange");function Gn(t,r=!1){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return NaN;let[i,a,o]=t.split("-").map(Number),g=new Date(i,a-1,o);return g.getFullYear()!==i||g.getMonth()!==a-1||g.getDate()!==o?NaN:(r&&g.setDate(g.getDate()+1),g.getTime())}e(Gn,"dayBoundary");function pr(t,r){return(!t||Number.isFinite(Gn(t)))&&(!r||Number.isFinite(Gn(r)))&&(!t||!r||t<=r)}e(pr,"validUpdatedRange");function ya(t,r,i){if(!pr(r,i))return!1;if(!r&&!i)return!0;let a=typeof t=="number"?t:Date.parse(t??"");return Number.isFinite(a)&&(!r||a>=Gn(r))&&(!i||a<Gn(i,!0))}e(ya,"matchesUpdatedRange");async function wa(t,r,i,{signal:a,onProgress:o}={}){let g=[],c=[],k=[...new Set(t)],y=e(()=>{if(a?.aborted)throw new Error("\u641C\u7D22\u5DF2\u53D6\u6D88")},"check");for(let N=0;N<k.length;N+=20){y();let w=hr.parse(await i({sessionIds:k.slice(N,N+20),query:r}));y(),g.push(...w.items),c.push(...w.failures),o?.({done:Math.min(N+20,k.length),total:k.length,items:[...g],failures:[...c]})}return y(),{items:g,failures:c}}e(wa,"searchArchiveBatches");function Sa(t,r={}){let i=t.createElement;function a({text:f,query:S=""}){let M=ba(f,S);return M?i(t.Fragment,null,f.slice(0,M.start),i("mark",null,f.slice(M.start,M.end)),f.slice(M.end)):f}e(a,"HighlightedText");function o(f,S,M,R){let U=JSON.stringify(f),z=JSON.stringify([U,S]),[H,me]=t.useState(0),[le,V]=t.useState({key:"",status:"idle",items:[],failures:[]});return t.useEffect(()=>{if(!M||!S.trim()||!R)return;let he=new AbortController;V({key:z,status:"loading",items:[],failures:[],done:0,total:f.length});let et=setTimeout(()=>{wa(JSON.parse(U),S,R,{signal:he.signal,onProgress:e(ae=>{he.signal.aborted||V({key:z,status:"loading",...ae})},"onProgress")}).then(ae=>{he.signal.aborted||V({key:z,status:"ready",done:f.length,total:f.length,...ae})}).catch(ae=>{he.signal.aborted||V(X=>({...X,key:z,status:"error",error:Be(ae)}))})},350);return()=>{he.abort(),clearTimeout(et)}},[U,S,M,R,H]),{...M&&S.trim()&&R?le.key===z?le:{key:z,status:"loading",items:[],failures:[],done:0,total:f.length}:{status:"idle",items:[],failures:[]},retry:e(()=>me(he=>he+1),"retry")}}e(o,"useArchiveSearch");function g(f,S){let[M,R]=t.useState(null),[U,z]=t.useState({status:"idle"}),[H,me]=t.useState(0),le=M,V=M&&S.includes(M.session.id);return t.useEffect(()=>{M&&!V&&R(null)},[M,V]),t.useEffect(()=>{if(!V||typeof window>"u")return;let fe=e(he=>{he.key==="Escape"&&(he.preventDefault(),he.stopPropagation(),he.stopImmediatePropagation(),R(null))},"onKeyDown");return window.addEventListener("keydown",fe,!0),()=>window.removeEventListener("keydown",fe,!0)},[V]),t.useEffect(()=>{if(!M||!V||!f)return;let fe=!0;return z({key:le,status:"loading"}),Promise.resolve().then(()=>f({sessionId:M.session.id,query:M.query})).then(he=>{fe&&z({key:le,status:"ready",value:he})}).catch(he=>{fe&&z({key:le,status:"error",error:Be(he)})}),()=>{fe=!1}},[le,V,f,H]),{target:V?M:null,...U.key===le?U:{status:"loading"},open:e((fe,he="")=>R({session:fe,query:he}),"open"),close:e(()=>R(null),"close"),retry:e(()=>me(fe=>fe+1),"retry")}}e(g,"useArchivePreview");function c({title:f,failures:S,separator:M}){let[R,U]=t.useState(!1),z=i("ul",null,S.map(H=>i("li",{key:H.sessionId},H.sessionId,M,H.message)));return i($n,{title:f,open:R,onToggle:e(()=>U(H=>!H),"onToggle")},z)}e(c,"FailureDetails");function k(f,S){let M=r.Button??(R=>i("button",{type:"button",disabled:R.disabled,onClick:R.onClick},R.children));return i(M,{variant:"outline",size:"sm",...S},f)}e(k,"textButton");function y({t:f,from:S,to:M,onFrom:R,onTo:U,invalid:z,onClear:H}){return i("div",{className:"dsham_dateFilter"},i(ha,{React:t,from:S,to:M,invalid:z,label:f("discovery.date"),fromLabel:f("discovery.from"),toLabel:f("discovery.to"),onFrom:R,onTo:U,onClear:H,t:f}),z?i("p",{className:"dsham_dateAlert",role:"alert"},f("discovery.invalidDate")):null)}e(y,"DiscoveryFilters");function N({state:f,t:S}){return f.status==="idle"?null:i("div",{className:"dsham_discoveryStatus",role:"status","aria-live":"polite"},i("p",null,S(f.status==="loading"?"discovery.searching":f.status==="error"?"discovery.searchError":"discovery.searched",{done:f.done??0,total:f.total??0})),f.status==="error"&&i("p",null,f.error),f.failures.length>0&&i(c,{title:S("discovery.failed",{n:f.failures.length}),failures:f.failures,separator:S("common.separator")}),(f.status==="error"||f.status==="ready"&&f.failures.length>0)&&k(S("discovery.retry"),{onClick:f.retry}))}e(N,"SearchStatus");function w({preview:f,t:S,MarkdownText:M}){let[R,U]=t.useState(!1);if(f.status==="loading")return i("p",{role:"status"},S("discovery.loading"));if(f.status==="error")return i("div",null,i("p",{role:"alert"},f.error),k(S("discovery.retry"),{onClick:f.retry}));let z=f.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})),M&&i(r.SegmentedControl??"div",{id:"dsham-preview-mode",label:S("discovery.displayMode"),value:R?"raw":"formatted",options:[{value:"formatted",label:S("discovery.formatted")},{value:"raw",label:S("discovery.raw")}],onChange:e(H=>U(H==="raw"),"onChange")})),z.hasEarlier&&i("p",null,S("discovery.earlier")),!z.messages.length&&i("p",null,S("discovery.empty")),z.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))),R||!M?i("pre",{className:"dsham_previewRaw"},i(a,{text:H.text,query:f.target?.query})):i(M,{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")))),z.hasLater&&i("p",null,S("discovery.later"))):null}return e(w,"PreviewContent"),{HighlightedText:a,useArchiveSearch:o,useArchivePreview:g,DiscoveryFilters:y,SearchStatus:N,PreviewContent:w}}e(Sa,"createDiscoveryTools");var xa=[".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(""),ka={"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"},Ca={"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"},Ea={"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 Ia=e(t=>{let r=ce(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"),Zs={parse(t){let r=ce(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(Ia)}}},mr={parse(t){let r=ce(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(Ia)}}},fr={parse(t){let r=ce(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 Ta(){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",mr)},{method:"rebuildSessionCaches",parameters:[{name:"input",wire:"input",source:"json",codec:t("CacheRebuildInput",Zs)}],result:t("CacheRebuildResult",fr)}].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(Ta,"cacheRebuildInvocations");function Aa(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},g=!0,c=0,k=[],y,N=new Set,w=e(S=>{if(g){o={...o,...S};for(let M of N)M()}},"update"),f=e(async(S=i)=>{if(!g)return;y!==void 0&&(clearTimeout(y),y=void 0);let M=++c;try{let R=mr.parse(await t.diagnose());g&&M===c&&w({diagnosis:R,error:null})}catch(R){if(S>0&&g&&M===c){y=setTimeout(()=>{y=void 0,g&&M===c&&f(S-1)},a);return}g&&M===c&&w({error:Be(R)})}},"load");return{snapshot:e(()=>o,"snapshot"),subscribe(S){return N.add(S),()=>{N.delete(S)}},load:f,async run(S=!1){if(!g||o.busy)return;++c,y!==void 0&&(clearTimeout(y),y=void 0);let M=S?[...k]:[...o.diagnosis.items],R={rebuiltSessionIds:[],skippedSessionIds:[],failures:[]};k=[],w({busy:!0,result:null,error:null,refreshError:null,progress:{done:0,total:M.length}});for(let[U,z]of M.entries()){if(!g)return;try{let H=fr.parse(await t.rebuild({items:[z]}));if(!g)return;R.rebuiltSessionIds.push(...H.rebuiltSessionIds),R.skippedSessionIds.push(...H.skippedSessionIds),R.failures.push(...H.failures),H.failures.length&&k.push(z)}catch(H){if(!g)return;R.failures.push({sessionId:z.sessionId,message:Be(H)}),k.push(z)}w({progress:{done:U+1,total:M.length}})}w({result:R});try{await t.refresh()}catch(U){w({refreshError:Be(U)})}g&&(await f(),w({busy:!1,progress:null}))},dismiss(){g&&w({result:null,error:null,refreshError:null})},dispose(){g=!1,++c,y!==void 0&&(clearTimeout(y),y=void 0),N.clear()}}}e(Aa,"createCacheRebuildController");var en=class extends Error{static{e(this,"ArchiveNavigationError")}code;constructor(r){super(r),this.name="ArchiveNavigationError",this.code=r}};function _a(t,r){return t instanceof en?r(`archives.${t.code}`):Be(t)}e(_a,"formatArchiveNavigationError");function Js(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(Js,"retainInfoSnapshot");function Xs(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(Xs,"mainViewSessionId");function Yn(t){return Xs(t)}e(Yn,"currentSessionId");function Qs(t,r,i){return r===void 0||r===""?!1:(t?.byId?.[r]?.retainedBy?.mainView??0)>0||(Js(i,r)?.retainedBy?.mainView??0)>0}e(Qs,"sessionIsCurrent");async function Ra(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(Ra,"openArchivedConversation");function ja(t,r,i,{onOpened:a=e(()=>{},"onOpened"),beginNavigation:o,warn:g=e((...c)=>console.warn(...c),"warn")}={}){let c,k=t?.clearArchivedCurrent,y=t&&Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent"),N=e(S=>Qs(r.list.getSnapshot(),S,r),"viewing"),w=e(function(...S){return c!==void 0&&N(c)&&i.list.getSnapshot().archivedSessionIds.includes(c)?!1:(c=void 0,k?.apply(this,S))},"wrapped"),f=e(()=>t&&Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent")?.value===w,"ownsWrapper");if(t&&typeof k=="function")try{if(t.clearArchivedCurrent=w,!f())throw new Error("\u5BFC\u822A\u65B9\u6CD5\u672A\u63A5\u7EB3\u5F52\u6863\u9002\u914D")}catch(S){g("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"&&!f()&&i.list.getSnapshot().archivedSessionIds.includes(S))throw g("archive-manager: \u5F52\u6863\u5BFC\u822A\u9002\u914D\u4E0D\u53EF\u7528\u6216\u5DF2\u88AB\u66FF\u6362\u3002"),new en("navigationUnavailable");if(o?.(),typeof t?.openSession!="function")throw g("archive-manager: \u5BBF\u4E3B\u672A\u63D0\u4F9B\u4F1A\u8BDD\u6253\u5F00\u63A5\u53E3\u3002"),new en("navigationUnavailable");if(t.openSession(S),!N(S))throw g("archive-manager: \u5BBF\u4E3B\u672A\u4FDD\u7559\u76EE\u6807\u4F1A\u8BDD\u3002",{cleanupAvailable:typeof k=="function"}),new en("sessionNotRetained");a()}catch(M){throw c=void 0,M}},dispose(){c=void 0,!(!t||Object.getOwnPropertyDescriptor(t,"clearArchivedCurrent")?.value!==w)&&(y?Object.defineProperty(t,"clearArchivedCurrent",y):delete t.clearArchivedCurrent,k?.call(t))}}}e(ja,"allowArchivedNavigation");var sn=require("@deepseek-ai/dsh-client-ui-primitives");var Na={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"},Ma={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 Dn(t){return t.toLowerCase().startsWith("zh")?Na:Ma}e(Dn,"pluginUpdateCopy");function ei(t,r,i,a){let o=Dn(t),g=r?.restartDesktop===!0||r?.profileName==="desktop",c=g?{...o,manualHint:o.manualHintDesktop}:o,k=i!=="idle",y=c.checking,N="";return i==="checking"?y=c.checking:i==="updating"?y=c.updating:a.type==="error"?(y=a.message||c.failed,N="error"):a.type==="restart"?(y=g?c.restartDesktop:c.restart,N="success"):a.type==="restarting"?(y=c.restarting,N="success"):r===void 0?y=c.checking:r.latestCheckFailed?(y=c.failed,N="error"):!r.canAutoUpdate&&r.updateAvailable?(y=c.unavailable,N="update"):r.updateAvailable?(y=`${c.found}: v${r.latestVersion??c.unknown}`,N="update"):(y=c.latest,N="success"),{copy:c,busy:k,message:y,kind:N,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(ei,"describePluginUpdate");function Da(t,r,i){let a="idle",o=r,g={type:"status"},c=0,k=new Set,y=e(()=>{for(let w of k)w()},"emit"),N=e(w=>{o=w,i?.(w)},"assign");return{get posts(){return c},subscribe(w){return k.add(w),()=>{k.delete(w)}},view(w){return ei(w,o,a,g)},async check(){if(a==="idle"){a="checking",g={type:"status"},y();try{N(await t("GET")),g={type:"status"}}catch(w){g={type:"error",message:w instanceof Error?w.message:""}}finally{a="idle",y()}}},async update(){if(a==="idle"){a="updating",g={type:"status"},c+=1,y();try{let w=await t("POST");N(w),g={type:w.autoReload===!0?"restarting":"restart"}}catch(w){g={type:"error",message:w instanceof Error?w.message:""}}finally{a="idle",y()}}}}}e(Da,"createUpdateFlow");function La(t,r,i){return`dsh plugin${t.trim()===""?"":` --profile ${t.trim()}`} add ${r}@${i} --registry=https://registry.npmjs.org/`}e(La,"manualPluginUpdateCommand");function za(t,r){return t.key!=="Escape"?!1:(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r(),!0)}e(za,"handlePluginUpdateEscape");function ti(){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(ti,"pageBaseHref");function fn(t){if(typeof t!="string"||t.charAt(0)!=="/"||t.charAt(1)==="/")return t;let r=ti();if(r===void 0)return t;try{return new URL(t.slice(1),r).href}catch{return t}}e(fn,"resolveApiUrl");function Pa(t){let i=Function("return globalThis.__dshArchiveReactDOMClient")()?.createRoot;if(i===void 0)throw new Error("createRoot unavailable");return i(t)}e(Pa,"mountRoot");var ni="x-michengai-plugin-update",Oa="michengai-plugin-update-ui",gr=`
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(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=`
14
+ `;function ri(){let t=document.getElementById(Oa);if(t!==null){t.textContent!==gr&&(t.textContent=gr);return}let r=document.createElement("style");r.id=Oa,r.textContent=gr,(document.head??document.documentElement).append(r)}e(ri,"ensureStyle");function ai(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(ai,"validPayload");async function Fa(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",[ni]:"1"},body:"{}",...a}),g=await o.json();if(!o.ok||!ai(g))throw new Error(g&&typeof g=="object"&&"error"in g&&typeof g.error=="string"?g.error:Dn(document.documentElement.lang).failed);return g}e(Fa,"requestStatus");function si(t){let r=W.useRef(null);return W.useLayoutEffect(()=>{r.current?.replaceChildren(t.node)},[t.node]),W.createElement("span",{ref:r,className:"mpi-icon","aria-hidden":!0})}e(si,"HostIcon");function ii(t){let r=W.useRef(null),[,i]=W.useState(0),[a,o]=W.useState("idle");W.useEffect(()=>t.flow.subscribe(()=>i(w=>w+1)),[t.flow]),W.useEffect(()=>{let w=document.documentElement,f=new MutationObserver(()=>i(S=>S+1));return f.observe(w,{attributes:!0,attributeFilter:["lang"]}),()=>f.disconnect()},[]),W.useEffect(()=>{t.flow.check()},[t.flow]),W.useEffect(()=>{function w(f){za(f,t.onClose)}return e(w,"onKey"),document.addEventListener("keydown",w,!0),()=>document.removeEventListener("keydown",w,!0)},[t.onClose]);let g=document.documentElement.lang,c=t.flow.view(g),k=g.toLowerCase().startsWith("zh")?t.zhName:g.toLowerCase().startsWith("ru")?t.ruName:t.enName,y=La(c.profileRaw,t.packageName,c.latestRaw),N=a==="copied"?c.copy.copied:a==="failed"?c.copy.copyFailed:c.copy.copy;return W.createElement(sn.Modal,{open:!0,className:"mpi-dialog",title:`${k} ${c.copy.update}`,closeLabel:"Close",onClose:t.onClose,footer:[W.createElement(sn.Button,{key:"check",variant:"outline",disabled:c.busy,onClick:e(()=>{t.flow.check()},"onClick")},c.copy.recheck),W.createElement(sn.Button,{key:"update",variant:"primary",disabled:c.disabled,onClick:e(()=>{t.flow.update()},"onClick")},c.updateLabel)]},W.createElement("div",{ref:r},W.createElement("p",{className:"mpi-intro"},c.copy.intro),W.createElement("dl",{className:"mpi-meta"},W.createElement("dt",null,c.copy.current),W.createElement("dd",null,W.createElement("span",{className:"mpi-mono"},c.currentVersion)),W.createElement("dt",null,c.copy.latestLabel),W.createElement("dd",{className:"mpi-latest"},W.createElement("span",{className:"mpi-mono"},c.latestVersion),W.createElement("span",{className:"mpi-status",role:"status","data-kind":c.kind,...c.kind==="update"?{style:{color:"#e8b15a"}}:{}},c.message)),W.createElement("dt",null,c.copy.profile),W.createElement("dd",null,W.createElement("span",{className:"mpi-mono"},c.profileName))),c.busy?W.createElement("div",{className:"dssm-update-progress",role:"progressbar","aria-busy":"true"},W.createElement("div",{className:"dssm-update-progress-bar"})):null,W.createElement("section",{className:"mpi-manual"},W.createElement("h3",null,c.copy.manual),W.createElement("p",null,c.copy.manualHint),W.createElement("div",{className:"mpi-command"},W.createElement("code",null,y),W.createElement(sn.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")},N)))))}e(ii,"UpdateDialog");function Ba(t){if(typeof document>"u"||document.body===null)return()=>{};let r=fn(t.endpoint);ri();let i=new AbortController,a,o,g,c,k,y,N;function w(){g?.unmount(),g=void 0,o=void 0,c=void 0}e(w,"unmountCheck");function f(){if(g===void 0)return;c===void 0&&(c=t.createIcon("refresh"));let le=c;g.render(W.createElement(sn.Button,{variant:"outline",size:"sm",onClick:M,icon:W.createElement(si,{node:le})},W.createElement("span",{"data-mpi-label":""},Dn(document.documentElement.lang).check)))}e(f,"renderCheck");function S(){y?.unmount(),y=void 0,k?.remove(),k=void 0}e(S,"closeDialog");function M(){S();let le=document.createElement("div");le.className="mpi-dialog-root",document.body.append(le),k=le,y=Pa(le),y.render(W.createElement(ii,{flow:Da(V=>Fa(r,V,i.signal),a,V=>{a=V,R()}),packageName:t.packageName,zhName:t.zhName,enName:t.enName,ruName:t.ruName,onClose:S}))}e(M,"openDialog");function R(){let le=document.querySelector(t.titleRowSelector);if(le===null)return;let V=le.querySelector("h1,h2"),fe=le.querySelector(t.linksSelector);if(t.isEnabled&&!t.isEnabled()){if(k!==void 0&&S(),fe!==null){let ae=fe.querySelector(`[data-mpi-check="${t.packageName}"]`);ae!==null&&(w(),ae.remove())}if(V!==null){let ae=V.querySelector(`.mpi-version[data-package="${t.packageName}"]`);ae!==null&&ae.remove()}return}if(V!==null&&a!==void 0){let ae=V.querySelector(`.mpi-version[data-package="${t.packageName}"]`);ae===null&&(ae=document.createElement("span"),ae.className="mpi-version",ae.dataset.package=t.packageName,V.append(ae));let X=`v${a.currentVersion}`;ae.textContent!==X&&(ae.textContent=X)}if(o!==void 0&&!o.isConnected&&w(),fe===null)return;let he=fe.querySelector(`[data-mpi-check="${t.packageName}"]`);if(he!==null){let ae=he.querySelector("[data-mpi-label]");(ae===null||ae.textContent!==Dn(document.documentElement.lang).check)&&f();return}let et=document.createElement("span");et.dataset.mpiCheck=t.packageName,et.className="mpi-check-host",fe.append(et),o=et,g=Pa(et),f()}e(R,"applyControls");let U=new MutationObserver(()=>{N===void 0&&(N=window.requestAnimationFrame(()=>{N=void 0,R()}))});U.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["lang"]});let z,H=e(async()=>z||(z=(async()=>{try{return a=await Fa(r,"GET",i.signal),R(),a}finally{z=void 0}})(),z),"load"),me=e(()=>{R(),(!t.isEnabled||t.isEnabled())&&H().catch(()=>{})},"onToggle");return typeof window<"u"&&window.addEventListener("dsham-update-toggle",me),R(),H().catch(()=>{}),()=>{i.abort(),U.disconnect(),S(),w(),typeof window<"u"&&window.removeEventListener("dsham-update-toggle",me),N!==void 0&&window.cancelAnimationFrame(N),document.querySelectorAll(`[data-mpi-check="${t.packageName}"],.mpi-version[data-package="${t.packageName}"]`).forEach(le=>le.remove())}}e(Ba,"observePluginUpdate");var on=require("@deepseek-ai/dsh-client-ui-primitives");var He=la,oi="@michengai/dsh-archive-manager",vr="archived-sessions",li=4,Ha="dsham-sidebar-entry-style",ci=`
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 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"&&lt.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");
22
+ `;function Ua(){if(typeof document>"u"||typeof document.getElementById!="function"||document.getElementById(Ha)!==null||typeof document.createElement!="function")return;let t=document.createElement("style");t.id=Ha,t.textContent=ci,(document.head??document.documentElement)?.appendChild?.(t)}e(Ua,"ensureSidebarEntryStyle");function di(t){let r=t&&typeof t.size=="number"?t.size:16;return He(on.IconArchiveOutlineMedium,{size:r})}e(di,"ArchiveSidebarIcon");function br(t){Ua();let{t:r,location:i,onLocationChange:a,errorMessage:o,enabled:g=!1,onToggle:c,disabled:k,onlineUpdateEnabled:y=!0,onToggleOnlineUpdate:N,onlineUpdateDisabled:w,onlineUpdateLocked:f=!1,sidebarFavoriteStarEnabled:S=!0,onToggleSidebarFavoriteStar:M,sidebarFavoriteStarDisabled:R}=t,U=i??(g?"both":"settings"),z=e(me=>{(me==="both"||me==="sidebar"||me==="settings")&&(typeof a=="function"?a(me):typeof c=="function"&&c(me!=="settings"))},"handleLocationChange"),H=[He("div",{key:"entry-location",className:"dsham_bundle_row"},He("div",{className:"dsham_bundle_label_box"},He("span",{className:"dsham_bundle_title"},r("entry.location.title")),He("span",{className:"dsham_bundle_desc"},r("entry.location.desc")),o?He("span",{className:"dsham_bundle_error",role:"alert"},o):null),He(on.SegmentedControl,{id:"dsham-bundle-entry-location",value:U,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 N=="function"){let me=f?`${r("update.entry.desc")} (${r("update.entry.locked")})`:r("update.entry.desc");H.push(He("div",{key:"online-update",className:"dsham_bundle_row"},He("div",{className:"dsham_bundle_label_box"},He("span",{className:"dsham_bundle_title"},r("update.entry.title")),He("span",{className:"dsham_bundle_desc"},me)),He(on.Switch,{checked:y,onChange:N,label:r("update.entry.toggle"),disabled:w||f,title:f?r("update.entry.locked"):void 0})))}return typeof M=="function"&&H.push(He("div",{key:"sidebar-favorite-star",className:"dsham_bundle_row"},He("div",{className:"dsham_bundle_label_box"},He("span",{className:"dsham_bundle_title"},r("sidebar.favoriteStar.title")),He("span",{className:"dsham_bundle_desc"},r("sidebar.favoriteStar.desc"))),He(on.Switch,{checked:S,onChange:M,label:r("sidebar.favoriteStar.toggle"),disabled:R}))),He(oa,null,H)}e(br,"ArchiveBundleConfigCard");function yr(t){let[r,i]=qt(t.getLocation),[a,o]=qt(t.getOnlineUpdateEnabled?t.getOnlineUpdateEnabled:()=>!0),[g,c]=qt(t.getOnlineUpdateLocked?t.getOnlineUpdateLocked:()=>!1),[k,y]=qt(t.getSidebarFavoriteStarEnabled?t.getSidebarFavoriteStarEnabled:()=>!0),[N,w]=qt(null),[f,S]=qt(!1),[M,R]=qt(!1),[U,z]=qt(!1);ca(()=>{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(fe=>{console.error("archive-manager: setLocation failed:",fe),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"),me=t.setOnlineUpdate?V=>{t.getOnlineUpdateLocked?.()||(R(!0),o(V),t.setOnlineUpdate(V).catch(()=>{t.getOnlineUpdateEnabled&&o(t.getOnlineUpdateEnabled())}).finally(()=>{R(!1)}))}:void 0,le=t.setSidebarFavoriteStar?V=>{z(!0),y(V),t.setSidebarFavoriteStar(V).catch(()=>{t.getSidebarFavoriteStarEnabled&&y(t.getSidebarFavoriteStarEnabled())}).finally(()=>{z(!1)})}:void 0;return He(br,{t:t.t,location:r,errorMessage:N,disabled:f,onLocationChange:H,onlineUpdateEnabled:a,onlineUpdateDisabled:M||g,onlineUpdateLocked:g,onToggleOnlineUpdate:me,sidebarFavoriteStarEnabled:k,sidebarFavoriteStarDisabled:U,onToggleSidebarFavoriteStar:le})}e(yr,"ArchiveBundleConfigCardWrapper");function wr(t,r){if(Ua(),!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,g="settings",c=!1,k=!1,y=null,N=null,w=0,f=!1,S,M=new Set,R=e(()=>g==="both"||g==="sidebar","isSidebarEnabled"),U=e(()=>g==="both"||g==="settings","isSettingsSectionEnabled"),z=e(()=>{if(!f)for(let O of M)try{O()}catch{}},"notify"),H=e(()=>{if(f||!k||!R()||y)return;let O=t.slots.register({name:"main",key:vr,locale:o,inject:e(()=>{let Le=typeof r.injectProps=="function"?r.injectProps():{};return Object.assign({t:t.locale?.bind?t.locale.bind(o):void 0},Le)},"inject")},Le=>He("div",{className:"dsham_mainPanel"},a(Le)));y=typeof O=="function"?O:()=>{}},"mountMain"),me=e(()=>{if(y){try{y()}catch{}y=null}},"unmountMain"),le=e(()=>{if(f||!c||!R()||N)return;let O=t.slots.register({name:"sidebar.panellist",id:vr,order:li,label:e(()=>t.locale.bind(o)("archives.title"),"label"),locale:o},Le=>di(Le&&typeof Le=="object"&&"size"in Le?Le:void 0));N=typeof O=="function"?O:()=>{}},"mountRow"),V=e(()=>{if(N){try{N()}catch{}N=null}},"unmountRow"),fe=e(()=>{if(!f)if(R())H(),le();else{if(S?.panelInfo&&typeof S.selectPanel=="function")try{S.panelInfo.getSnapshot().activePanelId===vr&&S.selectPanel(null)}catch{}V(),me()}},"sync"),he=e(async O=>{if(f)return g;let Le=++w,T=g;if(g=O,fe(),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(pe){if(Le===w&&(g=T,fe(),z(),typeof r.onLocationChange=="function"))try{r.onLocationChange(T)}catch{}throw pe}},"setLocation"),et=e(async O=>(await he(O?"both":"settings"),R()),"setEnabled"),ae=!0,X=!1,gt=0,yt=e(async O=>{if(f||X)return ae;let Le=++gt;if(ae=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})}),Le===gt&&typeof r.onOnlineUpdateChange=="function")try{r.onOnlineUpdateChange(O)}catch{}return O}catch(T){if(Le===gt&&(ae=!O,z(),typeof r.onOnlineUpdateChange=="function"))try{r.onOnlineUpdateChange(!O)}catch{}throw T}},"setOnlineUpdate"),Je=!0,ot=0,Ne=e(async O=>{if(f)return Je;let Le=++ot;if(Je=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(Le===ot&&(Je=!O,z(),typeof r.onSidebarFavoriteStarChange=="function"))try{r.onSidebarFavoriteStarChange(!O)}catch{}throw T}},"setSidebarFavoriteStar"),Ft=w;i("/sidebar-entry").then(O=>{if(!f&&w===Ft&&O&&(O.location==="both"||O.location==="sidebar"||O.location==="settings"?g=O.location:typeof O.enabled=="boolean"&&(g=O.enabled?"both":"settings"),fe(),z(),typeof r.onLocationChange=="function"))try{r.onLocationChange(g)}catch{}}).catch(()=>{});let vt=gt;i("/online-update").then(O=>{if(!f&&gt===vt&&O&&typeof O.enabled=="boolean"&&(ae=O.enabled,O.locked===!0&&(X=!0),z(),typeof r.onOnlineUpdateChange=="function"))try{r.onOnlineUpdateChange(ae)}catch{}}).catch(()=>{});let Dt=ot;i("/sidebar-favorite-star").then(O=>{if(!f&&ot===Dt&&O&&typeof O.enabled=="boolean"&&(Je=O.enabled,z(),typeof r.onSidebarFavoriteStarChange=="function"))try{r.onSidebarFavoriteStarChange(Je)}catch{}}).catch(()=>{});let ln=t;return typeof ln.inject=="function"&&ln.inject(["layout"],O=>{!f&&O.layout&&(S=O.layout)}),t.slots.inject("main",()=>{if(!f)return k=!0,H(),()=>{k=!1,me()}}),t.slots.inject("sidebar.panellist",()=>{if(!f)return c=!0,le(),()=>{c=!1,V()}}),t.slots.inject("plugins.bundle.config",()=>{if(!f)return t.slots.register({name:"plugins.bundle.config",key:oi,locale:o},O=>O&&O.view==="summary"?null:He(yr,{t:t.locale.bind(o),getLocation:e(()=>g,"getLocation"),setLocation:he,getEnabled:e(()=>R(),"getEnabled"),setSidebar:et,getOnlineUpdateEnabled:e(()=>ae,"getOnlineUpdateEnabled"),setOnlineUpdate:yt,getOnlineUpdateLocked:e(()=>X,"getOnlineUpdateLocked"),getSidebarFavoriteStarEnabled:e(()=>Je,"getSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:Ne,subscribe:e(Le=>(M.add(Le),()=>{M.delete(Le)}),"subscribe")}))}),{getLocation:e(()=>g,"getLocation"),setLocation:he,isSettingsSectionEnabled:U,isEnabled:e(()=>R(),"isEnabled"),isSupported:e(()=>c,"isSupported"),setEnabled:et,isOnlineUpdateEnabled:e(()=>ae,"isOnlineUpdateEnabled"),isOnlineUpdateLocked:e(()=>X,"isOnlineUpdateLocked"),setOnlineUpdate:yt,isSidebarFavoriteStarEnabled:e(()=>Je,"isSidebarFavoriteStarEnabled"),setSidebarFavoriteStar:Ne,destroy:e(()=>{f||(f=!0,w++,gt++,ot++,S=void 0,M.clear(),V(),me())},"destroy")}}e(wr,"setupSidebarEntry");function Sr(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(Sr,"checkedId");var ui={parse(t){let r=ce(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:Sr(r.sessionId),favorite:r.favorite}}},hi={parse(t){let r=ce(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(Sr))]}},safeParse(t){try{return{success:!0,data:this.parse(t)}}catch(r){return{success:!1,error:r}}}};function Wa(){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",ui)}],result:t("FavoriteState",hi),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}))}e(Wa,"favoriteInvocations");function xr(t,{days:r,now:i=Date.now(),favorites:a=new Set,currentId:o,pending:g=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||g.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(xr,"idleArchiveCandidate");async function Zn(t,r,{onProgress:i,refresh:a}={}){let o=[...new Set(t.map(Sr))],g={requested:o,succeeded:[],skipped:[],failures:[],remaining:[],refreshError:null},c=e(()=>i?.({total:o.length,done:g.succeeded.length+g.skipped.length+g.failures.length,succeeded:g.succeeded.length,skipped:g.skipped.length,failed:g.failures.length}),"report");c();for(let k of o){try{(await r(k)?g.succeeded:g.skipped).push(k)}catch(y){g.failures.push({sessionId:k,message:y instanceof Error?y.message:String(y)}),g.remaining.push(k)}c()}try{await a?.()}catch(k){g.refreshError=k instanceof Error?k.message:String(k)}return g}e(Zn,"runSessionBatch");function qa({workspaces:t,sessions:r,archive:i,restore:a,deleteOne:o,getFavorites:g,refresh:c,currentSessionId:k}){return async(y,N,w={})=>{if(!["archive","restore","undo","delete"].includes(y))throw new TypeError("\u672A\u77E5\u6279\u91CF\u64CD\u4F5C");return Zn(N,async f=>{let M=t.getSnapshot().archivedSessionIds.includes(f);if(y==="archive"){if(M||!r.getSnapshot().byId[f])return!1;if(w.idleDays!==void 0){let me=new Set((await g()).favoriteSessionIds),le=r.getSnapshot();if(!xr(le.byId[f],{days:w.idleDays,favorites:me,currentId:k(le),pending:w.getPending?.()??w.pending}))return!1}return await i(f),t.getSnapshot().archivedSessionIds.includes(f)}return M?y==="delete"?(await o(f),!0):!((await a(f))?.archivedSessionIds??t.getSnapshot().archivedSessionIds).includes(f):!1},{onProgress:w.onProgress,refresh:c})}}e(qa,"createSessionOrganizer");function pi(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(pi,"formatBytes");function Va(t,r){let i=t.createElement;function a(g,c){return i(r??(y=>i("button",{type:"button",disabled:y.disabled,onClick:y.onClick},y.children)),{variant:"outline",size:"sm",...c},g)}e(a,"textButton");function o({title:g,failures:c,separator:k}){let[y,N]=t.useState(!1),w=i("ul",null,c.map(f=>i("li",{key:f.sessionId},f.sessionId,k,f.message)));return i($n,{title:g,open:y,onToggle:e(()=>N(f=>!f),"onToggle")},w)}return e(o,"FailureDetails"),e(function({t:c,archived:k,busy:y,ready:N,days:w,onDays:f,count:S,onPreview:M,progress:R,result:U,onRetry:z,undoCount:H,onUndo:me,onReload:le,orphanCount:V=0,orphanSizeBytes:fe=0,orphanCleaning:he=!1,onCleanOrphans:et,cacheCount:ae=0,cacheRepair:X,onRebuildCaches:gt,onRetryCaches:yt,onReloadCaches:Je,onDismissCaches:ot}){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||!N)&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},!N&&a(c("organizer.reloadFavorites"),{disabled:y,onClick:le}),!k&&i(t.Fragment,null,i("label",null,c("organizer.idleDays"),i(ua,{min:1,max:36500,value:w===""?null:Number(w),disabled:y,"aria-label":c("organizer.idleDays"),onChange:e(Ne=>f(Ne==null?"":String(Ne)),"onChange")})),a(c("organizer.preview",{n:S}),{disabled:y||!N||S===0,onClick:M}))),!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})),et&&a(c(he?"organizer.cleaning":"organizer.cleanOrphans"),{disabled:y||he,onClick:et})),i("p",null,c("organizer.orphanDesc",{size:pi(fe)}))),ae>0&&i("div",{className:"dsham_organizer"},i("div",{className:"dsham_organizerControls"},i("strong",null,c("organizer.cacheTitle",{n:ae})),gt&&a(c(X?.busy?"organizer.cacheRebuilding":"organizer.cacheRebuild"),{disabled:y||X?.busy,onClick:gt})),i("p",null,c("organizer.cacheDesc"))),X&&(X.result||X.progress||X.error||X.refreshError)&&i("section",{className:"dsham_batchFeedback","aria-label":c("organizer.cacheRebuild")},X.progress&&i("div",{role:"status"},i("progress",{value:X.progress.done,max:Math.max(1,X.progress.total)}),c("organizer.progressCount",X.progress)),X.result&&i("div",{role:"status"},i("p",null,c("organizer.result",{succeeded:X.result.rebuiltSessionIds.length,skipped:X.result.skippedSessionIds.length,failed:X.result.failures.length})),X.result.failures.length>0&&i(o,{title:c("organizer.failureDetails"),failures:X.result.failures,separator:c("common.separator")}),X.result.failures.length>0&&yt&&a(c("organizer.cacheRetry",{n:X.result.failures.length}),{disabled:y||X.busy,onClick:yt})),X.error&&i("p",{role:"alert"},c("organizer.cacheError",{detail:X.error})),X.refreshError&&i("p",{role:"alert"},c("organizer.refreshError",{detail:X.refreshError})),i("div",{className:"dsham_organizerControls"},Je&&a(c("organizer.cacheCheck"),{disabled:y||X.busy,onClick:Je}),ot&&a(c("organizer.dismiss"),{disabled:y||X.busy,onClick:ot}))),(R||U||H>0)&&i("section",{className:"dsham_batchFeedback","aria-label":c("organizer.feedback")},R&&i("div",{role:"status","aria-live":"polite"},i("progress",{value:R.done,max:Math.max(1,R.total),"aria-label":c("organizer.progress")}),c("organizer.progressCount",{done:R.done,total:R.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:z})),H>0&&i("div",{className:"dsham_organizerControls"},a(c("organizer.undo",{n:H}),{disabled:y,onClick:me}),i("p",null,c("organizer.undoHint")))))},"OrganizerPanel")}e(Va,"createOrganizerPanel");var $a={"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"},Ga={"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."},Ka={"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 gn=Function("return globalThis.__dshArchiveReactDOM")(),Ya=Function("return globalThis.__dshArchiveReactDOMClient")(),Za=gn.createPortal,Lo=gn.flushSync,zo=Ya?.createRoot,Po=Ya?.hydrateRoot,Oo=gn.findDOMNode,Fo=gn.unmountComponentAtNode,Bo=gn.unstable_batchedUpdates,Ho=gn.version;function mi(t){var r={exports:{}},i=r.exports;Object.defineProperty(i,Symbol.toStringTag,{value:"Module"});let a=t("react/jsx-runtime"),o=t("react"),g=t("react-dom"),c=t("@deepseek-ai/dsh-client-ui-primitives");function k(n){try{return typeof n("contextMenus")?.register=="function"}catch{return!1}}e(k,"hasNativeContextMenuService");function y({open:n,onClose:s,title:l,description:h,footer:v,children:m,className:C,width:E,portalToBody:j=!1,closeLabel:F,t:A}){let P=o.useRef(null),B=o.useCallback(()=>P.current?.closest(".dsham_settings")??document.body,[]),[u,Ee]=o.useState(null);o.useEffect(()=>{if(!n){Ee(null);return}Ee(j?typeof document<"u"?document.body:null:B())},[n,B,j]),o.useEffect(()=>{if(!n)return;let wt=e(lt=>{lt.key==="Escape"&&(lt.preventDefault(),lt.stopPropagation(),"stopImmediatePropagation"in lt&&typeof lt.stopImmediatePropagation=="function"&&lt.stopImmediatePropagation(),s())},"onKey");return window.addEventListener("keydown",wt,!0),()=>window.removeEventListener("keydown",wt,!0)},[n,s]);let ze=F||A("common.close"),ge=(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:ns("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)(N,{refObject:P,getContainer:B}),n&&u?Za(ge,u):null]})}e(y,"SettingsModal");function N({refObject:n,getContainer:s}){return(0,a.jsx)("span",{hidden:!0,ref:n,"data-get-container":s})}e(N,"SettingsModalAnchor");function w({variant:n="outline",icon:s,children:l,className:h,disabled:v,title:m,onClick:C,"aria-label":E,"aria-pressed":j,"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":j,"aria-expanded":F,"aria-haspopup":A,icon:s,children:l})}e(w,"settingsButton");function f({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(f,"modalFooterButton");function S(n,s){let l={className:n?"dsham_archiveTabsLocked":void 0,children:s};return n&&(l.inert=""),l}e(S,"tabsShell");let M=Va(o,c.Button),{HighlightedText:R,useArchiveSearch:U,useArchivePreview:z,DiscoveryFilters:H,SearchStatus:me,PreviewContent:le}=Sa(o,{Button:c.Button,SegmentedControl:c.SegmentedControl}),V={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 fe(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 V[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(fe,"createPluginUpdateIcon");let he={parse(n){if(typeof n!="string"||n.length===0)throw new TypeError(`sessionId must be a non-empty string, got ${String(n)}`);return n}},et={parse(n){let s=ce(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}},ae={parse(n){let s=ce(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.deleted!==!0)throw new TypeError("deleted must be true");return s}},X={parse(n){let s=ce(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")}},gt={parse(n){let s=ce(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}},yt={parse(n){let s=ce(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}},Je={parse(n){let s=ce(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}}},ot={parse(n){let s=ce(n);if(!s||s.ok!==!0)throw new TypeError("session move result must be ok: true");return s}};function Ne(n,s){return{mode:"strict",typeSymbol:n,create:e(()=>s,"create"),schema:s}}e(Ne,"strictCodec");let Ft={package:"@michengai/dsh-archive-manager",descriptors:[...Wa(),...va(),...Ta(),{id:"@michengai/dsh-archive-manager#workspaceRegistry/unarchiveSession",service:"workspaceRegistry",namespace:"workspaceRegistry",method:"unarchiveSession",invocation:{kind:"direct"},parameters:[{name:"sessionId",wire:"sessionId",source:"json",codec:Ne("@deepseek-ai/dsh-session/types#SessionId",he)}],result:Ne("@michengai/dsh-archive-manager/types#ArchivedSessionIds",et),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:Ne("@deepseek-ai/dsh-session/types#SessionId",he)}],result:Ne("@michengai/dsh-archive-manager/types#Deleted",ae),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:Ne("@michengai/dsh-archive-manager/types#ArchivedBatchTarget",X)}],result:Ne("@michengai/dsh-archive-manager/types#DeletedBatch",gt),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:Ne("@michengai/dsh-archive-manager/types#ArchivedSessionMetadata",yt),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:Ne("@michengai/dsh-archive-manager/types#OrphanSubagentDiagnosis",{parse(n){let s=ce(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:Ne("@michengai/dsh-archive-manager/types#CleanOrphanTarget",{parse(n){if(n==null)return{};let s=ce(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:Ne("@michengai/dsh-archive-manager/types#CleanOrphanResult",{parse(n){let s=ce(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:Ne("@michengai/dsh-archive-manager/types#SessionMoveInput",Je)}],result:Ne("@michengai/dsh-archive-manager/types#SessionMoveResult",ot),sourceLocation:{file:"@michengai/dsh-archive-manager/lib/workspace.js",line:1,column:1}}]};function vt(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(vt,"ensurePluginStyle");function Dt(n){if(typeof document>"u")return;document.querySelector("style[data-plugin-css="+JSON.stringify(n)+"]")?.remove()}e(Dt,"removePluginStyle"),vt("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)}"),vt("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}"),vt("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}"),vt("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}"),vt("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}"),vt("dsh-archive-manager/WorkspaceMenuGroup.css",'div:has([data-dsham-archive-icon]) + div[role="separator"],div:has([data-dsham-archive-icon]) + div[class*="separator"],div:has(svg[data-dsham-archive-icon]) + div[role="separator"],div:has(svg[data-dsham-archive-icon]) + [class*="separator"]{display:none!important}');let _t="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 vn(n){return n?'<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="'+_t+'"/></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="'+_t+'"/></svg>'}e(vn,"starSvg");function Ln(n){return!!n?.querySelector("[data-state]")}e(Ln,"resolveRowHasStatus");let Bt="[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}";vt("dsh-archive-manager/RowFavorite.css",Bt);let zn="dsh-archive-manager:workspace-favorites-only",K="data-dsham-favorites-hidden",Me="data-dsham-favorites-only",bt="dsham_rowStar",Vt="dsham_starSlot",Ja=["\u4EC5\u663E\u793A\u5DF2\u5F52\u6863","Archived only","\u0422\u043E\u043B\u044C\u043A\u043E \u0430\u0440\u0445\u0438\u0432\u043D\u044B\u0435"];vt("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 Xa(){try{return window.localStorage.getItem(zn)==="1"}catch{return!1}}e(Xa,"readWorkspaceFavoritesOnly");function Qa(n){try{window.localStorage.setItem(zn,n?"1":"0")}catch{}}e(Qa,"writeWorkspaceFavoritesOnly");function kr(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(kr,"favoritesOnlyVisibility");function Cr(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(Cr,"favoriteGroupPredicate");function Er(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=Xa(),C=typeof h=="function"?h():!0,E=!1,j=!1,F=e(()=>{C?vt("dsh-archive-manager/RowFavorite.css",Bt):Dt("dsh-archive-manager/RowFavorite.css")},"updateStarStyle");F();let A=e(q=>{let De=q;typeof De?.detail?.enabled=="boolean"?C=De.detail.enabled:typeof h=="function"&&(C=h()),F(),it()},"onStarToggle");typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("dsham-favorite-star-toggle",A);let P=0,B=200,u=null,Ee=new Set,ze=e(q=>{if(!C){for(let te of q)Array.from(te.children).find(Pe=>Pe.classList.contains(Vt))?.remove(),te.removeAttribute("data-dsham-favorited"),te.removeAttribute("data-dsham-has-status");return}let De=s.getSnapshot();for(let te of q){let Y=te.getAttribute("data-row-key")??"";if(!Y.startsWith("session:"))continue;let Pe=Y.slice(8),nt=Array.from(te.children).find(Ke=>Ke.tagName==="SPAN"&&Array.from(Ke.classList).some(Lt=>Lt==="slot"||Lt.endsWith("_slot")))??null;if(nt===null){te.removeAttribute("data-dsham-has-status");continue}let L=Array.from(te.children).find(Ke=>Ke.classList.contains(Vt))??null;if(!De.ready){L?.remove(),te.removeAttribute("data-dsham-favorited"),te.removeAttribute("data-dsham-has-status");continue}L!==null&&(L.parentElement!==te||L.nextElementSibling!==null)&&te.appendChild(L),L===null&&(L=document.createElement("span"),L.className=Vt,te.appendChild(L)),L.dataset.sessionId=Pe,Ln(nt)?te.setAttribute("data-dsham-has-status","true"):te.removeAttribute("data-dsham-has-status");let ke=L.querySelector("."+bt);ke===null&&(ke=document.createElement("button"),ke.type="button",ke.className=bt,ke.addEventListener("click",Ke=>{Ke.preventDefault(),Ke.stopPropagation(),s.toggle(L?.dataset.sessionId??"")}),L.appendChild(ke));let Ue=De.ids.has(Pe);if(Ue?te.setAttribute("data-dsham-favorited","true"):te.removeAttribute("data-dsham-favorited"),L.dataset.favorited===String(Ue))continue;let ct=l()(Ue?"organizer.unfavorite":"organizer.favorite");L.dataset.favorited=String(Ue),ke.setAttribute("aria-pressed",String(Ue)),ke.setAttribute("aria-label",ct),ke.title=ct,ke.innerHTML=vn(Ue)}},"ensureRowStars"),ge=e(q=>{let De=s.getSnapshot();if(!m||!De.ready){for(let L of q)L.hasAttribute(K)&&L.removeAttribute(K);P=0,u=null,Ee.clear();return}let te=q.map(L=>L.getAttribute("data-row-key")??""),Y=Cr(De.ids,n.workspaces.list?.getSnapshot?.()?.items??[]),Pe=kr(te,{favorites:De.ids,sessions:n.sessions.list?.getSnapshot?.()?.byId,groupHasFavorite:Y});u!==null&&(q.length<=u.rows&&Ee.add(u.key),u=null);let nt=!1;if(P<B)for(let L=0;L<q.length;L+=1){let Re=q[L],ke=te[L];if(!ke.startsWith("overflow:")||Re.getAttribute("aria-expanded")!=="false")continue;let Ue=ke.slice(9);if(!(Ee.has(Ue)||!Y(Ue))){try{Re.click(),P+=1,u={key:Ue,rows:q.length},nt=!0}catch(ct){console.warn("archive-manager: favorites-only expand failed",ct)}break}}for(let L=0;L<q.length;L+=1){let Re=q[L];Pe[L]?Re.hasAttribute(K)&&Re.removeAttribute(K):Re.setAttribute(K,"true")}nt&&it()},"applyVisibility"),wt=e(q=>{let De=q.parentElement;if(De===null)return null;let te=De.cloneNode(!0),Y=te.querySelector('button[role="menuitem"]');if(Y===null)return null;let Pe=Array.from(Y.querySelectorAll("span")),nt=Pe[0]??null,L=Pe[Pe.length-1]??null;nt!==null&&(nt.innerHTML=vn(!1)),L!==null&&(L.textContent=l()("organizer.favoritesOnly"));for(let Re of Array.from(Y.querySelectorAll("svg")))Re.closest("span")===null&&Re.remove();return Y.setAttribute(Me,"true"),Y.setAttribute("role","menuitemcheckbox"),Y.dataset.active=String(m),Y.setAttribute("aria-checked",String(m)),Y.setAttribute("aria-label",l()("organizer.favoritesOnly")),Y.onclick=Re=>{Re.preventDefault(),Re.stopPropagation(),cn(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0}))},te},"buildMenuRow"),lt=e(()=>{if(!E){for(let q of Array.from(document.querySelectorAll("button["+Me+"]")))q.dataset.active=String(m),q.setAttribute("aria-checked",String(m));for(let q of Array.from(document.querySelectorAll('[role="menu"]'))){let De=Array.from(q.querySelectorAll('button[role="menuitem"]')).find(Pe=>Ja.some(nt=>(Pe.textContent??"").includes(nt)));if(De===void 0||q.querySelector("["+Me+"]")!==null)continue;let te=De.parentElement;if(te===null)continue;let Y=wt(De);Y!==null&&te.parentElement?.insertBefore(Y,te.nextSibling)}}},"injectMenuRows"),it=e(()=>{if(j||E)return;j=!0;let q=e(()=>{if(j=!1,E)return;let De=Array.from(document.querySelectorAll("[data-row-key]"));lt(),ze(De),ge(De),s.getSnapshot().ready||dn()},"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(q):setTimeout(q,16)},"schedulePass"),cn=e(()=>{m=!m,Ge=20,P=0,u=null,Ee.clear(),Qa(m),it()},"toggle"),tt=null,Ge=20,dn=e(()=>{tt!==null||E||Ge<=0||(Ge-=1,tt=setTimeout(()=>{tt=null,s.ensure(),it()},600))},"scheduleRetry"),Et=new MutationObserver(q=>{Un(q,'[data-row-key], [role="menu"]')&&it()});Et.observe(document.body,{childList:!0,subtree:!0}),s.ensure().catch(()=>{});let jt=[s.subscribe(()=>it()),typeof n.sessions.list?.subscribe=="function"?n.sessions.list.subscribe(()=>it()):null,typeof n.workspaces.list?.subscribe=="function"?n.workspaces.list.subscribe(()=>it()):null].filter(q=>typeof q=="function");return it(),{dispose(){E=!0,typeof window<"u"&&typeof window.removeEventListener=="function"&&window.removeEventListener("dsham-favorite-star-toggle",A),Et.disconnect();for(let q of jt)q();for(let q of Array.from(document.querySelectorAll("["+K+"]")))q.removeAttribute(K);for(let q of Array.from(document.querySelectorAll("["+Me+"]")))q.parentElement?.remove();for(let q of Array.from(document.querySelectorAll("."+Vt)))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");tt!==null&&(clearTimeout(tt),tt=null)},setFavoriteStarEnabled(q){C=q,F(),it()},isFavoriteStarEnabled:e(()=>C,"isFavoriteStarEnabled")}}e(Er,"setupWorkspaceFavoritesOnly");function Ir(){let n,s={ready:!1,ids:new Set,pending:new Set},l,h=0,v=new Set,m=e(E=>{s=E;for(let j of v)try{j()}catch(F){console.warn("archive-manager: favorite listener failed",F)}},"publish"),C=e((E,j)=>{let F=new Set(E);for(let u of s.pending)u!==j&&(s.ids.has(u)?F.add(u):F.delete(u));let A=new Set(s.pending);j!==void 0?A.delete(j):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 j=s.ids.has(E),F=!j,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);j?u.add(E):u.delete(E);let Ee=new Set(s.pending);Ee.delete(E),m({ready:!0,ids:u,pending:Ee})}}}}e(Ir,"createFavoriteRowStore");function es(){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(es,"GithubMark16");function ts(){let n=c.IconEditOutlineRegular;return(0,a.jsx)(n,{size:16})}e(ts,"FeedbackIcon");function Pn({archiveSessions:n,archiveSession:s,sessionStore:l,workspaceStore:h,unarchiveSession:v,deleteSession:m,unarchiveSessions:C,deleteArchivedSessions:E,archivedSessionMetadata:j,openConversation:F,focusSessionWorkspace:A,viewState:P,close:B,t:u,diagnoseOrphanSubagents:Ee,cleanOrphanSubagents:ze,diagnoseSessionCaches:ge,rebuildSessionCaches:wt,refreshCacheLists:lt,searchSessionContent:it,searchArchivedContent:cn,previewArchivedSession:tt,favoriteSessions:Ge,setSessionFavorite:dn,favoriteSync:Et,organizeBatch:jt,useSessionPendingInteraction:q,useSessionStatus:De}){let te=(0,o.useSyncExternalStore)(l.subscribe,l.getSnapshot),Y=(0,o.useSyncExternalStore)(h.subscribe,h.getSnapshot),[Pe,nt]=(0,o.useState)("archived"),L=Pe==="archived",[Re,ke]=(0,o.useState)(null),[Ue,ct]=(0,o.useState)(null),[Ke,Lt]=(0,o.useState)(null),yn=e((d,x=null)=>{G(null),We(null),Oe(!1),ct(x),ke(d)},"requestArchive"),$t=e(()=>{Q||(ke(null),ct(null),G(null))},"closeArchive"),St=(0,o.useRef)(!1),[Ie,Gt]=(0,o.useState)(null),wn=(0,o.useRef)(!1),[Q,Xe]=(0,o.useState)(!1),[It,G]=(0,o.useState)(null),[Kt,We]=(0,o.useState)(null),un=e(d=>{G(null),We(null),Gt(d)},"requestDelete"),[zt,Sn]=(0,o.useState)(P?.query??""),[xt,Yt]=(0,o.useState)(P?.project??"all"),[Pt,xn]=(0,o.useState)(P?.sortBy??"updated"),[kn,Cn]=(0,o.useState)({}),[Zt,En]=(0,o.useState)(()=>new Set),Nt=(0,o.useRef)(new Set),[dt,Tt]=(0,o.useState)([]),[tn,Ot]=(0,o.useState)([]),[kt,At]=(0,o.useState)(!1),[Ht,In]=(0,o.useState)(!1),nn=(0,o.useRef)(!1),[Jt,Tn]=(0,o.useState)(!1),[p,b]=o.useState("content"),[I,$]=o.useState(""),[ve,se]=o.useState(""),[Te,de]=(0,o.useState)(()=>new Set),[oe,Ae]=(0,o.useState)("30"),[qe,Oe]=(0,o.useState)(!1),[je,ne]=(0,o.useState)(null),[ie,D]=(0,o.useState)(null),[ee,ue]=(0,o.useState)([]),Z=(0,o.useRef)(!1),be=(0,o.useRef)(null),Ce=ds(q??os,De??ls,typeof De=="function"),Ye=(0,o.useRef)(Ce.pending);Ye.current=Ce.pending;let Ve=(0,o.useMemo)(()=>new Set(tn),[tn]),$e=e(async()=>{if(Ge)try{let d=await Ge();Ot(d.favoriteSessionIds),At(!0),Et?.adopt(d.favoriteSessionIds)}catch(d){At(!1),G(Be(d))}},"loadFavorites");(0,o.useEffect)(()=>{let d=!0;return Ge&&Ge().then(x=>{d&&(Ot(x.favoriteSessionIds),At(!0),Et?.adopt(x.favoriteSessionIds))}).catch(x=>{d&&G(Be(x))}),()=>{d=!1}},[Ge]),(0,o.useEffect)(()=>{if(Et)return Et.subscribe(()=>{let d=Et.getSnapshot();d.ready&&(Ot([...d.ids]),At(!0))})},[Et]);let re=e(async d=>{if(!(nn.current||Q||!kt)){nn.current=!0,In(!0),G(null);try{let x=await dn({sessionId:d,favorite:!Ve.has(d)});Ot(x.favoriteSessionIds),Et?.adopt(x.favoriteSessionIds)}catch(x){G(Be(x))}finally{nn.current=!1,In(!1)}}},"toggleFavorite"),xe=e(async(d,x,{idle:J=!1,retry:we=!1}={})=>{if(!(Z.current||nn.current||Nt.current.size>0||!jt)){Z.current=!0,Xe(!0),G(null),We(null),D(null),d==="archive"&&!we&&ue([]);try{let _=await jt(d,x,{idleDays:J?Number(oe):void 0,getPending:e(()=>Ye.current,"getPending"),onProgress:e(Se=>{ne(Se),d==="archive"&&Se.total>0&&Se.done>=Se.total&&(ke(null),ct(null),Oe(!1))},"onProgress")});return D({..._,kind:d,tab:Pe}),be.current=_.remaining.length?{kind:d,ids:_.remaining,idle:J}:null,d==="archive"&&ue(Se=>[...new Set([...Se,..._.succeeded])]),(d==="undo"||d==="restore"||d==="delete")&&ue(Se=>Se.filter(ft=>!_.succeeded.includes(ft)&&!_.skipped.includes(ft))),Tt(Se=>Se.filter(ft=>!_.succeeded.includes(ft)&&!_.skipped.includes(ft))),d==="delete"&&Ot(Se=>Se.filter(ft=>!_.succeeded.includes(ft))),_}catch(_){G(Be(_))}finally{Z.current=!1,Xe(!1),ne(null)}}},"executeBatch"),[Fe,ut]=(0,o.useState)(null),[rt,ye]=(0,o.useState)({diagnosis:{count:0,items:[]},busy:!1,progress:null,result:null,error:null,refreshError:null}),Qe=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!ge||!wt||!lt)return;let d=Aa({diagnose:ge,rebuild:wt,refresh:lt});Qe.current=d;let x=d.subscribe(()=>{ye(d.snapshot())});return d.load(),()=>{x(),d.dispose(),Qe.current=null}},[ge,wt,lt]),(0,o.useEffect)(()=>{Qe.current?.snapshot().busy||Qe.current?.load()},[Y.archivedSessionIds]);let Ut=e(async(d=!1)=>{if(!(Q||Z.current||!Qe.current||Qe.current.snapshot().busy)){Z.current=!0,Xe(!0);try{await Qe.current.run(d)}finally{Z.current=!1,pt.current&&Xe(!1)}}},"runCacheRebuild"),[rn,hn]=(0,o.useState)(!1),Ze=e(()=>{typeof Ee=="function"&&Ee().then(ut).catch(d=>{console.warn("archive-manager: diagnose orphan subagents failed",d)})},"loadOrphans");(0,o.useEffect)(()=>{Ze()},[Y.archivedSessionIds]);let ht=e(async()=>{if(!(rn||typeof ze!="function")){hn(!0),G(null),We(null);try{let d=await ze({});(d.cleanedSessionIds.length>0||d.skippedSessionIds.length>0)&&Ze(),d.failures.length>0?(We(null),G(Fn(d.failures,u))):d.cleanedSessionIds.length>0&&(G(null),We(u("organizer.orphanCleanSuccess",{n:d.cleanedSessionIds.length})))}catch(d){G(Be(d))}finally{hn(!1)}}},"cleanOrphans"),pt=(0,o.useRef)(!0),an=(0,o.useRef)(!1);(0,o.useEffect)(()=>(pt.current=!0,()=>{pt.current=!1}),[]);let Xt=e(async(d,x=!1)=>{if(Q||an.current)return;an.current=!0,Xe(!0),G(null);let J=!1;try{await Ra({prepare:x?async we=>{await A?.(we)}:void 0,restore:e(async we=>{await v(we),J=!0},"restore"),open:e(async we=>{await F(we),pt.current&&B?.()},"open")},d.id,x,()=>pt.current)}catch(we){if(!pt.current)return;if(J){nt("unarchived");let _=Ct.find(Se=>Se.sessions.some(ft=>ft.id===d.id));_!==void 0&&Yt(_.key)}G(_a(we,u))}finally{an.current=!1,pt.current&&Xe(!1)}},"viewConversation");(0,o.useEffect)(()=>{P&&Object.assign(P,{query:zt,project:xt,sortBy:Pt})},[zt,xt,Pt,P]);let mt=(0,o.useMemo)(()=>L?Y.archivedSessionIds:Vr(te.byId,Y.archivedSessionIds),[L,te.byId,Y.archivedSessionIds]),Ct=(0,o.useMemo)(()=>$r(te.byId,Y.items,mt,u("group.ungrouped")),[te.byId,Y,mt,u]),An=e(d=>{Q||Nt.current.size>0||(Mt.close(),nt(d),Tt([]),ke(null),ct(null),G(null),We(null),Yt("all"),Sn(""),d!=="archived"&&Pt==="archived"&&xn("updated"))},"switchTab"),Qt=e(async(d,x=!1)=>{if(!(St.current||Q||!d?.length)){if(jt){St.current=!0;try{let J=await xe("archive",d,{idle:x}),we=J?.failures.map(_=>jr(_.sessionId,_.message)).find(_=>_!==void 0);if(we!==void 0&&typeof s=="function"){let _=te.byId[we.sessionId];Lt({sessionId:we.sessionId,title:_===void 0?we.sessionId:st(_,u),kinds:we.kinds.join(", ")}),ke(null),ct(null),G(null);return}J&&(ke(null),ct(null),Oe(!1))}finally{St.current=!1}return}St.current=!0,Xe(!0),G(null),We(null);try{let J=await n(d);ke(null),ct(null),J.archivedSessionIdsAdded.length>0&&We(u("archives.archiveSuccess",{n:J.archivedSessionIdsAdded.length})),J.failures&&J.failures.length>0?G(Fn(J.failures,u)):(Tt([]),nt("archived"),Yt("all"),Sn(""))}catch(J){let we=Rr(J);if(we!==void 0&&typeof s=="function"){let _=te.byId[we.sessionId];Lt({sessionId:we.sessionId,title:_===void 0?we.sessionId:st(_,u),kinds:we.kinds.join(", ")}),ke(null),ct(null),G(null)}else{let _=Bn(J);G(_===void 0?u("archives.archiveBatchFailed",{detail:J instanceof Error?J.message:String(J)}):u("archives.archiveActive",{kinds:_.join(", ")}))}}finally{St.current=!1,Xe(!1)}}},"performArchive"),pn=e(()=>Qt(Re,qe),"confirmArchive"),As=e(async d=>{G(null),We(null);try{await Kn(d.id),pt.current&&We(u("details.copied"))}catch(x){pt.current&&G(typeof Vn(x)=="string"&&String(Vn(x)).startsWith("copy.")?u(String(Vn(x))):Be(x))}},"copyId"),sr=(0,o.useMemo)(()=>Gr(Ct,Pt,kn,u,L?Y.archivedSessionIds:void 0),[Ct,Pt,kn,u,L,Y.archivedSessionIds]);(0,o.useEffect)(()=>{if(Q)return;let d=!1;return j().then(x=>{d||Cn(Object.fromEntries(x.items.map(J=>[J.sessionId,J.createdAt])))}).catch(()=>{d||Cn({})}),()=>{d=!0}},[j,Y.archivedSessionIds,Q]),(0,o.useEffect)(()=>{xt!=="all"&&!Ct.some(d=>d.key===xt)&&Yt("all")},[Ct,xt]);let Qr=!pr(I,ve),ea=sr.filter(d=>xt==="all"||xt===d.key).map(d=>({...d,sessions:d.sessions.filter(x=>(!Jt||Ve.has(x.id))&&ya(x.updatedAt,I,ve))})).filter(d=>d.sessions.length),ir=p==="content"&&!Qr,_n=U(ea.flatMap(d=>d.sessions.map(x=>x.id)),zt,ir,it??cn),or=new Map(_n.items.map(d=>[d.sessionId,d])),Mt=z(tt,L?Y.archivedSessionIds:[]),ta=zt.trim().toLocaleLowerCase(),Rn=ea.map(d=>({...d,sessions:d.sessions.filter(x=>!ta||st(x,u).toLocaleLowerCase().includes(ta)||or.has(x.id))})).filter(d=>d.sessions.length),na=kt?Rn.flatMap(d=>d.sessions).filter(d=>xr(d,{days:Number(oe),favorites:Ve,currentId:Yn(te),pending:Ce.pending})).map(d=>d.id):[],jn=(0,o.useMemo)(()=>Ur(Rn),[Rn]),lr=(0,o.useMemo)(()=>new Set(dt),[dt]),_s=(0,o.useMemo)(()=>{let d=new Set(Y.archivedSessionIds);return ee.reduce((x,J)=>x+(d.has(J)?1:0),0)},[ee,Y.archivedSessionIds]),cr=jn.filter(d=>lr.has(d)).length,Rs=jn.length>0&&cr===jn.length;(0,o.useEffect)(()=>{Tt(d=>Wr(d,mt))},[mt]);let js=e((d,x)=>{Tt(J=>nr(J,[d],x))},"toggleSessionSelection"),Ns=e(d=>{Tt(x=>nr(x,jn,d))},"toggleVisibleSelection"),Ms=e(d=>{Q||Nt.current.has(d)||(Nt.current.add(d),En(new Set(Nt.current)),G(null),We(null),v(d).catch(x=>{G(Ar(x,u))}).finally(()=>{Nt.current.delete(d),En(new Set(Nt.current))}))},"onUnarchive"),ra=e(async d=>{if(!Q){if(jt){let x=bn(Y.archivedSessionIds,Y.items,d),J=await xe("restore",x);return J&&{unarchivedSessionIds:J.succeeded}}Xe(!0),G(null),We(null);try{let x=await C(d);return x.unarchivedSessionIds.length>0&&We(u("archives.restoreSuccess",{n:x.unarchivedSessionIds.length})),x.failures&&x.failures.length>0&&G(Fn(x.failures,u,Ar)),x}catch(x){G(u("archives.restoreBatchFailed",{detail:x instanceof Error?x.message:String(x)}))}finally{Xe(!1)}}},"onBatchUnarchive"),Ds=e(async()=>{if(dt.length===0)return;let d=await ra({scope:"sessions",sessionIds:dt});if(d!==void 0){let x=new Set(d.unarchivedSessionIds);Tt(J=>J.filter(we=>!x.has(we)))}},"onSelectedUnarchive"),aa=e(()=>{Q||Gt(null)},"closeDelete");(0,o.useEffect)(()=>{if(Ie===null)return;let d=e(x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),"stopImmediatePropagation"in x&&typeof x.stopImmediatePropagation=="function"&&x.stopImmediatePropagation(),Q||Gt(null))},"onKeyDown");return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[Ie,Q]);let Ls=e(async()=>{if(Q||wn.current||Ie===null)return;if(Ie.kind!=="batch"){wn.current=!0,Xe(!0),G(null),We(null);try{await m(Ie.session.id),Gt(null)}catch(x){G(Jn(x,u))}finally{wn.current=!1,Xe(!1)}return}if(Z.current||nn.current||Nt.current.size>0)return;let{target:d}=Ie;if(d.scope==="sessions"&&bn(Y.archivedSessionIds,Y.items,d).length===0){Gt(null);return}Z.current=!0,Xe(!0),G(null),We(null),D(null),ne(null);try{let x=await E(d),J=qr(x,u);J.kind==="error"?G(J.message):We(J.message);let we=new Set([...x.deletedSessionIds,...x.skippedSessionIds]);ue(Se=>Se.filter(ft=>!we.has(ft))),Tt(Se=>Se.filter(ft=>!we.has(ft))),Ot(Se=>Se.filter(ft=>!we.has(ft)));let _=x.failures.map(Se=>Se.sessionId);be.current=_.length>0?{kind:"delete",ids:_,idle:!1}:null,D({requested:x.requestedSessionIds,succeeded:x.deletedSessionIds,skipped:x.skippedSessionIds,failures:x.failures,remaining:_,refreshError:"refreshError"in x&&typeof x.refreshError=="string"?x.refreshError:null,kind:"delete",tab:Pe}),Gt(null)}catch(x){G(Jn(x,u))}finally{Z.current=!1,Xe(!1)}},"confirmDelete"),Wt=Ie?.kind==="batch"?Ie.target.scope:null,zs=Wt==="ungrouped"?u("archives.deleteUngroupedTitle"):Wt==="workspace"?u("archives.deleteProjectTitle",{name:Ie?.kind==="batch"?Ie.title:""}):u(Wt==="sessions"?"archives.deleteSelectedTitle":"deleteSession.title"),sa=Ie===null?void 0:Wt==="ungrouped"?u("archives.deleteUngroupedDesc",{n:Ie.kind==="batch"?Ie.count:0}):Wt==="workspace"?u("archives.deleteProjectDesc",{name:Ie?.kind==="batch"?Ie.title:"",n:Ie.kind==="batch"?Ie.count:0}):Wt==="sessions"?u("archives.deleteSelectedDesc",{n:Ie.kind==="batch"?Ie.count:0}):u("deleteSession.desc",{name:st(Ie.kind==="session"?Ie.session:{},u)}),Ps=u(Wt==="ungrouped"?"archives.deleteUngroupedConfirm":Wt==="workspace"?"archives.deleteProjectConfirm":Wt==="sessions"?"archives.deleteSelectedConfirm":"deleteSession.title");return(0,a.jsxs)("section",{className:"dsham_settings","aria-label":u("archives.title"),children:[(0,a.jsx)("style",{children:hs+fs+gs+vs+bs}),(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)(es,{}),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)(ts,{}),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",S(Q||Zt.size>0,(0,a.jsx)(c.SegmentedTabs,{className:"dsham_archiveTabs",label:u("archives.title"),value:Pe==="unarchived"?"unarchived":"archived",onChange:e(d=>An(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(Pe==="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)(tr,{id:"dsham-favorite-filter",className:"dsham_srOnly",tabIndex:-1,"aria-hidden":!0,value:Jt?"favorites":"all",options:[{value:"all",label:u("organizer.allSessions")},{value:"favorites",label:u("organizer.favoritesOnly")}],onChange:e(d=>typeof Tn=="function"&&Tn(d==="favorites"),"onChange"),"aria-label":u("organizer.favoriteFilter")}),(0,a.jsx)(tr,{id:"dsham-search-scope",className:"dsham_srOnly",tabIndex:-1,"aria-hidden":!0,value:p,options:[{value:"title",label:u("discovery.titleOnly")},{value:"content",label:u("discovery.titleAndContent")}],onChange:e(d=>typeof b=="function"&&b(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:zt,onChange:e(d=>Sn(d.target.value),"onChange"),placeholder:u(ir?"discovery.searchPlaceholder":L?"archives.searchPlaceholder":"archives.searchUnarchived"),"aria-label":u(ir?"discovery.searchPlaceholder":L?"archives.searchPlaceholder":"archives.searchUnarchived")}),(0,a.jsx)(ys,{id:"dsham-sort-filter",t:u,disabled:Q,favoritesOnly:Jt,setFavoritesOnly:Tn,favoriteBusy:Q||Ht||!kt,sortBy:!L&&Pt==="archived"?"updated":Pt,setSortBy:xn,options:[...L?[{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)(tr,{id:"dsham-project-filter",className:"dsham_projectFilter",value:xt,title:xt==="all"?u("archives.allProjects"):sr.find(d=>d.key===xt)?.title??xt,options:[{value:"all",label:u("archives.allProjects")||"\u6240\u6709\u9879\u76EE",title:u("archives.allProjects")},...sr.map(d=>({value:d.key,label:d.title,title:d.title}))],onChange:Yt,"aria-label":u("archives.projectFilter")}),o.createElement(H,{t:u,from:I,to:ve,onFrom:$,onTo:se,invalid:Qr,onClear:e(()=>{$(""),se("")},"onClear")})]})}),o.createElement("style",null,xa),o.createElement(me,{state:_n,t:u}),jt&&(0,a.jsx)(M,{t:u,archived:L,busy:Q||Ht||Zt.size>0,ready:kt,days:oe,onDays:Ae,count:na.length,onPreview:e(()=>{yn(na),Oe(!0)},"onPreview"),progress:je,result:ie?.tab===Pe?ie:null,onRetry:e(()=>{let d=be.current;d&&(d.kind==="delete"?un({kind:"batch",target:{scope:"sessions",sessionIds:d.ids},count:d.ids.length}):xe(d.kind,d.ids,{idle:d.idle,retry:!0}))},"onRetry"),undoCount:_s,onUndo:e(()=>xe("undo",ee,{retry:!0}),"onUndo"),onReload:$e,orphanCount:Fe?.count??0,cacheCount:rt.diagnosis.count,cacheRepair:rt,onRebuildCaches:e(()=>Ut(),"onRebuildCaches"),onRetryCaches:e(()=>Ut(!0),"onRetryCaches"),onReloadCaches:e(async()=>{try{await lt?.(),await Qe.current?.load(),(Qe.current?.snapshot().diagnosis.count??0)===0&&Qe.current?.dismiss()}catch(d){pt.current&&G(Be(d))}},"onReloadCaches"),onDismissCaches:e(()=>Qe.current?.dismiss(),"onDismissCaches"),orphanSizeBytes:Fe?.totalSizeBytes??0,orphanCleaning:rn,onCleanOrphans:ht}),Ct.length>0&&(0,a.jsx)(Fr,{selectedCount:dt.length,hiddenCount:dt.length-cr,allVisibleSelected:Rs,selectedVisibleCount:cr,visibleCount:jn.length,busy:Q,t:u,onToggle:Ns,onClear:e(()=>Tt([]),"onClear"),onArchive:L?void 0:()=>yn([...dt]),onRestore:Ds,onDelete:e(()=>un({kind:"batch",target:{scope:"sessions",sessionIds:dt},count:dt.length}),"onDelete")}),Ct.length===0?(0,a.jsx)("div",{className:"dsham_settingsEmpty",children:u(L?"archives.empty":"archives.emptyUnarchived")}):Rn.length===0?(0,a.jsx)("div",{className:"dsham_settingsEmpty",children:_n.status==="loading"||_n.status==="error"||_n.failures.length?null:u("archives.emptyFiltered")}):Rn.map(d=>{let x=xs(d.key),J=Ct.find(_=>_.key===d.key)?.sessions.map(_=>_.id)??[],we=L?bn(Y.archivedSessionIds,Y.items,x).length:J.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":!Te.has(d.key),"aria-controls":"dsham-group-"+encodeURIComponent(d.key),onClick:e(()=>de(_=>{let Se=new Set(_);return Se.has(d.key)?Se.delete(d.key):Se.add(d.key),Se}),"onClick"),children:[(0,a.jsx)(Te.has(d.key)?c.IconChevronRightOutlineMedium:c.IconChevronDownOutlineMedium,{}),(0,a.jsx)(Te.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)(Ss,{group:d,busy:Q,onArchive:L?void 0:()=>yn(J,d),onRestore:e(()=>ra(x),"onRestore"),onDelete:e(()=>un({kind:"batch",target:x,title:d.title,count:we}),"onDelete"),t:u})]})]}),(0,a.jsx)("div",{className:"dsham_settingsList",id:"dsham-group-"+encodeURIComponent(d.key),hidden:Te.has(d.key)||void 0,children:!Te.has(d.key)&&d.sessions.map(_=>(0,a.jsxs)("div",{className:"dsham_settingsRow","data-selected":lr.has(_.id),children:[(0,a.jsx)(Br,{checked:lr.has(_.id),disabled:Q,label:u("archives.selectSession",{name:st(_,u)}),onChange:e(Se=>js(_.id,Se.target.checked),"onChange")}),(0,a.jsxs)("div",{className:"dsham_settingsContent",children:[(0,a.jsx)("button",{type:"button",className:"dsham_settingsTitleLink",title:st(_,u),"aria-label":u("archives.openSession")+u("common.separator")+st(_,u),disabled:Q||Zt.has(_.id),onClick:e(()=>Xt(_),"onClick"),children:st(_,u)}),(0,a.jsx)("div",{className:"dsham_settingsMeta",children:[us(_.updatedAt,u)]}),or.has(_.id)&&o.createElement("button",{type:"button",className:"dsham_settingsSnippet",disabled:Q,title:u(L?"discovery.preview":"archives.openSession"),onClick:e(()=>L?Mt.open(_,zt):Xt(_),"onClick")},o.createElement(R,{text:or.get(_.id)?.snippet??"",query:zt}))]}),(0,a.jsxs)("div",{className:"dsham_settingsActions",children:[typeof dn=="function"&&w({variant:"outline",className:"dsham_iconAction"+(Ve.has(_.id)?" dsham_favoriteOn":""),title:u(Ve.has(_.id)?"organizer.unfavorite":"organizer.favorite"),"aria-pressed":Ve.has(_.id),"aria-label":u(Ve.has(_.id)?"organizer.unfavorite":"organizer.favorite")+u("common.separator")+st(_,u),disabled:Q||Ht||!kt,onClick:e(()=>re(_.id),"onClick"),children:(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:Ve.has(_.id)?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round","aria-hidden":!0,style:{display:"block"},children:(0,a.jsx)("path",{d:_t})})}),w({variant:"outline",className:"dsham_iconAction",title:u(L?"archives.restore":"archives.archiveSelected"),"aria-label":u(L?"archives.restore":"archives.archiveSelected"),disabled:Q||Zt.has(_.id),onClick:e(()=>L?Ms(_.id):Qt([_.id]),"onClick"),icon:(0,a.jsx)(L?c.IconRefreshOutlineMedium:c.IconArchiveOutlineMedium,{size:16})}),L&&(0,a.jsx)(ws,{busy:Q||Zt.has(_.id),t:u,title:st(_,u),onCopyId:e(()=>As(_),"onCopyId"),onPreview:typeof tt=="function"?()=>Mt.open(_,zt):void 0,onRestoreOpen:e(()=>Xt(_,!0),"onRestoreOpen"),onDelete:e(()=>un({kind:"session",session:_}),"onDelete")})]})]},_.id))})]},d.key)}),o.createElement(y,{width:900,className:"dsham_modalWide",portalToBody:!0,t:u,open:Mt.target!==null,onClose:Mt.close,title:Mt.target?st(Mt.target.session,u):u("discovery.preview"),footer:f({variant:"primary",disabled:Q,onClick:e(()=>{if(Mt.target){let d=Mt.target.session;return Mt.close(),Xt(d)}},"onClick"),children:u("discovery.openFull")}),children:o.createElement(le,{preview:Mt,t:u,MarkdownText:c.MarkdownText})}),Re===null&&It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It}),Kt!==null&&(0,a.jsx)("div",{className:"dsham_settingsStatus",role:"status",children:Kt}),(0,a.jsx)(y,{t:u,open:Re!==null,onClose:$t,title:u("archives.archiveTitle",{n:Re?.length??0}),description:Ue===null?u("archives.archiveSelectedDesc"):u(Ue.key===Wn?"archives.archiveUngroupedDesc":"archives.archiveProjectDesc",{name:Ue.title,n:Re?.length??0}),footer:(0,a.jsxs)(a.Fragment,{children:[f({disabled:Q,onClick:$t,children:u("cancel")}),f({variant:"primary",disabled:Q||!Re?.length,onClick:pn,children:u("archives.archiveSelected")})]}),children:(0,a.jsxs)(a.Fragment,{children:[jt&&(0,a.jsx)("p",{children:u(qe?"organizer.idleConfirm":"organizer.manualConfirm")}),jt&&(0,a.jsx)("div",{className:"dsham_archivePreview",children:(Re??[]).map(d=>(0,a.jsxs)("label",{children:[(0,a.jsx)(dr,{checked:!0,disabled:Q,label:st(te.byId[d]??{id:d},u),onChange:e(()=>ke(x=>(x??[]).filter(J=>J!==d)),"onChange")}),st(te.byId[d]??{id:d},u)]},d))}),je&&(0,a.jsxs)("div",{role:"status",children:[(0,a.jsx)("progress",{value:je.done,max:Math.max(1,je.total)}),u("organizer.progressCount",{done:je.done,total:je.total})]}),It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It})]})}),(0,a.jsx)(y,{t:u,open:Ke!==null,onClose:e(()=>{Q||(Lt(null),G(null))},"onClose"),title:u("archiveActive.title"),...Ke===null?{}:{description:u("archiveActive.desc",{name:Ke.title,kinds:Ke.kinds})},footer:(0,a.jsxs)(a.Fragment,{children:[f({disabled:Q,onClick:e(()=>{Q||(Lt(null),G(null))},"onClick"),children:u("cancel")}),f({danger:!0,disabled:Q,onClick:e(async()=>{if(!(St.current||Q||Ke===null||typeof s!="function")){St.current=!0,Xe(!0),G(null);try{await s(Ke.sessionId,{stopActivity:!0}),Tt(d=>d.filter(x=>Ke===null||x!==Ke.sessionId)),nt("archived"),We(u("archives.archiveSuccess",{n:1})),Lt(null)}catch(d){G(d instanceof Error?d.message:String(d))}finally{St.current=!1,Xe(!1)}}},"onClick"),children:u("archiveActive.confirm")})]}),children:It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It})}),(0,a.jsx)(y,{t:u,open:Ie!==null,onClose:aa,title:zs,...sa===void 0?{}:{description:sa},footer:(0,a.jsxs)(a.Fragment,{children:[f({disabled:Q,onClick:aa,children:u("cancel")}),f({danger:!0,disabled:Q,onClick:Ls,children:Ps})]}),children:(0,a.jsxs)(a.Fragment,{children:[Q&&(0,a.jsxs)("div",{role:"status",children:[Ie?.kind==="batch"?u("archives.deleteBatchPending"):u("deleteSession.pending"),je&&(0,a.jsx)("progress",{value:je.done,max:Math.max(1,je.total),"aria-label":u("organizer.progress")}),je&&u("organizer.progressCount",{done:je.done,total:je.total})]}),It!==null&&(0,a.jsx)("div",{className:"dsham_settingsError",role:"alert",children:It})]})})]})]})}e(Pn,"ArchivedSessionsSection");function Tr(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=Tr(n[s]))&&(h&&(h+=" "),h+=l)}else for(l in n)n[l]&&(h&&(h+=" "),h+=l);return h}e(Tr,"r");function ns(...n){for(var s,l,h=0,v="",m=arguments.length;h<m;h++)(s=arguments[h])&&(l=Tr(s))&&(v&&(v+=" "),v+=l);return v}e(ns,"clsx");function On(n){let s=n instanceof Error?n.message:String(n);return s.includes("UNKNOWN_SESSION")||s.includes("no such session")}e(On,"isUnknownSessionError");function Jn(n,s){if(On(n))return s("deleteSession.unknown");let l=n instanceof Error?n.message:String(n);return s("deleteSession.failed",{detail:l})}e(Jn,"formatDeleteError");function Ar(n,s){if(On(n))return s("archives.unarchiveUnknown");let l=n instanceof Error?n.message:String(n);return s("archives.unarchiveFailed",{detail:l})}e(Ar,"formatUnarchiveError");function Fn(n,s,l=_r){return n.map(h=>h.sessionId+s("common.separator")+l(new Error(h.message),s)).join(`
23
+ `)}e(Fn,"formatBatchFailures");function _r(n,s){if(On(n))return s("archives.archiveUnknown");let l=n instanceof Error?n.message:String(n);return s("archives.archiveFailed",{detail:l})}e(_r,"formatArchiveError");function Bn(n){if(n===null||typeof n!="object")return;let s=ce(n),l=s.rpcError!==null&&typeof s.rpcError=="object"?ce(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"?ce(v).activity:void 0,C=Array.isArray(h)?h:Array.isArray(m)?m:void 0;if(C===void 0)return;let E=C.flatMap(j=>{if(j===null||typeof j!="object")return[];let F=ce(j).kind;return typeof F=="string"&&F.length>0?[F]:[]});return E.length>0?E:void 0}e(Bn,"activeSessionActivity");function Rr(n){let s=Bn(n);if(s===void 0||n===null||typeof n!="object")return;let l=ce(n),h=l.rpcError!==null&&typeof l.rpcError=="object"?ce(l.rpcError).details:void 0,v=h!==null&&typeof h=="object"?ce(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(Rr,"activeSessionRefusal");function jr(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(jr,"activeArchiveFromMessage");function rs(n,s){let l=n instanceof Error?n.message:String(n);return s("archives.forkFailed",{detail:l})}e(rs,"formatForkError");function Hn(n,s,l){if(!n||l.has(n))return!1;let h=s?.[n];return!(h===void 0||h.origin==="subagent"||h.blank)}e(Hn,"isWorkspaceTaskCandidate");function Nr(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(Nr,"workspaceMenuTriggerFrom");function Xn(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(Xn,"findRowMenuButton");function Mr(n,s){if(Xn(s)===n)return!0;let h=(n.getAttribute("aria-label")??n.getAttribute("title")??"").toLowerCase();return/action|操作|действи|more|更多/.test(h)}e(Mr,"isRowMenuButton");function Dr(){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&&!Mr(v,h))return;let m=Xn(h);m&&(s.preventDefault(),s.stopPropagation(),m.click())},"onContextMenu");return document.addEventListener("contextmenu",n,!0),()=>{document.removeEventListener("contextmenu",n,!0)}}e(Dr,"setupSidebarRowContextMenu");function Qn(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(Qn,"isWorkspaceDeleteMenuItem");let as=new Map,ss=new Set,is=new Map;function os(n){return n(as)}e(os,"useEmptySessionPendingInteraction");function ls(n){return n(is)}e(ls,"useEmptySessionStatus");function cs(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(cs,"factsFromSessionStatus");function ds(n,s,l){let h=n(m=>m),v=s(m=>m);return l?cs(v):{pending:h,completed:ss}}e(ds,"useSessionUiFacts");let Lr={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 st(n,s){return n.blank?s("session.new"):n.title??n.displayTitle??""}e(st,"displayTitle");function us(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(us,"archiveTimeLabel");let hs=[".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(""),Rt="data-dsham-nav-icon",ps='[role="dialog"] nav button',er=[`[${Rt}] > svg { display: none !important; }`,`[${Rt}]::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 ms(n,s){let l=String(s??"").trim();return l.length>0&&String(n??"").trim()===l}e(ms,"isOwnSettingsNavRow");function Un(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(Un,"mutationTouches");function zr(n,s){return ms(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(Rt)?(n.removeAttribute(Rt),!0):!1:n.getAttribute(Rt)===""?!1:(n.setAttribute(Rt,""),!0):n.hasAttribute(Rt)?(n.removeAttribute(Rt),!0):!1}e(zr,"applySettingsNavIcon");function Pr(n){return n.hasAttribute(Rt)?(n.removeAttribute(Rt),!0):!1}e(Pr,"restoreSettingsNavIcon");function Or(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=er,(document.head??document.documentElement).append(l)):l.textContent!==er&&(l.textContent=er);let h=!1,v=!1,m=e(()=>{if(v=!1,h)return;let j=n.locale.bind(_e)("archived.badge");for(let F of document.querySelectorAll(ps))zr(F,j)},"sync"),C=e(()=>{v||h||(v=!0,typeof requestAnimationFrame=="function"?requestAnimationFrame(m):setTimeout(m,16))},"schedule");m();let E=new MutationObserver(j=>{Un(j,'[role="dialog"] nav')&&C()});return E.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),()=>{h=!0,E.disconnect();for(let j of document.querySelectorAll(`[${Rt}]`))Pr(j);l?.remove()}},"archive-manager: settings nav icon")}e(Or,"installSettingsNavIcon");let fs=[".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(""),gs=".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}",vs=".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}}",bs=".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 tr({id:n,className:s,value:l,options:h,onChange:v,disabled:m=!1,"aria-label":C,title:E,tabIndex:j,"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),Ee=u?.label??C;return(0,a.jsx)("div",{id:n,tabIndex:j,"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:j,"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:Ee}),(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(tr,"ArchiveProjectSelect");function ys({id:n,t:s,disabled:l=!1,favoritesOnly:h,setFavoritesOnly:v,favoriteBusy:m=!1,sortBy:C,setSortBy:E,options:j}){let[F,A]=o.useState(!1),P=o.useMemo(()=>{let ge=[];typeof v=="function"&&(ge.push({type:"label",id:"lbl_view_filter",text:s("organizer.favoriteFilter")||"\u7B5B\u9009\u4F1A\u8BDD"}),ge.push({id:"filter:all",label:s("organizer.allSessions")||"\u5168\u90E8\u4F1A\u8BDD"}),ge.push({id:"filter:favorites",label:s("organizer.favoritesOnly")||"\u53EA\u770B\u6536\u85CF"}),ge.push({type:"separator",id:"sep_view_filter"})),ge.push({type:"label",id:"lbl_view_sort",text:s("archives.sortLabel")||"\u6392\u5E8F\u65B9\u5F0F"});for(let wt of j)ge.push({id:`sort:${wt.value}`,label:wt.label});return ge},[s,v,j]),B=e(ge=>{ge.startsWith("filter:")?typeof v=="function"&&!m&&v(ge==="filter:favorites"):ge.startsWith("sort:")&&E(ge.slice(5)),A(!1)},"onSelect"),u=j.find(ge=>ge.value===C),Ee=h?s("organizer.favoritesOnly")||"\u53EA\u770B\u6536\u85CF":s("organizer.allChats")||"\u5168\u90E8\u804A\u5929",ze=`${Ee} \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(ge=>!ge)},"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:Ee}),(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(ys,"ArchiveViewSortMenu");function Fr({selectedCount:n,hiddenCount:s,allVisibleSelected:l,selectedVisibleCount:h,visibleCount:v,busy:m,t:C,onToggle:E,onClear:j,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)(Br,{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&&w({disabled:m,"aria-label":C("archives.clearSelection"),onClick:j,children:C("archives.clearSelectionShort")})]}),B&&(0,a.jsxs)("div",{className:"dsham_settingsSelectionActions",children:P?[w({disabled:m,onClick:P,children:C("archives.archiveSelected")})]:[w({disabled:m,"aria-label":C("archives.restoreSelected"),onClick:F,children:C("archives.restore")}),w({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(Fr,"ArchiveSelectionToolbar");function Br({checked:n,indeterminate:s=!1,disabled:l=!1,label:h,onChange:v}){return(0,a.jsx)(dr,{checked:n,indeterminate:s,disabled:l,label:h,onChange:v})}e(Br,"ArchiveSelectionCheckbox");function Hr(){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(Hr,"moreIcon");function ws({busy:n,title:s,t:l,onPreview:h,onRestoreOpen:v,onDelete:m,onCopyId:C}){let[E,j]=(0,o.useState)(!1),F=e(P=>{if(!n){if(j(!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(()=>j(!1),"onClose"),anchor:w({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:Hr(),onClick:e(()=>{n||j(P=>!P)},"onClick")})})}e(ws,"ArchivedSessionMenu");function Ss({group:n,busy:s,onArchive:l,onRestore:h,onDelete:v,t:m}){let C=n.key===Wn,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}],[j,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&&j,align:"end",portal:!0,dense:!0,items:E,onSelect:e(B=>{F(!1),P(B)},"onSelect"),onClose:e(()=>F(!1),"onClose"),anchor:w({variant:"outline",className:"dsham_iconAction",disabled:s,"aria-label":A,"aria-haspopup":"menu","aria-expanded":j&&!s,icon:Hr(),onClick:e(()=>{s||F(B=>!B)},"onClick")})})}e(Ss,"ArchivedGroupActions");let Wn="__ungrouped__";function xs(n){return n===Wn?{scope:"ungrouped"}:{scope:"workspace",workspaceId:n}}e(xs,"archivedBatchTargetForGroup");function bn(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(bn,"deriveArchivedBatchIds");function Ur(n){return[...new Set(n.flatMap(s=>s.sessions.map(l=>l.id)))]}e(Ur,"archivedSessionIdsInGroups");function Wr(n,s){let l=new Set(s);return[...new Set(n)].filter(h=>l.has(h))}e(Wr,"pruneArchivedSelection");function nr(n,s,l){let h=new Set(n);for(let v of s)l?h.add(v):h.delete(v);return[...h]}e(nr,"toggleArchivedSelection");function qr(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(qr,"archivedDeleteFeedback");function Vr(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(Vr,"unarchivedSessionIds");function $r(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 j=n[E];if(j===void 0||j.origin==="subagent")continue;let F=v.find(A=>A.ids?.has(E));(F===void 0?m:F.sessions).push(j)}let C=v.filter(E=>E.sessions.length>0);return m.length>0&&C.push({key:Wn,title:h,sessions:m}),C}e($r,"deriveArchivedGroups");function Gr(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"),j=e((A,P)=>{if(s==="archived"){let B=C.get(A.id)??-1,Ee=(C.get(P.id)??-1)-B;if(Ee!==0)return Ee}if(s!=="alphabetical"){let B=E(P)-E(A);if(Number.isFinite(B)&&B!==0)return B}return m(st(A,h),st(P,h))||m(A.id,P.id)},"compareSessions");return n.map(A=>({...A,sessions:[...A.sessions].sort(j)})).sort((A,P)=>{if(s==="archived"){let B=A.sessions[0]?.id,u=P.sessions[0]?.id,Ee=B!==void 0?C.get(B)??-1:-1,ge=(u!==void 0?C.get(u)??-1:-1)-Ee;if(ge!==0)return ge}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(Gr,"sortArchivedGroups");let Kr={...$a,...ka,"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\u5DE5\u4F5C\u533A","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"},Yr={...Ga,...Ca,"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 workspace","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}"},ks={...Ka,...Ea,"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 \u0440\u0430\u0431\u043E\u0447\u0443\u044E \u043E\u0431\u043B\u0430\u0441\u0442\u044C","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}"},_e="archive-manager-workspace",Cs=["slots","sessions","workspaces","locale","remote","typert"];function rr(n){return{getSnapshot:n.getSnapshot.bind(n),subscribe:n.subscribe.bind(n)}}e(rr,"bindObservable");function Zr(n){return async s=>{if(typeof n?.unarchiveSession!="function")throw new Error("archive-manager: host unarchiveSession is unavailable");await n.unarchiveSession(s)}}e(Zr,"createUnarchiveSession");async function ar(n,s,l){let h=new Set(n.list?.getSnapshot?.()?.archivedSessionIds??[]),v=await Zn(s,async C=>{try{await n.archiveSession(C)}catch(E){throw E!==null&&typeof E=="object"&&Bn(E)!==void 0&&typeof ce(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(ar,"archiveSessionsViaOfficial");async function Jr(n,s,l,h){let v=new Set(n.list?.getSnapshot?.()?.archivedSessionIds??[]),m=typeof h=="function"?h:j=>n.unarchiveSession?.(j),C=await Zn(s,async j=>(await m(j),!0),{refresh:l}),E=[...n.list?.getSnapshot?.()?.archivedSessionIds??[]];return{archivedSessionIds:E,unarchivedSessionIds:[...v].filter(j=>!E.includes(j)),failures:C.failures}}e(Jr,"unarchiveSessionsViaOfficial");function Xr({triggerRect:n,viewport:s,itemCount:l,measuredHeight:h}){let v=s.width,m=s.height,C=220,E=Math.max(140,m-20),j=Math.min(360,E),F=l===0?44:34*l+8,A=Math.min(j,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:j}}e(Xr,"computeSubmenuPosition");async function Es(n){Is(n);let s=n.get("remote"),l=e(()=>{},"disposeRemote");return s!==void 0&&(l=await s.$mount(Ft)),async()=>{await l()}}e(Es,"apply");function Is(n){n.effect(()=>n.locale.register(_e,{zh:Kr,en:Yr,ru:ks}),"dsh-archive-manager: dictionaries");let s=e(()=>n.get("uiWorkspace"),"uiWorkspaceAt"),l={},h,v=e(p=>(h=ja(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 en("navigationUnavailable");return Lr.request(p),h.open(p)},"openConversation"),C=e(async p=>{n.get("layout")?.beginNavigation?.(),Lr.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"),j=e(async()=>{if(typeof n.sessions.refresh!="function")return null;try{return await Ee(),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=Zr(n.workspaces),A=e(async(p,...b)=>{let I=n.get("remote.workspaceRegistry");if(!I||typeof I[p]!="function")throw new Error(n.locale.bind(_e)("service.unavailable"));let ve=await I[p].apply(I,b);if(!ve.ok)throw new Error(ve.error.message);return ve.value},"registryCall"),P=e(()=>A("diagnoseOrphanSubagents"),"diagnoseOrphanSubagents"),B=e(()=>A("diagnoseSessionCaches"),"diagnoseSessionCaches"),u=e(p=>A("rebuildSessionCaches",p),"rebuildSessionCaches"),Ee=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(Be(I.listError));if(b.listState==="error"&&b.listError)throw new Error(Be(b.listError));let $=b.list?.getSnapshot?.();if($?.state==="error"&&$.error)throw new Error(Be($.error));if(p&&typeof p=="object"&&"ok"in p&&p.ok===!1)throw new Error(Be(p.error??"Session list refresh failed"))},"refreshCacheLists"),ze=e((p={})=>A("cleanOrphanSubagents",p??{}),"cleanOrphanSubagents"),ge=e(p=>A("searchArchivedContent",p),"searchArchivedContent"),wt=e(p=>A("searchSessionContent",p),"searchSessionContent"),lt=e(p=>A("previewArchivedSession",p),"previewArchivedSession"),it=e(()=>A("favoriteSessions"),"favoriteSessions"),cn=e(p=>A("setSessionFavorite",p),"setSessionFavorite"),tt=Ir();tt.bind({favoriteSessions:it,setSessionFavorite:cn});let Ge,dn=Er(n,tt,()=>n.locale.bind(_e),()=>Ge?.isSidebarFavoriteStarEnabled()??!0);n.effect(()=>()=>dn.dispose(),"archive-manager: favorites only filter");let Et=qa({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(_e)("service.unavailable"));let I=await b.deleteSession(p);if(!I.ok)throw new Error(I.error.message)},"deleteOne"),getFavorites:it,refresh:e(()=>n.sessions.refresh?.(),"refresh"),currentSessionId:Yn}),jt=e(async p=>{await F(p),await j()},"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 I=await b.deleteSession(p);if(!I.ok)throw new Error(I.error.message);await j()},"deleteSession"),De=e(async(p,b)=>{let I=n.get("remote.workspaceRegistry");if(I===void 0)throw new Error("archive-manager remote service is unavailable");let $=await I.moveSessionToWorkspace({sessionId:p,targetWorkspaceId:b});if(!$.ok)throw new Error($.error?.message||"move failed");return await j(),$.value},"moveSession"),te=e(async p=>ar(n.workspaces,p,j),"archiveSessions"),Y=e(async p=>{let b=n.workspaces.list?.getSnapshot?.()??{archivedSessionIds:[],items:[]},I=bn(b.archivedSessionIds,b.items,p);return Jr(n.workspaces,I,j,F)},"unarchiveSessions"),Pe=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 $=await j();return{...I.value,refreshError:$}},"deleteArchivedSessions"),nt=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"),L="sidebar.workspaces.session.menu.item",Re=null,ke=new Set,Ue=e(p=>{Re=p;for(let b of ke)b()},"publishDeleteTarget");function ct(){return o.useSyncExternalStore(p=>(ke.add(p),()=>{ke.delete(p)}),()=>Re,()=>Re)}e(ct,"useDeleteRequest");let Ke=e(()=>k(p=>n.get(p)),"hasNativeContextMenus");function Lt({sessionId:p,displayTitle:b,useMenuOpenState:I,t:$}){if(Ke())return null;let[,ve]=I(),se=c.MenuItemButton,Te=(0,a.jsx)(c.IconTrashOutlineRegular,{size:14}),de=e(()=>{ve(!1),Ue({sessionId:p,title:b})},"onSelect");return typeof se=="function"?(0,a.jsx)(se,{danger:!0,icon:Te,onSelect:de,children:$("menu.deleteSession")}):(0,a.jsx)("button",{type:"button",role:"menuitem",onClick:de,children:$("menu.deleteSession")})}e(Lt,"DeleteSessionMenuItem");function yn({sessionId:p,favoriteRow:b,useMenuOpenState:I,t:$}){if(Ke())return null;let[,ve]=I(),se=(0,o.useSyncExternalStore)(b.subscribe,b.getSnapshot),Te=se.ready&&se.ids.has(p),de=e(()=>{ve(!1),b.toggle(p)},"onSelect"),oe=c.MenuItemButton,Ae=(0,a.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:Te?"currentColor":"none",stroke:"currentColor",strokeWidth:1.4,strokeLinejoin:"round","aria-hidden":!0,children:(0,a.jsx)("path",{d:_t})}),qe=$(Te?"organizer.unfavorite":"organizer.favorite");return typeof oe=="function"?(0,a.jsx)(oe,{icon:Ae,onSelect:de,children:qe}):(0,a.jsx)("button",{type:"button",role:"menuitem",onClick:de,children:qe})}e(yn,"FavoriteMenuItem");let $t=null,St=new Set;function Ie(p,b="success"){$t={text:p,tone:b,seq:Date.now()};for(let I of St)I()}e(Ie,"showToast");function Gt(){let p=o.useSyncExternalStore(I=>(St.add(I),()=>{St.delete(I)}),()=>$t,()=>$t);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($t?.seq===p.seq){$t=null;for(let I of St)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(Gt,"GlobalToastOverlay");function wn({sessionId:p,displayTitle:b,useMenuOpenState:I,t:$}){let[,ve]=I(),[se,Te]=o.useState(!1),[de,oe]=o.useState(null),[Ae,qe]=o.useState(!1),Oe=o.useRef(null),je=o.useRef(null),ne=o.useRef(null),ie=n.workspaces.list?.getSnapshot?.()?.items??[],D=c.MenuItemButton,ee=e(re=>{if(!Oe.current)return;let xe=Oe.current.getBoundingClientRect(),Fe=typeof window<"u"?window.innerWidth:1024,ut=typeof window<"u"?window.innerHeight:768,rt=Xr({triggerRect:xe,viewport:{width:Fe,height:ut},itemCount:ie.length,measuredHeight:re});oe(ye=>ye&&ye.top===rt.top&&ye.left===rt.left&&ye.maxHeight===rt.maxHeight?ye:rt)},"updatePosition"),ue=e(()=>{ne.current&&clearTimeout(ne.current),ee(),Te(!0)},"handleMouseEnter");o.useLayoutEffect(()=>{if(!se||!je.current)return;let re=je.current.offsetHeight;re>0&&ee(re)},[se,ie.length]);let Z=e(()=>{ne.current=setTimeout(()=>{Te(!1)},180)},"handleMouseLeave"),be=e(async(re,xe)=>{if(!Ae){qe(!0),Te(!1),ve(!1);try{await De(p,re),Ie($("moveSession.success",{name:xe})||`\u4F1A\u8BDD\u5DF2\u6210\u529F\u79FB\u52A8\u5230\u201C${xe}\u201D`,"success")}catch(Fe){let ut=Fe instanceof Error?Fe.message:String(Fe);console.warn("archive-manager: move session failed",Fe),Ie(ut,"danger")}finally{qe(!1)}}},"handleSelectWorkspace"),Ce=(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"})]}),Ye=(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"})}),Ve=(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",gap:8},children:[(0,a.jsx)("span",{children:$("menu.moveSession")}),Ye]}),$e=typeof D=="function"?(0,a.jsx)(D,{icon:Ce,onSelect:e(()=>ue(),"onSelect"),children:Ve}):(0,a.jsxs)("button",{type:"button",role:"menuitem",onClick:e(()=>ue(),"onClick"),style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"6px 8px",background:"transparent",border:"none",cursor:"pointer",color:"inherit",textAlign:"left"},children:[Ce,Ve]});return(0,a.jsxs)("div",{ref:Oe,className:"dsham_moveSessionWrap",onMouseEnter:ue,onMouseLeave:Z,children:[$e,se&&de&&typeof document<"u"&&typeof g?.createPortal=="function"&&(0,g.createPortal)((0,a.jsxs)("div",{ref:je,className:"dsham_moveSubmenu",role:"menu",onPointerDown:e(re=>{re.stopPropagation()},"onPointerDown"),onMouseDown:e(re=>{re.stopPropagation()},"onMouseDown"),onMouseEnter:ue,onMouseLeave:Z,style:{top:de.top,left:de.left,maxHeight:de.maxHeight},children:[(0,a.jsx)("div",{style:{position:"absolute",top:0,bottom:0,left:-6,width:8},"aria-hidden":!0}),ie.length===0?(0,a.jsx)("div",{style:{padding:"8px 10px",fontSize:"12px",color:"var(--dsw-alias-label-tertiary, #888)"},children:$("moveSession.noOtherWorkspaces")}):ie.map(re=>{let xe=re.title||re.path||re.workspaceId;return(0,a.jsxs)("button",{type:"button",role:"menuitem",className:"dsham_moveSubmenuBtn",disabled:Ae,onPointerDown:e(Fe=>{Fe.preventDefault(),Fe.stopPropagation(),be(re.workspaceId,xe)},"onPointerDown"),onClick:e(Fe=>{Fe.preventDefault(),Fe.stopPropagation(),be(re.workspaceId,xe)},"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:xe})]},re.workspaceId)})]}),document.body)]})}e(wn,"MoveSessionMenuItem");function Q(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(Q,"focusSessionRow");function Xe({t:p}){let b=ct(),[I,$]=(0,o.useState)(!1),[ve,se]=(0,o.useState)(null),[Te,de]=(0,o.useState)(null),oe=(0,o.useRef)(null),Ae=(0,o.useRef)(null),qe=(0,o.useRef)(null);if((0,o.useLayoutEffect)(()=>{if(b===null||typeof document>"u"){de(null);return}let ne=null,ie=e(()=>{if(ne&&ne.isConnected)return ne;try{ne=document.querySelector(`[data-row-key="session:${CSS.escape(b.sessionId)}"]`)}catch{ne=null}return ne},"getTargetRow"),D=e(()=>{let ue=oe.current,Z=ue?.offsetWidth||290,be=ue?.offsetHeight||160,Ce=8,Ye=ie();if(!Ye){let xe=window.innerWidth,Fe=window.innerHeight,ut=Math.max(16,(Fe-be)/2),rt=Math.max(16,(xe-Z)/2);de(ye=>ye!==null&&ye.top===ut&&ye.left===rt?ye:{top:ut,left:rt});return}let Ve=Ye.getBoundingClientRect(),$e=Ve.top-4;$e+be>window.innerHeight-16&&($e=window.innerHeight-16-be),$e<16&&($e=16);let re=Ve.right+Ce;re+Z>window.innerWidth-16&&(re=Ve.left-Z-Ce),re<16&&(re=16),de(xe=>xe!==null&&xe.top===$e&&xe.left===re?xe:{top:$e,left:re})},"updatePosition");D(),window.addEventListener("scroll",D,!0),window.addEventListener("resize",D);let ee=null;return typeof ResizeObserver<"u"&&oe.current&&(ee=new ResizeObserver(D),ee.observe(oe.current)),()=>{ee?.disconnect(),window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[b]),(0,o.useEffect)(()=>{if(b===null)return;Ae.current&&!Ae.current.disabled?Ae.current.focus():oe.current?.focus();let ne=b.sessionId;return()=>{if(!Q(ne)){let D=document.querySelector('[role="treeitem"][aria-selected="true"]');D&&(D.hasAttribute("tabindex")||(D.setAttribute("tabindex","-1"),D.addEventListener("blur",()=>D.removeAttribute("tabindex"),{once:!0})),typeof c.focusWithoutRing=="function"?c.focusWithoutRing(D):D.focus())}}},[b]),(0,o.useEffect)(()=>{b!==null&&I&&oe.current?.focus()},[b,I]),(0,o.useEffect)(()=>{if(b===null)return;let ne=e(ie=>{if(ie.key==="Escape"){ie.preventDefault(),ie.stopPropagation(),"stopImmediatePropagation"in ie&&typeof ie.stopImmediatePropagation=="function"&&ie.stopImmediatePropagation(),I||(se(null),Ue(null));return}if(ie.key==="Tab"){if(ie.preventDefault(),I){oe.current?.focus();return}let D=Ae.current,ee=qe.current;if(!D||!ee)return;ie.shiftKey?document.activeElement===D?ee.focus():D.focus():document.activeElement===ee?D.focus():ee.focus()}},"onKey");return window.addEventListener("keydown",ne,!0),()=>window.removeEventListener("keydown",ne,!0)},[b,I]),b===null)return null;let Oe=e(()=>{I||(se(null),Ue(null))},"close"),je=e(()=>{$(!0),se(null),q(b.sessionId).then(()=>{$(!1),Ue(null)}).catch(ne=>{$(!1),se(Jn(ne,p))})},"confirm");return(0,a.jsxs)("div",{className:"dsham_sidebarCardRoot",children:[(0,a.jsx)("div",{className:"dsham_sidebarCardBackdrop",onClick:Oe}),(0,a.jsxs)("div",{ref:oe,role:"dialog","aria-modal":!0,"aria-label":p("deleteSession.title"),tabIndex:-1,className:"dsham_sidebarCard",style:Te?{top:Te.top,left:Te.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")}),ve!==null&&(0,a.jsx)("div",{className:"dsham_sidebarCardError",role:"alert",children:ve}),(0,a.jsxs)("div",{className:"dsham_sidebarCardFooter",children:[(0,a.jsx)("button",{ref:Ae,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnCancel",disabled:I,onClick:Oe,children:p("cancel")}),(0,a.jsx)("button",{ref:qe,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnDanger",disabled:I,onClick:je,children:p("deleteSession.title")})]})]})]})}e(Xe,"DeleteSessionOverlay");let It=null,G=new Set,Kt=e(p=>{It=p;for(let b of G)b()},"publishArchiveWsTarget");function We(){return o.useSyncExternalStore(p=>(G.add(p),()=>{G.delete(p)}),()=>It,()=>It)}e(We,"useArchiveWsRequest");function un(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(un,"focusWorkspaceRow");function zt({t:p}){let b=We(),[I,$]=(0,o.useState)(!1),[ve,se]=(0,o.useState)(null),[Te,de]=(0,o.useState)(null),oe=(0,o.useRef)(null),Ae=(0,o.useRef)(null),qe=(0,o.useRef)(null);if((0,o.useLayoutEffect)(()=>{if(b===null||typeof document>"u"){de(null);return}let ne=null,ie=e(()=>{if(ne&&ne.isConnected)return ne;try{ne=document.querySelector(`[data-row-key="workspace:${CSS.escape(b.workspaceId)}"]`)}catch{ne=null}return ne},"getTargetRow"),D=e(()=>{let ue=oe.current,Z=ue?.offsetWidth||290,be=ue?.offsetHeight||160,Ce=8,Ye=ie();if(!Ye){let xe=window.innerWidth,Fe=window.innerHeight,ut=Math.max(16,(Fe-be)/2),rt=Math.max(16,(xe-Z)/2);de(ye=>ye!==null&&ye.top===ut&&ye.left===rt?ye:{top:ut,left:rt});return}let Ve=Ye.getBoundingClientRect(),$e=Ve.top-4;$e+be>window.innerHeight-16&&($e=window.innerHeight-16-be),$e<16&&($e=16);let re=Ve.right+Ce;re+Z>window.innerWidth-16&&(re=Ve.left-Z-Ce),re<16&&(re=16),de(xe=>xe!==null&&xe.top===$e&&xe.left===re?xe:{top:$e,left:re})},"updatePosition");D(),window.addEventListener("scroll",D,!0),window.addEventListener("resize",D);let ee=null;return typeof ResizeObserver<"u"&&oe.current&&(ee=new ResizeObserver(D),ee.observe(oe.current)),()=>{ee?.disconnect(),window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[b]),(0,o.useEffect)(()=>{if(b===null)return;Ae.current&&!Ae.current.disabled?Ae.current.focus():oe.current?.focus();let ne=b.workspaceId;return()=>{un(ne)}},[b]),(0,o.useEffect)(()=>{b!==null&&I&&oe.current?.focus()},[b,I]),(0,o.useEffect)(()=>{if(b===null)return;let ne=e(ie=>{if(ie.key==="Escape"){ie.preventDefault(),ie.stopPropagation(),"stopImmediatePropagation"in ie&&typeof ie.stopImmediatePropagation=="function"&&ie.stopImmediatePropagation(),I||(se(null),Kt(null));return}if(ie.key==="Tab"){if(ie.preventDefault(),I){oe.current?.focus();return}let D=Ae.current,ee=qe.current;if(!D||!ee)return;ie.shiftKey?document.activeElement===D?ee.focus():D.focus():document.activeElement===ee?D.focus():ee.focus()}},"onKey");return window.addEventListener("keydown",ne,!0),()=>window.removeEventListener("keydown",ne,!0)},[b,I]),b===null)return null;let Oe=e(()=>{I||(se(null),Kt(null))},"close"),je=e(()=>{$(!0),se(null);let ie=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(Z=>Z.workspaceId===b.workspaceId),D=n.sessions.list?.getSnapshot?.()?.byId??{},ee=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]),ue=(ie?.sessionIds??[]).filter(Z=>Hn(Z,D,ee));ar(n.workspaces,ue,j).then(Z=>{if($(!1),Z.failures.length>0){se(Fn(Z.failures,p));return}Kt(null)}).catch(Z=>{$(!1),se(_r(Z,p))})},"confirm");return(0,a.jsxs)("div",{className:"dsham_sidebarCardRoot",children:[(0,a.jsx)("div",{className:"dsham_sidebarCardBackdrop",onClick:Oe}),(0,a.jsxs)("div",{ref:oe,role:"dialog","aria-modal":!0,"aria-label":p("menu.archiveWorkspace"),tabIndex:-1,className:"dsham_sidebarCard",style:Te?{top:Te.top,left:Te.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")}),ve!==null&&(0,a.jsx)("div",{className:"dsham_sidebarCardError",role:"alert",children:ve}),(0,a.jsxs)("div",{className:"dsham_sidebarCardFooter",children:[(0,a.jsx)("button",{ref:Ae,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnCancel",disabled:I,onClick:Oe,children:p("cancel")}),(0,a.jsx)("button",{ref:qe,type:"button",className:"dsham_sidebarCardBtn dsham_sidebarCardBtnDanger",disabled:I,onClick:je,children:p("archiveWorkspace.confirm")})]})]})]})}e(zt,"ArchiveWorkspaceOverlay");function Sn(p){if(typeof document>"u"||typeof document.addEventListener!="function"||typeof MutationObserver>"u")return()=>{};let b=null,I=!1,$=new Map,ve=!1,se=e(D=>{let ue=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(Ce=>Ce.workspaceId===D);if(ue===void 0)return[];let Z=n.sessions.list?.getSnapshot?.()?.byId??{},be=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]);return ue.sessionIds.filter(Ce=>Hn(Ce,Z,be))},"workspaceCandidateIds"),Te=e(()=>{if(ve=!1,!I)for(let[D,ee]of $){if(!D.isConnected){$.delete(D);continue}let ue=se(ee.workspaceId).length===0;D.disabled=ue,D.style.opacity=ue?"0.5":"",D.style.cursor=ue?"not-allowed":""}},"revalidateItems"),de=e(()=>{if($.size===0||ve||I)return;ve=!0;let D=e(()=>Te(),"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(D):setTimeout(D,16)},"scheduleRevalidate"),oe=e(D=>{b=Nr(D.target)},"rememberWorkspace");document.addEventListener("pointerdown",oe,!0),document.addEventListener("click",oe,!0);let Ae=e(()=>{if(I)return;for(let[ee]of $)ee.isConnected||$.delete(ee);let D=document.querySelectorAll('[role="menu"]');for(let ee of D){if(ee.querySelector('[data-dsham-archive-workspace="true"]'))continue;let ue=Array.from(ee.querySelectorAll('button[role="menuitem"]'));if(ue.length===0)continue;let Z=ue.find(Ze=>Qn(Ze,!1))??ue.find(Ze=>Qn(Ze,!0));if(!Z)continue;let be=ue.find(Ze=>Ze!==Z)??Z,Ce=Z.parentElement;if(!Ce)continue;let Ye=b;if(!Ye)continue;let $e=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(Ze=>Ze.workspaceId===Ye.workspaceId),re=$e?.path??$e?.cwd,Fe=se(Ye.workspaceId).length,ut=document.createElement("div");ut.className=Ce.className;let rt=be.className.split(/\s+/).filter(Ze=>!/(?:^|[_-])danger(?:$|[_-])/i.test(Ze)).join(" "),ye=document.createElement("button");ye.type="button",ye.setAttribute("role","menuitem"),ye.dataset.dshamArchiveWorkspace="true",ye.className=rt;let Qe=be.querySelector("span"),Ut=be.querySelectorAll("span")[1],rn=document.createElement("span");rn.setAttribute("aria-hidden","true"),Qe?.className&&(rn.className=Qe.className),rn.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 hn=document.createElement("span");if(Ut?.className&&(hn.className=Ut.className),hn.textContent=p("menu.archiveWorkspace"),ye.append(rn,hn),ut.append(ye),Fe===0&&(ye.disabled=!0,ye.style.opacity="0.5",ye.style.cursor="not-allowed"),ye.addEventListener("click",Ze=>{Ze.preventDefault(),Ze.stopPropagation();let ht=se(Ye.workspaceId).length;ht!==0&&(document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),Kt({workspaceId:Ye.workspaceId,title:Ye.title,count:ht}))}),re){let Ze=document.createElement("div");Ze.className=Ce.className;let ht=document.createElement("button");ht.type="button",ht.setAttribute("role","menuitem"),ht.dataset.dshamCopyWorkspacePath="true",ht.className=rt,ht.disabled=!1,ht.style.opacity="",ht.style.cursor="";let pt=document.createElement("span");pt.setAttribute("aria-hidden","true"),Qe?.className&&(pt.className=Qe.className),pt.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 an=document.createElement("span");Ut?.className&&(an.className=Ut.className),an.textContent=p("menu.copyWorkspacePath"),ht.append(pt,an),Ze.append(ht),ht.addEventListener("click",Qt=>{Qt.preventDefault(),Qt.stopPropagation(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),Kn(re).catch(()=>{})});let Xt=document.createElement("div");Xt.className=Ce.className;let mt=document.createElement("button");mt.type="button",mt.setAttribute("role","menuitem"),mt.dataset.dshamOpenExplorer="true",mt.className=rt,mt.disabled=!1,mt.style.opacity="",mt.style.cursor="";let Ct=document.createElement("span");Ct.setAttribute("aria-hidden","true"),Qe?.className&&(Ct.className=Qe.className),Ct.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 An=document.createElement("span");Ut?.className&&(An.className=Ut.className),An.textContent=p("menu.openInExplorer"),mt.append(Ct,An),Xt.append(mt),mt.addEventListener("click",Qt=>{Qt.preventDefault(),Qt.stopPropagation(),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),(async()=>{try{let pn=await fetch(fn("/open-in-app/open"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({app:"explorer",path:re})}).catch(()=>null);if(pn&&pn.ok)return}catch{}try{await Ot("/open-in-explorer",{method:"POST",body:JSON.stringify({path:re,workspaceId:Ye.workspaceId})})}catch(pn){console.warn("archive-manager: open in explorer failed",pn)}})()}),Ce.parentNode?.insertBefore(Ze,Ce),Ce.parentNode?.insertBefore(Xt,Ce)}Ce.parentNode?.insertBefore(ut,Ce),$.set(ye,{workspaceId:Ye.workspaceId})}},"checkAndInject"),qe=!1,Oe=e(()=>{if(qe||I)return;qe=!0;let D=e(()=>{qe=!1,!I&&Ae()},"run");typeof requestAnimationFrame=="function"?requestAnimationFrame(D):setTimeout(D,16)},"scheduleInject"),je=new MutationObserver(D=>{Un(D,'[role="menu"]')&&Oe()});je.observe(document.body,{childList:!0,subtree:!0});let ne=n.sessions.list?.subscribe?.(de),ie=n.workspaces.list?.subscribe?.(de);return()=>{I=!0,document.removeEventListener("pointerdown",oe,!0),document.removeEventListener("click",oe,!0),je.disconnect(),ne?.(),ie?.(),$.clear();for(let D of document.querySelectorAll('[data-dsham-archive-workspace="true"], [data-dsham-copy-workspace-path="true"], [data-dsham-open-explorer="true"]'))D.parentElement?.remove()}}e(Sn,"setupWorkspaceMenuInjector");function xt(){if(typeof n.slots.entries!="function")return!1;if(n.slots.entries("sidebar.workspaces").some(I=>I.children?.[L]!==void 0)||n.slots.entries("contextMenu.content").some(I=>I.children?.[L]!==void 0))return!0;try{if(n.get("contextMenus")!==void 0&&n.slots.entries("contextMenu.content").length>0)return!0}catch{}return!1}e(xt,"hostSidebarDeclaresSessionMenu");let Yt,Pt,xn,kn,Cn,Zt,En,Nt=e(()=>{let p=xt()?"menu":"waiting";p!==Yt&&(Yt=p,p==="menu"&&(Pt??=n.slots.inject(L,()=>n.slots.register({name:L,id:"archive-manager.delete-session",order:9999,locale:_e,inject:e(()=>({}),"inject")},Lt)),xn??=n.slots.inject(L,()=>n.slots.register({name:L,id:"archive-manager.favorite",order:1,locale:_e,inject:e(()=>({favoriteRow:tt}),"inject")},yn)),kn??=n.slots.inject(L,()=>n.slots.register({name:L,id:"archive-manager.move-session",order:480,locale:_e,inject:e(()=>({}),"inject")},wn)),Cn??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.delete-session",locale:_e,inject:e(()=>({t:n.locale.bind(_e)}),"inject")},Xe)),Zt??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.archive-workspace",locale:_e,inject:e(()=>({t:n.locale.bind(_e)}),"inject")},zt)),En??=n.slots.inject("shell.overlay",()=>n.slots.register({name:"shell.overlay",id:"archive-manager.toast",locale:_e,inject:e(()=>({}),"inject")},Gt))))},"reconcileSidebar");Nt();let dt=(()=>{try{return n.get("contextMenus")}catch{return}})();dt&&typeof dt.register=="function"?n.effect(()=>{let p,b,I,$;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.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"})]})),b=n.slots.register({name:"contextMenu.icon",key:"archive-manager.star-fill"},()=>(0,a.jsx)("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"#e8b931",stroke:"#e8b931",strokeWidth:1.2,strokeLinejoin:"round",children:(0,a.jsx)("path",{d:_t})})),I=n.slots.register({name:"contextMenu.icon",key:"archive-manager.star-outline"},()=>(0,a.jsx)("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round",children:(0,a.jsx)("path",{d:_t})})),$=n.slots.register({name:"contextMenu.icon",key:"archive-manager.workspace-archive"},()=>(0,a.jsx)("svg",{"data-dsham-archive-icon":"true",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:"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 4.94772 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"})]}))}catch{}let ve=dt.register({id:"archive-manager.session-favorite",target:"session",order:1,observe:e(()=>[tt,n.locale],"observe"),resolve:e(({sessionId:de})=>{let oe=tt.getSnapshot(),Ae=oe.ready&&oe.ids.has(de);return[{id:"favorite",label:n.locale.bind(_e)(Ae?"organizer.unfavorite":"organizer.favorite"),icon:{key:Ae?"archive-manager.star-fill":"archive-manager.star-outline"},run:e(()=>{tt.toggle(de)},"run")}]},"resolve")}),se=dt.register({id:"archive-manager.session-delete",target:"session",order:9999,observe:e(()=>[n.locale],"observe"),resolve:e(({sessionId:de,displayTitle:oe})=>[{id:"delete-session",label:n.locale.bind(_e)("menu.deleteSession"),icon:{key:"workspace.delete"},danger:!0,afterContent:!0,run:e(()=>{Ue({sessionId:de,title:oe||de})},"run")}],"resolve")}),Te=dt.register({id:"archive-manager.workspace-actions",target:"workspace",order:250,observe:e(()=>[n.workspaces.list,n.sessions.list,n.locale],"observe"),resolve:e(({workspaceId:de,path:oe,displayTitle:Ae})=>{let Oe=(n.workspaces.list?.getSnapshot?.()?.items??[]).find(be=>be.workspaceId===de),je=n.sessions.list?.getSnapshot?.()?.byId??{},ne=new Set(n.workspaces.list?.getSnapshot?.()?.archivedSessionIds??[]),D=(Oe?Oe.sessionIds.filter(be=>Hn(be,je,ne)):[]).length,ee=n.locale.bind(_e),ue=oe??Oe?.path??Oe?.cwd,Z=[];return ue&&(Z.push({id:"copy-workspace-path",label:ee("menu.copyWorkspacePath"),icon:{key:"workspace.copy"},run:e(()=>{Kn(ue).catch(()=>{})},"run")}),Z.push({id:"open-in-explorer",label:ee("menu.openInExplorer"),icon:{key:"archive-manager.explorer"},run:e(()=>{(async()=>{try{let be=await fetch(fn("/open-in-app/open"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({app:"explorer",path:ue})}).catch(()=>null);if(be&&be.ok)return}catch{}try{await Ot("/open-in-explorer",{method:"POST",body:JSON.stringify({path:ue,workspaceId:de})})}catch(be){console.warn("archive-manager: open in explorer failed",be)}})()},"run")})),Z.push({id:"archive-workspace",label:ee("menu.archiveWorkspace"),icon:{key:"archive-manager.workspace-archive"},disabled:D===0,separatorBefore:!0,run:e(()=>{D!==0&&Kt({workspaceId:de,title:Ae||de,count:D})},"run")}),Z},"resolve")});return()=>{ve?.(),se?.(),Te?.(),p?.(),b?.(),I?.(),$?.()}},"archive-manager: native workspace context menu"):n.effect(()=>Sn(n.locale.bind(_e)),"archive-manager: workspace menu injector"),n.effect(()=>Dr(),"archive-manager: sidebar row contextmenu trigger"),Or(n);let Tt=typeof n.on=="function"?n.on("slots/changed",p=>{if(!(p!=="sidebar.workspaces"&&p!=="contextMenu.content"))try{Nt()}catch(b){console.warn("archive-manager: sidebar mode switch failed",b)}}):void 0;n.effect(()=>()=>{Tt?.(),Pt?.(),xn?.(),kn?.(),Cn?.(),Zt?.(),En?.()},"archive-manager: sidebar mode");let tn=e(()=>({archiveSessions:te,archiveSession:e((p,b)=>n.workspaces.archiveSession(p,b),"archiveSession"),sessionStore:rr(n.sessions.list),workspaceStore:rr(n.workspaces.list),unarchiveSession:jt,deleteSession:q,unarchiveSessions:Y,deleteArchivedSessions:Pe,archivedSessionMetadata:nt,openConversation:m,focusSessionWorkspace:C,viewState:l,favoriteSessions:it,setSessionFavorite:cn,favoriteSync:tt,organizeBatch:Et,diagnoseOrphanSubagents:P,cleanOrphanSubagents:ze,diagnoseSessionCaches:B,rebuildSessionCaches:u,refreshCacheLists:Ee,searchSessionContent:wt,searchArchivedContent:ge,previewArchivedSession:lt,t:n.locale.bind(_e)}),"buildArchivedSectionProps"),Ot=e(async(p,b)=>{let I=fn(`/api/michengai/dsh-archive-manager${p}`),$=Object.assign({"content-type":"application/json","x-michengai-plugin-update":"1"},b?.headers),ve=await fetch(I,Object.assign({},b,{headers:$})),se=await ve.json();if(!ve.ok||!se||se.ok===!1)throw new Error((se&&typeof se=="object"&&typeof se.error=="string"?se.error:void 0)||`HTTP ${ve.status}`);return se},"callSettingsApi"),kt=null,At=null,Ht=!1,In=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"),nn=e(()=>{if(!(!Ht||kt)&&!(Ge&&!Ge.isSettingsSectionEnabled())){try{let p=n.slots.register({name:"settings.section.icon",id:"archive-manager",locale:_e},In);At=typeof p=="function"?p:null}catch{At=null}try{let p=n.slots.register({name:"settings.section",id:"archive-manager",order:45,label:e(()=>n.locale.bind(_e)("archived.badge"),"label"),icon:"archive",locale:_e,inject:tn},Pn);kt=typeof p=="function"?p:()=>{}}catch(p){console.warn("archive-manager: register settings.section failed:",p),kt=null}}},"mountSettingsSection"),Jt=e(()=>{if(At){try{At()}catch{}At=null}if(kt){try{kt()}catch{}kt=null}},"unmountSettingsSection"),Tn=e(()=>{Ge?.isSettingsSectionEnabled?.()??!0?nn():Jt()},"syncSettingsSection");Ge=wr(n,{callApi:Ot,renderPanel:e(p=>(0,a.jsx)(Pn,Object.assign({},tn(),p)),"renderPanel"),injectProps:tn,ns:_e,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(()=>{Tn()},"onLocationChange")}),n.effect(()=>()=>{Ge?.destroy(),Jt()},"archive-manager: sidebar entry"),n.effect(()=>Ba({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:fe,isEnabled:e(()=>Ge.isOnlineUpdateEnabled(),"isEnabled")}),"dsh-archive-manager: plugin update ui"),n.slots.inject("settings.section",()=>{Ht=!0;try{if(Ge&&!Ge.isSettingsSectionEnabled())return()=>{Ht=!1,Jt()};try{let b=n.slots.register({name:"settings.section.icon",id:"archive-manager",locale:_e},In);At=typeof b=="function"?b:null}catch{At=null}let p=n.slots.register({name:"settings.section",id:"archive-manager",order:45,label:e(()=>n.locale.bind(_e)("archived.badge"),"label"),icon:"archive",locale:_e,inject:tn},Pn);return kt=typeof p=="function"?p:()=>{},()=>{Ht=!1,Jt()}}catch(p){return console.warn("archive-manager: register settings.section failed:",p),()=>{Ht=!1}}})}e(Is,"applyWorkspaceBrowser");async function Ts(n,s,l,h){try{await s(n)}catch(v){l(rs(v,h))}}return e(Ts,"forkWithFeedback"),i.__test={computeSubmenuPosition:Xr,forkWithFeedback:Ts,hasNativeContextMenuService:k,favoritesOnlyVisibility:kr,favoriteGroupPredicate:Cr,createFavoriteRowStore:Ir,unarchivedSessionIds:Vr,ArchiveSelectionToolbar:Fr,ArchivedSessionsSection:Pn,zh:Kr,en:Yr,displayTitle:st,isUnknownSessionError:On,deriveArchivedGroups:$r,sortArchivedGroups:Gr,deriveArchivedBatchIds:bn,archivedSessionIdsInGroups:Ur,pruneArchivedSelection:Wr,toggleArchivedSelection:nr,archivedDeleteFeedback:qr,isWorkspaceTaskCandidate:Hn,isWorkspaceDeleteMenuItem:Qn,workspaceMenuTriggerFrom:Nr,findRowMenuButton:Xn,isRowMenuButton:Mr,setupSidebarRowContextMenu:Dr,applySettingsNavIcon:zr,restoreSettingsNavIcon:Pr,installSettingsNavIcon:Or,mutationTouches:Un,resolveRowHasStatus:Ln,activeSessionActivity:Bn,activeSessionRefusal:Rr,activeArchiveFromMessage:jr,archiveSessionsViaOfficial:ar,unarchiveSessionsViaOfficial:Jr,createUnarchiveSession:Zr,bindObservable:rr,ARCHIVE_MANAGER_REMOTE:Ft,currentSessionId:Yn,setupSidebarEntry:wr,ArchiveBundleConfigCard:br,ArchiveBundleConfigCardWrapper:yr,setupWorkspaceFavoritesOnly:Er},i.apply=Es,i.inject=Cs,r.exports}e(mi,"startArchiveClient");
25
25
 
26
26
  return module.exports.startArchiveClient(require);
27
27
  }