@codexhost/cli-linux-arm64 0.23.0 → 0.25.0
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +3968 -4082
- package/app/console-web.js +6822 -2065
- package/app/desktop-controller.mjs +13620 -2977
- package/app/host-runtime.mjs +12025 -12636
- package/app/plugins/antigravity/plugin.mjs +2382 -1452
- package/app/plugins/claude-code/plugin.mjs +2248 -1645
- package/app/plugins/codebuddy/plugin.mjs +1753 -1215
- package/app/plugins/codex-usage/plugin.mjs +1214 -915
- package/app/plugins/copilot/plugin.mjs +1239 -919
- package/app/plugins/cursor-cli/plugin.mjs +1549 -1099
- package/app/plugins/deepseek-harness/plugin.mjs +1955 -1484
- package/app/plugins/devin/plugin.mjs +1295 -978
- package/app/plugins/grok/plugin.mjs +1772 -1482
- package/app/plugins/hermes/plugin.mjs +1485 -1184
- package/app/plugins/kimi-code/plugin.mjs +1388 -1093
- package/app/plugins/kiro-cli/plugin.mjs +1349 -1036
- package/app/plugins/omp/plugin.mjs +2027 -1420
- package/app/plugins/opencode/plugin.mjs +2219 -1844
- package/app/plugins/pi/plugin.mjs +1956 -1606
- package/app/plugins/qoder/plugin.mjs +1536 -1229
- package/app/plugins/qoder-cn/plugin.mjs +1536 -1229
- package/app/plugins/qwen-code/plugin.mjs +1490 -1198
- package/app/plugins/workbuddy/plugin.mjs +1757 -1221
- package/app/plugins/zcode/plugin.mjs +1841 -1072
- package/app/renderer-extension.js +12894 -8392
- package/app/web/assets/index-CTCFIQbU.css +1 -0
- package/app/web/assets/index-DUOvhHbV.js +203 -0
- package/app/web/codexhost-settings.js +4811 -36168
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-brand-official/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +75 -64
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +98 -95
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -9
- package/app/web/sw.js +8 -1
- package/app/web-modules/server.mjs +4752 -6790
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-DJW4bmyx.css +0 -1
- package/app/web/assets/index-Dyh1KzAB.js +0 -201
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-store"),i=e("@deepseek-ai/cordis"),a=e("
|
|
1
|
+
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-store"),i=e("@deepseek-ai/cordis"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react/jsx-runtime"),s=e("react"),c=(e,t)=>()=>t;function l(){let e=(0,r.createSnapshotStore)({searchRequest:0,addRequested:!1,directoryBusy:!1,renameTarget:null,forkError:null}),t=0;return{state:e,search:()=>{e.set({...e.getSnapshot(),searchRequest:e.getSnapshot().searchRequest+1})},add:()=>{e.set(e.getSnapshot().directoryBusy?e.getSnapshot():{...e.getSnapshot(),addRequested:!0})},closeAdd:()=>{e.set({...e.getSnapshot(),addRequested:!1})},directoryBusy:t=>{e.set({...e.getSnapshot(),directoryBusy:t})},rename:(t,n)=>{e.set({...e.getSnapshot(),renameTarget:{sessionId:t,currentTitle:n}})},closeRename:()=>{e.set({...e.getSnapshot(),renameTarget:null})},forkFailed:n=>{t+=1,e.set({...e.getSnapshot(),forkError:{reason:n,seq:t}})},dismissForkError:()=>{e.set({...e.getSnapshot(),forkError:null})}}}function u(e,t,n,r){let i=e.locale.bind(`workspace`),a=()=>Object.values(e.sessions.list.getSnapshot().byId).find(e=>(e.retainedBy.mainView??0)>0),o=()=>e.slots.entries(`sidebar.workspaces.directoryFlow`).length===0?i(`shortcut.noPicker`):n.state.getSnapshot().directoryBusy?i(`shortcut.directoryBusy`):null,s=(t,n,r,i,a,o,s)=>{e.effect(()=>e.shortcuts.register({id:t,label:n,aliases:r,defaults:{"desktop:macos":{code:i,modifiers:a},"desktop:windows":{code:i,modifiers:a},"desktop:linux":{code:i,modifiers:a},"web:macos":{code:i,modifiers:o},"web:windows":{code:i,modifiers:o}},regions:[`page`,`editable`],modals:[],resolve:s}),`ui-workspace: ${t}`)};s(`session.new`,()=>i(`session.new`),[`new session`,`new chat`],`KeyN`,[`primary`],[`primary`,`alt`],()=>({status:`handled`,run:()=>{t.startSession()}})),s(`session.search`,()=>i(`search.sessions.aria`),[`search sessions`],`KeyK`,[`primary`],[`primary`,`alt`],()=>({status:`handled`,run:n.search})),s(`workspace.add`,()=>i(`workspace.add`),[`add workspace`,`open folder`],`KeyO`,[`primary`],[`primary`,`alt`],()=>{let e=o();return e===null?{status:`handled`,run:n.add}:{status:`blocked`,reason:e}}),s(`session.rename`,()=>i(`rename.session.title`),[`rename session`],`KeyG`,[`primary`,`alt`],[`primary`,`alt`],t=>{let r=a();return r===void 0||r.blank||t.modal!==null||e.layout.panelInfo.getSnapshot().activePanelId!==null?{status:`blocked`,reason:i(`shortcut.noSession`)}:{status:`handled`,run:()=>{n.rename(r.id,r.title?.trim()??``)}}}),s(`session.fork`,()=>i(`menu.fork`),[`fork session`],`KeyF`,[`primary`,`alt`],[`primary`,`shift`],()=>{let e=a();return e===void 0?{status:`blocked`,reason:i(`shortcut.noSession`)}:e.blank?{status:`blocked`,reason:i(`shortcut.noCompletedTurn`)}:{status:`handled`,run:()=>{t.forkSession(e.id).catch(e=>{let t=e instanceof Error&&e.name===`SessionForkError`&&e.rpcError.code===`session/fork-unavailable`;n.forkFailed(t?`unavailable`:`failed`),t||console.warn(`session fork rejected:`,e)})}}}),s(`session.archive`,()=>i(`menu.archiveSession`),[`archive session`],`KeyA`,[`primary`,`shift`],[`primary`,`alt`],()=>{let e=a();return e===void 0?{status:`blocked`,reason:i(`shortcut.noSession`)}:{status:`handled`,run:()=>{r(e.id)}}})}function d(e){return e}function f(e){return d(e)}let p={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
2
2
|
`,r:`\r`,t:` `},m=/[\\\u0000-\u001f]/u;function h(e){return e===` `||e===`
|
|
3
3
|
`||e===`\r`||e===` `}function g(e){return e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}(class e{static EMPTY=e.fromObject({});static fromText(t){let n=new e;return n.append(t),n.sealed=!0,n}static fromObject(t){let n=new e;return n.object=typeof t==`object`&&t&&!Array.isArray(t)?t:{},n.sealed=!0,n}chunks=[];object;sealed=!1;#e=[];#t=0;#n=0;#r=`root`;#i=!1;#a=0;#o=!1;#s=``;#c=null;#l=[];#u=!1;#d;#f=!1;#p=/* @__PURE__ */ new Map;#m=[];#h=/* @__PURE__ */ new Map;get isSealed(){return this.sealed}get invalid(){return this.scan(),this.#r===`invalid`||this.#f}append(e){if(this.sealed)throw Error(`PartialArguments: cannot append to a sealed view`);e.length!==0&&(this.chunks.push(e),this.#t+=e.length,this.#e.push(this.#t))}settle(t){if(this.object!==void 0||t.length!==this.#t)return e.fromText(t);let n=0;for(let r of this.chunks){if(!t.startsWith(r,n))return e.fromText(t);n+=r.length}return this.chunks=t.length===0?[]:[t],this.#e=t.length===0?[]:[t.length],this.sealed=!0,this}refresh(){if(this.#h.size===0)return!1;this.scan();let e=!1,t=!1;for(let n of this.#h.values())n.completion?t=!0:e=this.refreshRead(n)||e;if(t)for(let t of this.#h.values())t.completion&&(e=this.refreshRead(t)||e);return this.sealed&&this.#h.clear(),e}refreshRead(e){let t=e.answer();return!Object.is(t,e.last)&&(e.last=t,!0)}closed(){return this.remember(`closed`,``,()=>this.closedNow())}keys(){return this.remember(`keys`,``,()=>this.keysNow(),e=>e.length)}has(e){return this.remember(`has`,e,()=>this.hasNow(e))}complete(e){return this.remember(`complete`,e,()=>this.completeNow(e))}stringLength(e,t){let n=Math.max(1,Math.floor(t?.step??1)),r=t?.offset??0;return this.remember(`length:${n}:${r}`,e,()=>this.lengthNow(e),e=>e===void 0?void 0:Math.ceil((e+r)/n))}stringExceeds(e,t){let n=Math.max(0,Math.floor(t));return this.remember(`exceeds:${n}`,e,()=>(this.lengthNow(e,n+1)??0)>n)}text(e){return this.remember(`text`,e,()=>this.textNow(e))}textPrefix(e,t){let n=Math.max(1,Math.floor(t));return this.remember(`prefix:${n}`,e,()=>this.textPrefixNow(e,n))}value(e){return this.remember(`value`,e,()=>this.valueNow(e))}remember(e,t,n,r){this.scan();let i=n();if(!this.sealed){let a=`${e}/${t}`;this.#h.has(a)||this.#h.set(a,{completion:e===`complete`,answer:r===void 0?n:()=>r(n()),last:r===void 0?i:r(i)})}return i}closedNow(){return this.sealed||this.#r===`closed`||this.#r===`invalid`}keysNow(){return this.object===void 0?this.#m:Object.keys(this.object)}hasNow(e){return this.object===void 0?this.#p.has(e):Object.hasOwn(this.object,e)}completeNow(e){if(this.object!==void 0)return Object.hasOwn(this.object,e);let t=this.#p.get(e);return t!==void 0&&t.end>=0&&(t.kind===`string`?t.invalidAt===void 0:!t.invalid)}lengthNow(e,t=1/0){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t.length:void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;if(n.text!==void 0&&n.text.at===n.end)return n.text.length;let r=n.length??={at:n.start,length:0,text:``};return this.readString(n,r,t,!1),r.length}textNow(e){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t:void 0}let t=this.#p.get(e);if(t?.kind!==`string`)return;if(t.text===void 0&&t.end>=0&&t.needsDecoding&&t.invalidAt===void 0){let e;try{e=JSON.parse(`"${this.slice(t.start,t.end)}"`)}catch{}e!==void 0&&(t.text={at:t.end,length:e.length,text:e})}let n=t.text??={at:t.start,length:0,text:``};return this.readString(t,n,1/0,!0),n.text}textPrefixNow(e,t){if(this.object!==void 0){let n=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof n==`string`?n.slice(0,t):void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;let r=n.prefixes??=/* @__PURE__ */ new Map,i=r.get(t);return i===void 0&&(i={at:n.start,length:0,text:``},r.set(t,i)),this.readString(n,i,t,!0),i.text}valueNow(e){if(this.object!==void 0){if(!Object.hasOwn(this.object,e))return;let t=this.object[e];return typeof t==`string`?void 0:t}let t=this.#p.get(e);if(!(t?.kind!==`value`||t.end<0||t.invalid)){if(t.parsed===void 0)try{t.parsed=JSON.parse(this.slice(t.start,t.end))}catch{t.invalid=!0,this.#f=!0}return t.parsed}}chunkAt(e){let t=0,n=this.#e.length;for(;t<n;){let r=t+n>>>1;this.#e[r]<=e?t=r+1:n=r}return t}slice(e,t){if(e>=t)return``;let n=this.chunkAt(e),r=this.chunkAt(t-1),i=n===0?0:this.#e[n-1];if(n===r)return this.chunks[n].slice(e-i,t-i);let a=[this.chunks[n].slice(e-i)];for(let e=n+1;e<r;e++)a.push(this.chunks[e]);return a.push(this.chunks[r].slice(0,t-this.#e[r-1])),a.join(``)}readString(e,t,n,r){let i=Math.min(e.end<0?this.#n:e.end,e.invalidAt??1/0,this.#d??1/0);if(!e.needsDecoding){let e=Math.min(i-t.at,n-t.length);if(e<=0)return;r&&(t.text+=this.slice(t.at,t.at+e)),t.at+=e,t.length+=e;return}let a=this.chunkAt(t.at);for(;t.at<i&&t.length<n;){let o=a===0?0:this.#e[a-1],s=this.chunks[a],c=s.slice(t.at-o,Math.min(s.length,i-o)),l=c.search(m),u=Math.min(l<0?c.length:l,n-t.length);if(u>0){r&&(t.text+=c.slice(0,u)),t.at+=u,t.length+=u,t.at===o+s.length&&a++;continue}let d=c.length>1?c[1]:t.at+1<i?this.chunks[a+1][0]:void 0,f,h=2;if(c[0]===`\\`&&d===void 0&&e.end<0)return;if(c[0]===`\\`&&d===`u`){let n=this.slice(t.at+2,Math.min(i,t.at+6)),r=!0;for(let e=0;e<n.length;e++)g(n[e])||(r=!1);if(r){if(n.length<4&&e.end<0)return;n.length===4&&(f=String.fromCharCode(Number.parseInt(n,16)))}h=6}else c[0]===`\\`&&d!==void 0&&(f=p[d]);if(f===void 0){e.invalidAt=t.at,this.#f=!0;return}for(r&&(t.text+=f),t.length++,t.at+=h;a<this.chunks.length&&t.at>=this.#e[a];)a++}}scan(){if(this.object===void 0&&this.#n!==this.#t)for(let e=this.chunkAt(this.#n);e<this.chunks.length&&this.#d===void 0;e++){let t=this.chunks[e],n=e===0?0:this.#e[e-1];for(let e=this.#n-n;e<t.length&&this.#r!==`invalid`;e++){if(this.#r===`string`||this.#r===`nested`&&this.#u){let n=this.stringBoundary(t,e);if(this.#n+=n-e,e=n,e===t.length)break}this.step(t[e],this.#n),this.#n++}}}stringBoundary(e,t){let n=t;for(;;){let t=e.indexOf(`"`,n),r=t<0?e.length:t;if(this.#r===`string`){let t=this.#c;!t.needsDecoding&&m.test(e.slice(n,r))&&(t.needsDecoding=!0)}let i=r;for(;i>n&&e[i-1]===`\\`;)i--;let a=(r-i)%2==1!==(i===n&&this.#i);if(this.#i=t<0&&a,t<0||!a)return r;n=t+1}}step(e,t){switch(this.#r){case`root`:if(h(e))return;if(e===`{`){this.#r=`key-or-end`;return}this.fail();return;case`key-or-end`:if(h(e))return;if(e===`}`){this.#r=`closed`;return}if(e===`"`){this.beginKey(t);return}this.fail();return;case`key-only`:if(h(e))return;if(e===`"`){this.beginKey(t);return}this.fail();return;case`key`:this.stepKey(e,t);return;case`colon`:if(h(e))return;if(e===`:`){this.#r=`value`;return}this.fail();return;case`value`:this.beginValue(e,t);return;case`string`:{let e=this.#c;e.end=t,this.#c=null,this.#r=`comma-or-end`;return}case`scalar`:this.stepScalar(e,t);return;case`nested`:this.stepNested(e,t);return;case`comma-or-end`:if(h(e))return;if(e===`,`){this.#r=`key-only`;return}if(e===`}`){this.#r=`closed`;return}this.fail();return;case`closed`:if(h(e))return;this.fail();return;
|
|
4
4
|
/* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
|
|
@@ -6,18 +6,18 @@ case`invalid`:return;
|
|
|
6
6
|
/* v8 ignore next 2 -- Every scanner mode has a handler above. */
|
|
7
7
|
default:_(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){h(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||h(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function _(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function v(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function y(e,t){if(t===void 0||t===``||v(e)||v(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function b(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}function x(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||/^remote-(?:ssh(?:-|:)|control:)/u.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function S(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function C(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${S(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function w(e,t){let n=new Map(e.map(e=>[e.id,e])),r=/* @__PURE__ */ new Map;for(let e of n.values()){let i=t(e);i!=null&&n.has(i)&&r.set(e.id,i)}let i=/* @__PURE__ */ new Set;for(let e of n.keys()){let t=[],n=/* @__PURE__ */ new Map,a=e;for(;a!==void 0&&!i.has(a);){let e=n.get(a);if(e!==void 0){for(let n of t.slice(e))r.delete(n);break}n.set(a,t.length),t.push(a),a=r.get(a)}for(let e of t)i.add(e)}let a=/* @__PURE__ */ new Map;for(let e of n.values())a.set(e.id,{...e,tree:{depth:0,parentId:r.get(e.id)??null,children:[],descendantIds:[],descendantCount:0,activity:{running:0,pendingInteraction:0,completed:0},updatedAt:e.updatedAt}});let o=[];for(let e of a.values()){let t=e.tree.parentId===null?void 0:a.get(e.tree.parentId);t===void 0?o.push(e):t.tree.children.push(e)}let s=[],c=[...o];for(let e=c.pop();e!==void 0;e=c.pop()){s.push(e);let t=[...e.tree.children].sort((e,t)=>t.updatedAt-e.updatedAt||e.id.localeCompare(t.id));e.tree.children=t;for(let n of t)n.tree.depth=e.tree.depth+1,c.push(n)}for(let e of s.reverse()){let t=[];for(let n of e.tree.children)t.push(n.id,...n.tree.descendantIds),e.tree.updatedAt=Math.max(e.tree.updatedAt,n.tree.updatedAt),e.tree.activity.running+=Number(n.running)+n.tree.activity.running,e.tree.activity.pendingInteraction+=Number(n.pendingInteraction!==void 0)+n.tree.activity.pendingInteraction,e.tree.activity.completed+=Number(n.completed)+n.tree.activity.completed;e.tree.descendantIds=t,e.tree.descendantCount=t.length}return o}function T(e,t){let n=[],r=[...e].reverse();for(let e=r.pop();e!==void 0;e=r.pop())n.push(e),t[e.id]&&r.push(...[...e.tree?.children??[]].reverse());return n}function E(e,t){return e.find(e=>e.sessionIds.includes(t))?.workspaceId??``}function D(e){return Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id}function O(e){if(e===void 0||e===``)return``;let t=b(e);return t===``?e:t}function k(e,t){return e.flatMap(e=>{let n=t[e];return n===void 0?[]:[{id:e,rank:n.updatedAt}]}).sort((e,t)=>e.rank===t.rank?e.id<t.id?-1:1:t.rank-e.rank).map(e=>e.id)}function A(e,t,n,r){let i=new Map(e.map(e=>[e,e])),a=/* @__PURE__ */ new Set,o=[];for(let e of t??[]){let t=i.get(e);t===void 0||a.has(e)||(o.push(t),a.add(e))}let s=new Set(r?.archivedSessionIds),c=[];for(let e of r?.pinnedSessionIds??[]){let t=i.get(e);t===void 0||a.has(t)||s.has(t)||n[t]===void 0||(c.push(t),a.add(t))}let l=[],u=[];for(let e of k([...i.values()].filter(e=>!a.has(e)),n))s.has(e)?u.push(e):l.push(e);let d=[...c,...o,...l,...u],f=new Set(l),p=e=>{if(!f.delete(e))return;let t=n[e]?.parentId;t!==void 0&&t!==e&&d.includes(t)&&(p(t),d.splice(d.indexOf(e),1),d.splice(d.indexOf(t),0,e))};for(let e of[...l].reverse())p(e);return d}function j(e,t){return t===void 0?[...e]:[t,...e.filter(e=>e!==t)]}function M(e,t,n){if(e.origin===`subagent`||e.blank)return!1;switch(n){case`default`:return!t.has(e.id);case`show`:return!0;case`only`:return t.has(e.id);
|
|
8
8
|
/* v8 ignore next 2 -- closed-union backstop; only reached if the filter is forged */
|
|
9
|
-
default:return _(n)}}function N(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id)&&t.has(a.id)?r.push(a):i.push(a);return[...r,...i]}function P(e){return e.blank?``:e.title?.trim()??``}function F(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function I(e,t,n,r){let i=[];for(let a of t){let t=[];for(let i of a.sessionIds){let a=e.byId[i];a!==void 0&&M(a,n,r)&&t.push(a)}(r!==`only`||t.length!==0)&&i.push(F(a.workspaceId,a.workspaceId,a.path,Date.parse(a.createdAt),a.title,t,a.remote))}let a=k(e.ids,e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&M(e,n,r));return a.length>0&&i.push(F(``,void 0,void 0,void 0,``,a)),i}function L(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function ee(e,t,n){return e.projectionsBySession[t]?.values.subagentCatalog?.reduce((t,r)=>t+ +((n.get(r.id)?.running??e.byId[r.id]?.running)===!0),0)??0}function te(e,t,n){let r=n.get(e.id),i=L(r?.pendingInteraction?.kind);return{running:r?.running??e.running,runningSubagentCount:ee(t,e.id,n),completed:r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function R(e,t,n,r,i){return{id:e.id,reference:x(e),remote:e.projectionValues?.remoteHost??void 0,title:P(e),...e.cwd===void 0?{}:{cwd:e.cwd},blank:e.blank,...te(e,t,n),pinned:!i.has(e.id)&&r.has(e.id),archived:i.has(e.id),updatedAt:e.updatedAt}}function ne(e,t){if(e.projectionValues?.remoteHost)return null;let n=e.projectionValues?.threadTreeParent??null,r=n===null?void 0:t?.byId[f(n)];if(r?.projectionValues?.remoteHost)return null;let i=e.projectionValues?.threadReference?.hostId,a=r?.projectionValues?.threadReference?.hostId;return i!==void 0&&a!==void 0&&i!==a?null:n}function z(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return w(re(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[R(a,e,n,i,r)]}),t=>{let n=e.byId[t.id];return n===void 0?null:ne(n,e)})}function B(e,t,n,r,i){let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=new Set(i.expandedGroups),c=D(e),l=new Map(z(e,n,r).map(e=>[e.id,e])),u=[];for(let r of I(e,t,a,n.archivedFilter)){let e=s.has(r.key),t=r.sessions.flatMap(e=>{let t=l.get(e.id);return t===void 0||i.excludePinned&&t.pinned?[]:[t]});r.key===``&&t.sort((e,t)=>(t.tree?.updatedAt??t.updatedAt)-(e.tree?.updatedAt??e.updatedAt)||e.id.localeCompare(t.id)),u.push({key:r.key,workspaceId:r.workspaceId,cwd:r.cwd,createdAt:r.createdAt,label:r.label,remote:r.remote,sessionCount:t.length,expanded:e,containsCurrent:t.some(e=>e.id===c||c!==void 0&&e.tree?.descendantIds.includes(c)),sessions:e?N(t,o,a):[]})}return u}function V(e,t=[]){return[...re(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function re(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&M(i,r,n)})}function ie(e,t,n,r){let i=new Set(n.archivedSessionIds),a=new Set(n.pinnedSessionIds),o=new Map(z(e,n,r).map(e=>[e.id,e]));return N(t.flatMap(e=>{let t=o.get(e);return t===void 0?[]:[t]}),a,i)}function ae(e,t,n,r,i,a,o,s){let c=n.trim().toLowerCase();if(c===``)return{items:[],hasMore:!1};let l=new Set(r),u=/* @__PURE__ */ new Map;for(let e of t)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=e=>u.get(e.id)??O(e.cwd),p=/* @__PURE__ */ new Map;for(let e of o.items)p.has(e.sessionId)||p.set(e.sessionId,e);let m=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&M(n,l,i)&&(P(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&m.push(n)}let h=new Map(m.map(e=>[e.id,e])),g=k(m.map(e=>e.id),e.byId).map(e=>h.get(e)),_=[],v=/* @__PURE__ */ new Set,y=e=>{v.has(e.id)||(v.add(e.id),_.push(e))};for(let e of g)y(e);for(let t of o.items){let n=e.byId[t.sessionId];n!==void 0&&!n.blank&&M(n,l,i)&&y(n)}return{items:_.slice(0,s).map(t=>{let n=p.get(t.id),r=a.get(t.id),i=L(r?.pendingInteraction?.kind),o=ne(t,e);return{id:t.id,title:P(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[f(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:ee(e,t.id,a),...i===void 0?{}:{pendingInteraction:i},completed:r?.completionUnread===!0,archived:l.has(t.id),...n===void 0?{}:{snippet:n.snippet}}}),hasMore:o.hasMore||_.length>s}}function H(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function oe(e,t){let n=H(e),r,i=-1;for(let e of t){let t=H(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let se=`__flat_session_order__`,ce=`pinned`,le=`workspaces`;function ue(e,t){return e?.[t]??!0}function U(e,t,n){let r=new Map(Object.entries(n.summaries)),i=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(n.members))if(e!==`__flat_session_order__`)for(let n of t)i.set(n,e);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let a=[...n],o=n[0]===void 0?void 0:r.get(n[0]),s=o?.blank&&(o.retainedBy.mainView??0)>0?1:0;for(let n of t[e]??[]){let t=a.indexOf(n);t===-1?!r.has(n)&&(e===`__flat_session_order__`||!i.has(n)||i.get(n)===e)&&a.splice(s++,0,n):s=t+1}return[e,a]}))}function de(){return(0,r.defineStore)({init:()=>({groupBy:`workspace`,orderBy:`updated`,groupExpansion:{},threadExpansion:{},sectionExpansion:{},sessionOrderByAccount:{},archivedFilter:`default`}),persist:`dsh.workspace.view.v5`,actions:{setGroupBy:(e,t)=>{e.groupBy=t},setOrderBy:(e,t,n,r)=>{t!==e.orderBy&&(e.sessionOrderByAccount=t===`manual`?U(n,e.sessionOrderByAccount,r):{},e.orderBy=t)},setGroupExpanded:(e,t,n)=>{e.groupExpansion[t]=n},setThreadsExpanded:(e,t,n)=>{e.threadExpansion??={};for(let r of t)e.threadExpansion[r]=n},setSectionExpanded:(e,t,n)=>{e.sectionExpansion={...e.sectionExpansion,[t]:n}},retainAccountKeys:(e,t)=>{let n=new Set(t);e.groupExpansion=Object.fromEntries(Object.entries(e.groupExpansion).filter(([e])=>n.has(e))),e.sessionOrderByAccount=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([e])=>n.has(e))),delete e.sessionUpdatedAtByAccount},syncSessionOrders:(e,t,n)=>{e.orderBy===`manual`&&Object.assign(e.sessionOrderByAccount,U(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=U({...r,[t]:n},e.sessionOrderByAccount,i);e.orderBy===`updated`?e.sessionOrderByAccount=a:Object.assign(e.sessionOrderByAccount,a),e.orderBy=`manual`},pinSessionOrder:(e,t,n,r)=>{let i=new Set(n),a=U(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,A(n,e.sessionOrderByAccount[t],r.summaries,r.rowState)])),e.sessionOrderByAccount,r);for(let e of i)a[e]!==void 0&&(a[e]=[t,...a[e].filter(e=>e!==t)]);Object.assign(e.sessionOrderByAccount,a)},setArchivedFilter:(e,t)=>{e.archivedFilter=t}}})}function fe(e,t){let n=z(e,t,/* @__PURE__ */ new Map),r=new Set(re(e,t.archivedSessionIds,t.archivedFilter)),i=/* @__PURE__ */ new Set([...n.map(e=>e.id),...V(e,t.archivedSessionIds).filter(e=>!r.has(e))]),a={...e.byId};for(let e of n){let t=a[e.id];t!==void 0&&(a[e.id]={...t,updatedAt:e.tree?.updatedAt??e.updatedAt})}return{rootIds:i,summaries:a}}function pe(e,t,n){let r=fe(t,{...n,archivedFilter:n.archivedFilter??`default`}),i=e=>e.filter(e=>t.byId[e]===void 0||r.rootIds.has(e)),a=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,i(e.sessionIds)]),[``,i([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!a.has(e))],[se,i(V(t,n.archivedSessionIds))]]),summaries:r.summaries,rowState:n}}function me(e,t){return[E(e,t),se]}var he=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;active=!1;reconciling=!1;dirty=!1;constructor(e,t){this.sessions=e,this.workspaces=t}start(){this.active=!0;let e=this.sessions.list.subscribe(()=>this.reconcile()),t=this.workspaces.list.subscribe(()=>this.reconcile());return this.reconcile(),()=>{this.active=!1,e(),t();let n=[...this.held.values()];this.held.clear(),this.recent.clear(),this.running.clear(),this.failed.clear();for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.failed.delete(e.sessionId),this.remember(e.sessionId,typeof t==`string`?this.sessions.subagentAddress(e.sessionId)??t:t),this.reconcile())}remember(e,t){this.recent.delete(e),this.recent.set(e,t)}reconcile(){if(this.active&&(this.dirty=!0,!this.reconciling)){this.reconciling=!0;try{for(;this.dirty&&this.active;)this.dirty=!1,this.update()}finally{this.reconciling=!1}}}update(){let e=this.sessions.list.getSnapshot(),t=new Set(e.ids),n=new Set(e.summaryOnlyIds??[]),r=new Set(this.workspaces.list.getSnapshot().archivedSessionIds),i=/* @__PURE__ */ new Set;for(let t of e.ids){let a=e.byId[t];a?.running&&a.origin!==`subagent`&&!r.has(t)&&(!n.has(t)||this.recent.has(t))&&i.add(t)}if(e.phase===`pending`)for(let e of this.running)r.has(e)||i.add(e);else for(let e of this.running)!i.has(e)&&t.has(e)&&!r.has(e)&&this.remember(e,e);this.running=i;for(let[n,i]of this.recent)(r.has(n)||this.sessions.binding(n)?.session.getSnapshot().removed||e.phase===`ready`&&!t.has(n)&&typeof i==`string`)&&this.recent.delete(n);let a=[...this.recent.keys()].filter(e=>!i.has(e));for(let e of a.slice(0,Math.max(0,a.length-8)))this.recent.delete(e);let o=new Map(this.recent);for(let e of i)o.set(e,e);for(let e of this.failed)o.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!o.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of o){if(this.held.has(e)||this.failed.has(e))continue;let n;try{n=this.sessions.retain(t,{source:`backgroundWarm`});let r={reference:n,binding:n.binding};this.held.set(e,r),n.ready.catch(()=>this.fail(e,r))}catch{this.failed.add(e),n?.release()}}}fail(e,t){this.active&&this.held.get(e)===t&&(this.failed.add(e),this.held.delete(e),t.reference.release())}};let ge=`codexhost.web.session-tabs.v2:local`,_e=`codexhost.web.session-tabs.v1:local`,ve=`codexhost.web.recent-visits.v1:local`,ye=1048576;function be(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xe(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?f(e):void 0}function Se(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!be(e)||Object.keys(e).length!==3)return;let n=xe(e.parentSessionId),r=xe(e.childSessionId),i=e.mode;if(!(n===void 0||r!==t||n===r||i!==`one-shot`&&i!==`continuable`&&i!==`unknown`))return{parentSessionId:n,childSessionId:r,mode:i}}function Ce(e,t){if(e===null||e.length>ye)return[];try{let n=JSON.parse(e);if(!be(n)||Object.keys(n).length!==2||n.version!==t||!Array.isArray(n.entries))return[];let r=[],i=/* @__PURE__ */ new Set,a=Date.now();for(let e of n.entries){if(!be(e))continue;let n=Object.keys(e);if(t===2&&n.length!==3||n.length!==2&&(n.length!==3||!Object.hasOwn(e,`lastVisitedAt`)))continue;let o=xe(e.sessionId);if(o===void 0||i.has(o))continue;let s=Object.hasOwn(e,`lastVisitedAt`)?e.lastVisitedAt:a;if(typeof s!=`number`||!Number.isSafeInteger(s)||s<0||s>a)continue;let c=Se(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var W=class{onFailure;enabled=typeof window<`u`&&/^https?:$/u.test(window.location.protocol);reported=!1;constructor(e){this.onFailure=e}read(){if(!this.enabled)return[];try{return this.latest()}catch{return this.failed(),[]}}update(e,t){if(this.enabled)try{let n=this.latest().filter(e=>t?.(e)!==!0),r=new Map(n.map((e,t)=>[e.sessionId,t]));for(let i of e){if(t?.(i)===!0)continue;let e=r.get(i.sessionId);e===void 0?(r.set(i.sessionId,n.length),n.push(i)):n[e]=i}let i=JSON.stringify({version:2,entries:n.map(e=>({sessionId:e.sessionId,lastVisitedAt:e.lastVisitedAt,target:typeof e.target==`string`?e.target:{parentSessionId:e.target.parentSessionId,childSessionId:e.target.childSessionId,mode:e.target.mode}}))});if(i.length>ye){this.failed();return}localStorage.getItem(ge)!==i&&localStorage.setItem(ge,i),localStorage.removeItem(_e),localStorage.removeItem(ve)}catch{this.failed()}}latest(){let e=localStorage.getItem(ge);return e===null?Ce(localStorage.getItem(_e)??localStorage.getItem(ve),1):Ce(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},we=class{sessions;workspaces;subscribeRemoved;entries=(0,r.createSnapshotStore)([]);records=[];current;awaitingFormalSession=!1;active=!1;headRevision=0;restoring=!1;cache;constructor(e,t,n,r=()=>{}){this.sessions=e,this.workspaces=t,this.subscribeRemoved=n,this.cache=new W(r)}start(e){this.active=!0,this.headRevision=this.sessions.list.getSnapshot().headRefreshRevision??0,this.records=this.cache.read(),this.cache.update([]);let t=this.sessions.list.subscribe(()=>{let t=this.sessions.list.getSnapshot().headRefreshRevision??0;t!==this.headRevision&&(this.headRevision=t,this.restoreSummaries(this.current?.sessionId??e)),this.reconcile()}),n=this.workspaces.list.subscribe(()=>this.reconcile()),r=this.subscribeRemoved?.(e=>{this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`||this.records.some(t=>t.sessionId===e&&typeof t.target!=`string`)||(this.records=this.records.filter(t=>!this.includesIdentity(t,e)),this.cache.update([],t=>this.includesIdentity(t,e)),this.publish())});return this.reconcile(),this.restoreSummaries(e),()=>{this.active=!1,t(),n(),r?.(),this.current=void 0,this.awaitingFormalSession=!1,this.records=[],this.entries.set([])}}visit(e,t){let n=Date.now(),r=this.depart(n);r!==void 0&&this.remember(r),this.current={sessionId:e,target:typeof t==`string`?this.sessions.subagentAddress(e)??t:t,lastVisitedAt:n},this.awaitingFormalSession=!0,this.reconcile(r===void 0?[]:[r])}clearCurrent(){let e=this.depart(Date.now());e!==void 0&&this.remember(e),this.current=void 0,this.awaitingFormalSession=!1,this.reconcile(e===void 0?[]:[e])}depart(e){let t=this.current;return t!==void 0&&this.records.some(e=>e.sessionId===t.sessionId)&&this.formal(t)?{...t,lastVisitedAt:e}:void 0}close(e){this.records=this.records.filter(t=>t.sessionId!==e),this.cache.update([],t=>t.sessionId===e),this.current?.sessionId===e&&(this.awaitingFormalSession=!1),this.publish()}closeAll(){let e=new Set(this.records.map(e=>e.sessionId));this.records=[],this.awaitingFormalSession=!1,this.cache.update([],t=>e.has(t.sessionId)),this.publish()}expireInactive(e,t,n=Date.now()){let r=this.sessions.list.getSnapshot();if(!this.active||!Number.isFinite(e)||e<=0||r.phase!==`ready`||r.loading===!0||r.listError!=null||this.workspaces.list.getSnapshot().phase!==`ready`)return!1;let i=new Set(this.entries.getSnapshot().map(e=>e.sessionId)),a=a=>{let o=r.byId[a.sessionId];if(a.sessionId===this.current?.sessionId||!i.has(a.sessionId)||o===void 0||o.blank||(o.retainedBy.mainView??0)>0||o.running||t.get(a.sessionId)?.pendingInteraction!==void 0||typeof a.target!=`string`&&t.get(a.sessionId)?.running===void 0||!Number.isFinite(o.updatedAt))return!1;let s=te(o,r,t);return s.running||s.runningSubagentCount>0?!1:n-Math.max(a.lastVisitedAt,o.updatedAt)>=e},o=new Set(this.records.filter(a).map(e=>e.sessionId));return o.size!==0&&(this.records=this.records.filter(e=>!o.has(e.sessionId)),this.cache.update([],e=>o.has(e.sessionId)&&a(e)),this.publish(),!0)}remember(e){let t=this.records.findIndex(t=>t.sessionId===e.sessionId);this.records=t===-1?[...this.records,e]:this.records.map((n,r)=>r===t?e:n)}formal(e){let t=this.sessions.list.getSnapshot();return t.byId[e.sessionId]?.blank===!1&&!this.invalid(e,t)}reconcile(e=[]){if(!this.active)return;let t=this.sessions.list.getSnapshot(),n=new Set(this.records.filter(e=>this.invalid(e,t)).map(e=>e.sessionId));this.records=this.records.filter(e=>!n.has(e.sessionId));let r=[...e],i=this.current;this.awaitingFormalSession&&i!==void 0&&this.formal(i)&&(this.awaitingFormalSession=!1,this.remember(i),r.push(i)),this.publish(),(r.length>0||n.size>0)&&this.cache.update(r,e=>n.has(e.sessionId))}publish(){let e=this.sessions.list.getSnapshot(),t=this.workspaces.list.getSnapshot().phase===`ready`,n=this.records.flatMap(n=>{if(!t||e.byId[n.sessionId]?.blank!==!1||this.invalid(n,e))return[];if(typeof n.target==`string`)return[n];let r=this.sessions.subagentAddress(n.sessionId);if(r===void 0||r.parentSessionId!==n.target.parentSessionId||r.childSessionId!==n.sessionId)return[];if(r.mode===n.target.mode)return[n];let i={...n,target:r};return this.records=this.records.map(e=>e===n?i:e),[i]}),r=this.entries.getSnapshot();(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&this.entries.set(n)}restoreSummaries(e=this.current?.sessionId){if(this.restoring)return;let t=this.records.filter(t=>t.sessionId!==e&&this.sessions.list.getSnapshot().byId[t.sessionId]===void 0);if(t.length===0)return;this.restoring=!0;let n=0;Promise.all(Array.from({length:Math.min(4,t.length)},async()=>{for(;this.active;){let e=t[n++];if(e===void 0)return;let r=e.sessionId;if(this.records.some(e=>e.sessionId===r)&&this.sessions.list.getSnapshot().byId[r]===void 0){try{await this.sessions.loadSummary(r)}catch{}this.active&&this.reconcile()}}})).finally(()=>{this.restoring=!1})}includesIdentity(e,t){if(e.sessionId===t)return!0;if(typeof e.target==`string`)return!1;let n=/* @__PURE__ */ new Set,r=e.target.parentSessionId;for(;r!==void 0&&!n.has(r);){if(r===t)return!0;n.add(r),r=this.sessions.subagentAddress(r)?.parentSessionId}return!1}invalid(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=e=>n.includes(e)||this.sessions.binding(e)?.session.getSnapshot().removed===!0;if(r(e.sessionId))return!0;if(typeof e.target==`string`)return!1;let i=/* @__PURE__ */ new Set([e.sessionId]),a=e.target;for(;!i.has(a.parentSessionId);){if(r(a.parentSessionId)||Te(t,a.parentSessionId,a.childSessionId))return!0;i.add(a.parentSessionId);let e=this.sessions.subagentAddress(a.parentSessionId);if(e===void 0)break;a=e}return!1}};function Te(e,t,n){let r=e.projectionsBySession[t];return e.phase===`ready`&&r?.state!==`loading`&&r?.state!==`error`&&r?.values.subagentCatalog!==void 0&&!r.values.subagentCatalog.some(e=>e.id===n)}var Ee=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},De=class extends i.Service{directoryPicker;workspaces;sessions;view;notify;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,r.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;opening=(0,r.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;keepalive;recentVisits;constructor(e,t,n,r,i,a){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.keepalive=new he(r,n);let o=e.get(`remote`);this.recentVisits=new we(r,n,o===void 0?void 0:e=>o.$on(`api-session/removed`,e),()=>a({kind:`recentVisitsStorageFailed`})),e.effect(()=>{let e=this.selection.getSnapshot(),t=this.recentVisits.start(e.subagentAddress?.childSessionId??e.sessionId),n=this.keepalive.start(),r=this.watchNavigation();return()=>{r(),this.lifetime.abort(),n(),t();let e=this.mainReference;this.mainReference=void 0,e?.release()}},`ui-workspace: Workspace navigation policy`)}async connectWorkspace(e){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0)throw Error(`uiWorkspace.connectWorkspace: unknown workspace ${e}`);let n=this.connecting.get(e);if(n!==void 0)return n;let r=this.reuseOrCreateBlank(t).finally(()=>{this.connecting.delete(e)});return this.connecting.set(e,r),r}reuseOrCreateBlank(e){let t=this.workspaces.list.getSnapshot().archivedSessionIds,n=this.sessions.list.getSnapshot();for(let r of n.ids){let i=n.byId[r];if(i!==void 0&&i.blank&&i.cwd===e.path&&e.sessionIds.includes(r)&&!t.includes(r))return this.reuseBlank(e.workspaceId,r)}return this.sessions.create({workspaceId:e.workspaceId})}async reuseBlank(e,t){try{return await this.sessions.create({workspaceId:e,sessionId:t})}catch(t){if(G(t)?.rpcError.code!==`session/writer-held`)throw t;return this.sessions.create({workspaceId:e})}}openSession(e){let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.opening.set({state:`idle`}),this.retryOpen=void 0,typeof e!=`string`||this.sessions.list.getSnapshot().byId[e]!==void 0?this.replaceMain(e,t,`reveal`):this.resolveSession(e,t,()=>{this.replaceMain(e,t,`reveal`)},()=>this.openSession(e))}closeSessionTab(e){this.recentVisits.close(e)}closeAllSessionTabs(){this.recentVisits.closeAll()}retryOpening(){this.retryOpen?.()}async resolveSession(e,t,n,r){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let i={stop:()=>t.removeEventListener(`abort`,a)},a=()=>{i.stop(),this.openingLoad===i&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,a,{once:!0}),this.openingLoad=i,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==i||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==i))return;if(this.sessions.list.getSnapshot().byId[e]===void 0)throw Error(`Session not found: ${e}`);n(),a()}catch(n){if(t.aborted||this.openingLoad!==i)return;this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:Oe(n)})}}async openWorkspace(e,t){let n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),r;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw Error(`This Host requires a Workspace.`);r=e===null?await this.sessions.create():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:Oe(e)}),e}n.aborted||this.replaceMain(r,n,`reveal`,t)}async forkSession(e,t){return this.sessions.fork({sessionId:e,increaseTitle:!0,...t===void 0?{}:{onCreated:t}})}startSession(e,t){let n=t===void 0?void 0:{...t},r=n!==void 0&&(n.prompt!==void 0||n.clearPreviousDraft===!0),i=this.workspaces.list.getSnapshot(),a=this.sessions.list.getSnapshot(),o=this.mainReference?.sessionId,s=o===void 0?void 0:i.items.find(e=>e.sessionIds.includes(o))?.workspaceId,c=i.phase===`ready`&&a.phase===`ready`?ke(i.items,a.byId):void 0,l=e??(i.canStartProjectless?null:s??c);if(l===void 0){if(this.ctx.layout.beginNavigation(),r){this.notify({kind:`createFailed`,message:this.ctx.locale.bind(`workspace`)(`draft.workspaceRequired`)});return}this.clearMain()}else this.openWorkspace(l,r?e=>{let t=this.sessions.binding(e);t===void 0&&this.draftPreparationFailed(),this.prepareDraft(t,n)}:void 0).catch(e=>{console.warn(`new session failed:`,e)})}prepareDraft(e,t){let n=this.ctx.get(`conversation`);n===void 0&&this.draftPreparationFailed(),n.input.requestDraftInitialization(e,t)===`blocked`&&this.draftPreparationFailed()}draftPreparationFailed(){let e=this.ctx.locale.bind(`workspace`)(`draft.initializationFailed`);throw this.notify({kind:`createFailed`,message:e}),Error(e)}async archiveSession(e,t={}){await this.workspaces.archiveSession(e,t),this.mainReference?.sessionId===e&&this.clearMain()}async unarchiveSession(e){await this.workspaces.unarchiveSession(e)}async pinSession(e){await this.workspaces.pinSession(e);let{items:t,pinnedSessionIds:n,archivedSessionIds:r}=this.workspaces.list.getSnapshot();this.view.pinSessionOrder(e,me(t,e),pe(t,this.sessions.list.getSnapshot(),{pinnedSessionIds:n,archivedSessionIds:r}))}async unpinSession(e){await this.workspaces.unpinSession(e)}async pickDirectory(){let e=await this.directoryPicker.pick();if(!e.ok)throw Error(`directory picker failed: ${e.error.message}`);return e.value}async listDirectory(e,t){let n=await this.directoryPicker.list(e,t);if(!n.ok)throw new Ee(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new Ee(n.error);return n.value}watchNavigation(){let e=`waiting`,t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);t.addEventListener(`abort`,()=>{e=`done`},{once:!0});let n=()=>{if(this.lifetime.signal.aborted||this.clearArchivedCurrent()||e!==`waiting`)return;let n=this.workspaces.list.getSnapshot(),r=this.sessions.list.getSnapshot();this.mainReference===void 0?n.phase===`ready`&&r.phase===`ready`&&(e=`connecting`,this.restoreSelection(n,r,t).then(()=>{e=`done`},n=>{t.aborted||(e=`waiting`,console.warn(`initial Session restoration failed:`,n))})):e=`done`},r=this.workspaces.list.subscribe(n),i=this.sessions.list.subscribe(n),a=this.selection.getSnapshot();if(a.sessionId!==void 0||a.subagentAddress!==void 0){if(e=`connecting`,a.subagentAddress!==void 0)this.replaceMain(a.subagentAddress,t,`preserve`),e=`done`;else if(a.sessionId!==void 0){let r=a.sessionId,i=()=>{this.resolveSession(r,t,()=>{this.sessions.list.getSnapshot().byId[r]?.blank===!0?(e=`waiting`,n()):(this.replaceMain(r,t,`preserve`),e=`done`)},i)};i()}}return n(),()=>{this.lifetime.abort(),i(),r()}}async restoreSelection(e,t,n){let r=this.selection.getSnapshot();if(r.subagentAddress!==void 0){this.replaceMain(r.subagentAddress,n,`preserve`);return}let i=r.sessionId===void 0?void 0:t.byId[r.sessionId],a=i===void 0?void 0:e.items.find(e=>e.sessionIds.includes(i.id));if(i!==void 0&&(!i.blank||a===void 0)){this.replaceMain(i.id,n,`preserve`);return}let o;if(i!==void 0&&a!==void 0&&i.cwd===a.path&&!e.archivedSessionIds.includes(i.id)&&(o=await this.reuseBlank(a.workspaceId,i.id)),o===void 0&&e.canStartProjectless&&i===void 0){o=await this.sessions.create(),n.aborted||this.replaceMain(o,n,`preserve`);return}let s=a?.workspaceId??ke(e.items,t.byId);if(s===void 0&&e.items.length===0&&t.ids.length===0){let e=await this.initializeDefaultWorkspace(n);if(n.aborted)return;s=e?.workspaceId}o===void 0&&s!==void 0&&(o=await this.connectWorkspace(s)),o!==void 0&&!n.aborted&&this.replaceMain(o,n,`preserve`)}async initializeDefaultWorkspace(e){try{return await this.workspaces.initializeDefault(e)}catch{e.aborted||this.notify({kind:`defaultWorkspaceFailed`});return}}clearArchivedCurrent(){let e=this.mainReference?.sessionId;return e===void 0||!this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?!1:(this.clearMain(),!0)}clearMain(){let e=this.mainReference;this.mainReference=void 0,this.recentVisits.clearCurrent(),this.selection.set({}),e?.release(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r){t.throwIfAborted();let i=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(i.sessionId),t.aborted){i.release();return}let n=typeof e==`string`?this.sessions.subagentAddress(i.sessionId):e;this.selection.set({sessionId:i.sessionId,...n===void 0?{}:{subagentAddress:n}})}catch(e){throw i.release(),e}let a=this.mainReference;this.mainReference=i,this.keepalive.visit(i,e),this.recentVisits.visit(i.sessionId,e),a?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function G(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function Oe(e){let t=G(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function ke(e,t){let n,r=-1/0;for(let i of e){let e=-1/0;for(let n of i.sessionIds){let r=t[n];r!==void 0&&(e=Math.max(e,r.updatedAt))}e===-1/0&&(e=Date.parse(i.createdAt)),(n===void 0||e>r)&&(n=i.workspaceId,r=e)}return n}let Ae=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ae)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ae,e.textContent=`._6puhIG_shortcut{isolation:isolate;box-sizing:border-box;width:max-content;min-width:0;max-width:min(164px,100% - 24px);min-height:44px;color:var(--dsw-alias-label-primary);background:0 0;border:0;border-radius:8px;flex:none;align-items:center;padding:0;font-size:13px;font-weight:500;line-height:20px;display:inline-flex;position:relative}._6puhIG_select,._6puhIG_close{border-radius:inherit;min-height:44px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;padding:0;display:inline-flex}._6puhIG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}._6puhIG_close{width:44px;color:var(--dsw-alias-label-secondary);flex:0 0 44px;justify-content:center}._6puhIG_close:active{color:var(--dsw-alias-label-primary)}._6puhIG_shortcut:before{content:"";z-index:-1;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l2);border-radius:inherit;background:var(--dsw-alias-bg-module-platform);box-shadow:inset 0 .5px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);pointer-events:none;position:absolute;inset:6px 0}._6puhIG_shortcut[data-active]:before{border-width:1px;border-color:color-mix(in srgb, var(--dsw-alias-label-primary) 34%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary))}._6puhIG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){._6puhIG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}._6puhIG_shortcut[data-active]:before{background:color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary)) 82%, transparent)}._6puhIG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}._6puhIG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}._6puhIG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}._6puhIG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){._6puhIG_shortcut:before,._6puhIG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}._6puhIG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}._6puhIG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){._6puhIG_shortcut{color:buttontext}._6puhIG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}._6puhIG_shortcut[data-active],._6puhIG_shortcut:active{color:highlighttext}._6puhIG_shortcut[data-active]:before,._6puhIG_shortcut:active:before{background:highlight;border-color:highlight}._6puhIG_close,._6puhIG_close:active{color:inherit}._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline-color:highlight}._6puhIG_shortcut[data-active] ._6puhIG_select:focus-visible,._6puhIG_shortcut[data-active] ._6puhIG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var je={activity:`_6puhIG_activity`,close:`_6puhIG_close`,identity:`_6puhIG_identity`,select:`_6puhIG_select`,shortcut:`_6puhIG_shortcut`,title:`_6puhIG_title`};function Me({visit:e,summary:t,identity:n,activityLabel:r,activity:i,active:c,closeLabel:l,closeHint:u,open:d,close:f,restoreNavigationFocus:p}){let m=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{e===null&&m.current?.contains(document.activeElement)&&p(),m.current=e},[p]);return/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:h,className:je.shortcut,"data-active":c||void 0,children:[/* @__PURE__ */ (0,s.jsxs)(`button`,{type:`button`,className:je.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,r].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:je.identity,children:n}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:je.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:je.activity,title:r,children:i})]}),/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:je.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,s.jsx)(o.IconCloseOutlineRegular,{size:12})})]})}let Ne=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ne)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ne,e.textContent=`.rjHY3q_hostBadge{max-width:96px;color:var(--dsw-alias-label-secondary);flex-shrink:0;align-items:center;gap:6px;font-size:11px;display:inline-flex}.rjHY3q_hostBadge>span:first-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rjHY3q_hostDot{background:#92949a;border-radius:50%;flex-shrink:0;width:7px;height:7px}.rjHY3q_hostBadge[data-state=connected] .rjHY3q_hostDot{background:#16a34a}.rjHY3q_hostBadge[data-state=connecting] .rjHY3q_hostDot{background:#d97706}.rjHY3q_projectRow,.rjHY3q_sessionRow{--dsh-row-surface:var(--dsw-specific-sidebar-fill);border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex;position:relative}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen),.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}.rjHY3q_sessionRow,.rjHY3q_searchResultRow{--ch-sidebar-text-primary:#1a1c1f;letter-spacing:normal;color:color-mix(in oklab, var(--ch-sidebar-text-primary) 85%, transparent);font-family:-apple-system,"system-ui",Segoe UI,sans-serif;font-size:14px;font-weight:430;line-height:20px}body[data-ds-dark-theme] .rjHY3q_sessionRow,body[data-ds-dark-theme] .rjHY3q_searchResultRow{--ch-sidebar-text-primary:#fff}.rjHY3q_projectRow:focus-visible,.rjHY3q_sessionRow:focus-visible,.rjHY3q_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.rjHY3q_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;background:0 0;border:none;flex-direction:column;align-items:stretch;width:100%;min-height:48px;padding:4px 8px;display:flex}.rjHY3q_searchResultRow:hover,.rjHY3q_searchResultRow.rjHY3q_selected{background:var(--dsw-alias-interactive-bg-hover)}.rjHY3q_searchResultHeading{align-items:center;min-width:0;display:flex}.rjHY3q_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.rjHY3q_searchResultWorkspace,.rjHY3q_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.rjHY3q_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.rjHY3q_searchResultWorkspace:only-child{max-width:100%}.rjHY3q_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.rjHY3q_projectRow{box-sizing:border-box;align-items:center;height:34px}.rjHY3q_sessionRow{box-sizing:border-box;min-width:0;max-width:100%;flex-direction:column;align-items:stretch;gap:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-indent,0px))}.rjHY3q_sessionMain{min-width:0;height:var(--dsh-thread-row-height);flex:none;align-items:center;display:flex;position:relative}.rjHY3q_identityButton{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:4px;padding:0}.rjHY3q_identityButton:after{content:"";position:absolute;inset:-6px -4px -6px -8px}@media (hover:none),(pointer:coarse){.rjHY3q_sessionRow:not(:has(>[data-thread-summary])) .rjHY3q_identityButton:after{inset:-12px -6px -12px -8px}}.rjHY3q_foldChevron{justify-content:center;align-items:center;display:none;position:absolute;inset:0}.rjHY3q_foldChevron:before{content:"";border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transform:translate(-1px)rotate(-45deg)}.rjHY3q_identityButton[aria-expanded=true] .rjHY3q_foldChevron:before{transform:translateY(-1px)rotate(45deg)}.rjHY3q_identityButton[aria-expanded=true]>:not(.rjHY3q_foldChevron){visibility:hidden}.rjHY3q_identityButton[aria-expanded=true] .rjHY3q_foldChevron{color:var(--dsw-alias-label-secondary,currentColor);display:flex}@media (hover:hover) and (pointer:fine){.rjHY3q_identityButton:hover>:not(.rjHY3q_foldChevron),.rjHY3q_identityButton:focus-visible>:not(.rjHY3q_foldChevron){visibility:hidden}.rjHY3q_identityButton:hover .rjHY3q_foldChevron,.rjHY3q_identityButton:focus-visible .rjHY3q_foldChevron{color:var(--dsw-alias-text-secondary,currentColor);display:flex}}.rjHY3q_identityButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.rjHY3q_sessionRow .rjHY3q_title{margin:0 6px 0 4px}.rjHY3q_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.rjHY3q_slot:has([data-harness-id]){width:14px;color:inherit}.rjHY3q_sessionRow:has([data-harness-id]) .rjHY3q_title,.rjHY3q_searchResultHeading:has([data-harness-id]) .rjHY3q_searchResultTitle{margin-left:8px}.rjHY3q_statusOverlay{display:contents}.rjHY3q_slot:has([data-harness-id]) .rjHY3q_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}.rjHY3q_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.rjHY3q_projectRow>.rjHY3q_slot:not(.rjHY3q_folderExpanded){color:inherit}.rjHY3q_folderExpanded{color:var(--dsw-alias-state-business-primary)}.rjHY3q_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.rjHY3q_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.rjHY3q_sessionRow .rjHY3q_title{flex:1}.rjHY3q_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.rjHY3q_trailing{flex:none;place-items:center end;display:grid}.rjHY3q_trailing:empty{display:none}.rjHY3q_trailing>*{grid-area:1/1}.rjHY3q_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.rjHY3q_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}.rjHY3q_timeStatus [data-state=done]{color:var(--dsw-alias-state-business-primary)}.rjHY3q_timeStatus .rjHY3q_visuallyHidden{visibility:visible}.rjHY3q_sessionRow.rjHY3q_archived .rjHY3q_title,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultTitle,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultWorkspace,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultSnippet{color:var(--dsw-alias-label-caption)}.rjHY3q_dot{flex:none}.rjHY3q_quickActions{align-items:center;gap:2px;display:inline-flex}.rjHY3q_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) .rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_searchResultHeading .rjHY3q_rowActions{margin-left:auto}@media (hover:hover) and (pointer:fine){.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_time{visibility:hidden}.rjHY3q_projectRow>.rjHY3q_rowActions,.rjHY3q_sessionRow .rjHY3q_rowActions{inset-inline-end:0;z-index:1;background:var(--dsh-row-surface);border-radius:var(--dsw-radius-sm);position:absolute;top:50%;transform:translateY(-50%)}.rjHY3q_projectRow>.rjHY3q_rowActions{inset-inline-end:8px}.rjHY3q_projectRow>.rjHY3q_rowActions:before,.rjHY3q_sessionRow .rjHY3q_rowActions:before{content:"";background:linear-gradient(to right, transparent, var(--dsh-row-surface));pointer-events:none;width:12px;position:absolute;inset-block:0;inset-inline-end:100%}}[data-phone-drawer] .rjHY3q_sessionRow{min-height:44px}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]){grid-template-columns:var(--dsh-thread-icon-size,16px) minmax(0, 1fr) auto;grid-template-rows:24px 24px;column-gap:8px;padding-block:2px;display:grid}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_sessionMain{display:contents;position:static}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_slot{grid-area:1/1;align-self:center}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_title{grid-area:1/2;align-self:center;margin:0}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_trailing{grid-area:1/3/span 2;align-self:center}[data-phone-drawer] .rjHY3q_sessionRow>[data-thread-summary]{text-overflow:ellipsis;white-space:nowrap;grid-area:2/2;width:100%;margin:0;padding-inline:0;overflow:hidden}.rjHY3q_phoneDetails{padding:8px 8px 16px}.rjHY3q_phoneDetails .rjHY3q_hoverTitle{display:none}.rjHY3q_phoneDetails :is(.rjHY3q_hoverTitle,.rjHY3q_hoverTime,.rjHY3q_hoverStatus,.rjHY3q_hoverPath){color:inherit}.rjHY3q_sessionRow.rjHY3q_dropBefore,.rjHY3q_sessionRow.rjHY3q_dropAfter{position:relative}.rjHY3q_sessionRow.rjHY3q_dropBefore:before,.rjHY3q_sessionRow.rjHY3q_dropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.rjHY3q_sessionRow.rjHY3q_dropBefore:before{top:-7px}.rjHY3q_sessionRow.rjHY3q_dropAfter:after{bottom:-7px}.rjHY3q_hoverContent{flex-direction:column;gap:8px;display:flex}.rjHY3q_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.rjHY3q_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.rjHY3q_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.rjHY3q_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.rjHY3q_hoverArchived svg{flex-shrink:0;margin:0 -4px}.rjHY3q_iconButton{cursor:pointer;-webkit-tap-highlight-color:transparent;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.rjHY3q_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):is(:active,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] .rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] .rjHY3q_rowActions,[data-phone-drawer] .rjHY3q_rowActions:before{background:0 0}body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow){--dsh-row-surface:transparent}body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] .rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}body[data-codexhost-wallpaper] .rjHY3q_sessionRow.rjHY3q_selected:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}@media (hover:hover) and (pointer:fine){body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow>.rjHY3q_rowActions,.rjHY3q_sessionRow .rjHY3q_rowActions){background:color-mix(in srgb, var(--dsw-specific-sidebar-fill) 82%, transparent);backdrop-filter:blur(10px)}body[data-codexhost-wallpaper] :is(){display:none}}[data-phone-drawer] .rjHY3q_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] .rjHY3q_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.rjHY3q_projectRow,.rjHY3q_sessionRow{min-height:44px}.rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_sessionRow .rjHY3q_quickActions{display:none}.rjHY3q_sessionRow .rjHY3q_trailing{align-items:center;gap:4px;display:flex}.rjHY3q_sessionRow .rjHY3q_time:not(.rjHY3q_timeStatus){display:none}.rjHY3q_sessionRow .rjHY3q_timeStatus{visibility:visible;padding-inline-end:0}.rjHY3q_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var K={archived:`rjHY3q_archived`,dot:`rjHY3q_dot`,dropAfter:`rjHY3q_dropAfter`,dropBefore:`rjHY3q_dropBefore`,foldChevron:`rjHY3q_foldChevron`,folderExpanded:`rjHY3q_folderExpanded`,hostBadge:`rjHY3q_hostBadge`,hostDot:`rjHY3q_hostDot`,hoverArchived:`rjHY3q_hoverArchived`,hoverContent:`rjHY3q_hoverContent`,hoverPath:`rjHY3q_hoverPath`,hoverStatus:`rjHY3q_hoverStatus`,hoverTime:`rjHY3q_hoverTime`,hoverTitle:`rjHY3q_hoverTitle`,iconButton:`rjHY3q_iconButton`,identityButton:`rjHY3q_identityButton`,menuOpen:`rjHY3q_menuOpen`,meta:`rjHY3q_meta`,phoneDetails:`rjHY3q_phoneDetails`,projectRow:`rjHY3q_projectRow`,projectText:`rjHY3q_projectText`,quickActions:`rjHY3q_quickActions`,renameInput:`rjHY3q_renameInput`,rowActions:`rjHY3q_rowActions`,searchResultHeading:`rjHY3q_searchResultHeading`,searchResultMeta:`rjHY3q_searchResultMeta`,searchResultRow:`rjHY3q_searchResultRow`,searchResultSnippet:`rjHY3q_searchResultSnippet`,searchResultTitle:`rjHY3q_searchResultTitle`,searchResultWorkspace:`rjHY3q_searchResultWorkspace`,selected:`rjHY3q_selected`,sessionMain:`rjHY3q_sessionMain`,sessionRow:`rjHY3q_sessionRow`,slot:`rjHY3q_slot`,statusOverlay:`rjHY3q_statusOverlay`,time:`rjHY3q_time`,timeStatus:`rjHY3q_timeStatus`,title:`rjHY3q_title`,trailing:`rjHY3q_trailing`,visuallyHidden:`rjHY3q_visuallyHidden`};function Pe(e,t){let n=e.runningSubagentCount===0?void 0:{state:`ongoing`,label:t(e.runningSubagentCount===1?`status.subagentsRunning.one`:`status.subagentsRunning.other`,{n:e.runningSubagentCount})},r;switch(e.pendingInteraction){case`approval`:r={state:`warning`,label:t(`status.waitingApproval`),trailingLabel:t(`status.compact.approval`)};break;case`plan-review`:r={state:`warning`,label:t(`status.planReview`),trailingLabel:t(`status.compact.planReview`)};break;case`question`:r={state:`warning`,label:t(`status.waitingAnswer`),trailingLabel:t(`status.compact.answer`)};break;case void 0:break;default:return Fe(e.pendingInteraction)}if(r!==void 0)return n===void 0?[r]:[r,n];if(e.running){let e={state:`ongoing`,label:t(`status.running`)};return n===void 0?[e]:[e,n]}return n===void 0?e.completed?[{state:`done`,label:t(`status.completed`)}]:[{state:`idle`,label:t(`status.idle`)}]:[n]}function Fe(e){throw Error(`unknown pending interaction: ${String(e)}`)}function Ie({statuses:e}){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.visuallyHidden,children:e.label},e.label))]})}let Le=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Le)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Le,e.textContent=`.F2-n5a_trigger,.F2-n5a_shortcuts{display:none}[data-phone] .F2-n5a_trigger{width:44px;height:44px;color:var(--dsw-alias-label-primary);cursor:pointer;-webkit-app-region:no-drag;background:0 0;border:0;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.F2-n5a_trigger[aria-disabled=true]{cursor:wait}.F2-n5a_trigger:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.F2-n5a_trigger:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.F2-n5a_expanded{transform:rotate(180deg)}[data-phone] .F2-n5a_shortcuts{overflow-anchor:none;scroll-behavior:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none;-webkit-app-region:no-drag;grid-column:1/-1;gap:6px;min-width:0;min-height:44px;margin-inline:-12px -20px;padding-inline-end:16px;scroll-padding-inline:8px 20px;display:flex;overflow-x:auto}.F2-n5a_clear{min-width:44px;min-height:44px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:8px;flex:none;align-self:center;padding:0 6px;font-size:12px}.F2-n5a_clear:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.F2-n5a_clear:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.F2-n5a_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var Re={clear:`F2-n5a_clear`,expanded:`F2-n5a_expanded`,shortcuts:`F2-n5a_shortcuts`,trigger:`F2-n5a_trigger`};function ze({useVisits:e,useSessions:t,useWorkspaces:n,useSessionStatus:r,t:i}){let a=e(e=>e),o=t(e=>e),s=n(e=>e.archivedSessionIds),c=r(e=>e);return a.flatMap(e=>{let t=o.byId[e.sessionId];return t===void 0||t.blank||s.includes(e.sessionId)?[]:[{visit:e,summary:t,statuses:Pe({...te(t,o,c),completed:!1},i)}]})}function Be(e){let{useRecentNavigationSettings:t,open:n,close:r,closeAll:i,viewport:c,restoreNavigationFocus:l,renderSlot:u,t:d}=e,f=t(e=>e.value?.showRecentVisits??!0),p=ze(e),m=f&&p.length>0,h=(0,a.useRef)(null),[g,_]=(0,a.useState)(!1),v=(0,a.useCallback)((e=h.current)=>{e?.isConnected&&e.clientWidth>0&&(c.scrollLeft=Math.max(0,Math.min(e.scrollLeft,e.scrollWidth-e.clientWidth)))},[c]);return(0,a.useLayoutEffect)(()=>{let e=h.current;if(e===null)return;e.scrollLeft=c.scrollLeft;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,e.scrollLeft=c.scrollLeft)});return n.observe(e),()=>{v(e),n.disconnect()}},[m,c,v]),m?/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsxs)(`nav`,{ref:h,className:Re.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,s.jsx)(Me,{visit:t,summary:i,identity:u(`workspace.recent.shortcut.identity`,{sessionId:t.sessionId}),activityLabel:a[0].state===`idle`?void 0:a.map(e=>e.label).join(` · `),activity:a[0].state===`idle`?null:/* @__PURE__ */ (0,s.jsx)(Ie,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:d(`recent.close`,{name:i.displayTitle}),closeHint:d(`recent.closeHint`),open:e=>{v(),n(e)},close:e=>{v();try{r(e)}catch{_(!0)}},restoreNavigationFocus:l},t.sessionId)),p.length>=3&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Re.clear,"aria-label":d(`recent.clearAll`),title:d(`recent.clearAllHint`),onMouseDown:e=>e.preventDefault(),onClick:()=>{l();try{i()}catch{_(!0)}},children:d(`recent.clear`)})]}),g&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:d(`recent.closeFailed`),onDone:()=>_(!1)})]}):null}function Ve(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=ze(e),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(!1);return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[c.length>0&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,"data-navigation-focus-return":!0,className:Re.trigger,"aria-label":r(i?`recent.collapse`:`recent.expand`),"aria-expanded":i,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!i).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{size:14,className:i?Re.expanded:void 0})}),d&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function q(e){return e==null}function He(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Ue(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function We(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Ge(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let Ke=Symbol.for(`cosmokit.volatile.write`);function qe(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>qe(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,qe(n,t)])))}finally{t.delete(e)}}function Je(e){let t=qe(e);return Object.freeze({get:()=>t,[Ke]:e=>{t=e}})}function Ye(e){return typeof e==`object`&&!!e&&Ke in e}function Xe(e,t){return arguments.length===1?t=>Xe(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function Ze(e){return Xe(`ArrayBuffer`,e)||Xe(`SharedArrayBuffer`,e)}function Qe(e){return Ze(e)||ArrayBuffer.isView(e)}let $e;(function(e){e.is=Ze,e.isSource=Qe;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})($e||={}),$e.fromBase64,$e.toBase64,$e.fromHex,$e.toHex;function et(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(Xe(`Date`,e))return new Date(e.valueOf());if(Xe(`RegExp`,e))return new RegExp(e.source,e.flags);if(Ze(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(et,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(et,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function tt(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(Ye(e)||Ye(t))return Ye(e)&&Ye(t);if(!n&&q(e)&&q(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(Xe(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(Xe(`URL`),(e,t)=>e.href===t.href)??a(Xe(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(Ze,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let nt;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(nt||={});let rt=Symbol.for(`schemastery`),it=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var J=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[it]}};Object.defineProperty(J.prototype,it,{value:!0});let Y=function(e){let t=function(e,n={}){return Y.resolve(e,t,n)[0]};if(e.refs){let t=We(e.refs,e=>new Y(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&We(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,Y.prototype),t.meta||={},t.toString=t.toString.bind(t),t};Y.prototype=Object.create(Function.prototype),Y.prototype[rt]=!0,Object.defineProperty(Y.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:Y.resolve(e,this,{})[0]}}catch(e){if(J.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),Y.ValidationError=J,Y.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},Y.prototype.set=function(e,t){return this.dict[e]=t,this},Y.prototype.push=function(e){return this.list.push(e),this};function at(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function ot(e){return e?.$value??e?.$inner}function st(e){return Ue(e??{},e=>!e.startsWith(`$`))}Y.prototype.i18n=function(e){let t=Y(this),n=at(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=We(t.dict,(t,n)=>t.i18n(We(e,e=>ot(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(We(e,(e={})=>Array.isArray(ot(e))?ot(e)[n]:Array.isArray(e)?e[n]:st(e)))),t.inner&&=t.inner.i18n(We(e,e=>ot(e)?ot(e):st(e))),t.sKey&&=t.sKey.i18n(We(e,e=>e?.$key)),t},Y.prototype.extra=function(e,t){let n=Y(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(Y.prototype,{[e](t=!0){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.deprecated=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},Y.prototype.experimental=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},Y.prototype.pattern=function(e){let t=Y(this),n=Ge(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},Y.prototype.simplify=function(e){if(Ye(e)&&(e=e.get()),tt(e,this.meta.default,this.type===`dict`))return null;if(q(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!q(r))&&(t[n]=r)}return tt(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return Y.resolve(e,t,{}),t.simplify(e)}catch{}return e},Y.prototype.toString=function(e){return gt[this.type]?.(this,e)??`Schema<${this.type}>`},Y.prototype.role=function(e,t){let n=Y(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(Y.prototype,{[e](t){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let ct={},lt=Symbol(`checked-volatile-schema`);function ut(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new J(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))ut(i,[...t,n],a,r);if(e.sKey&&ut(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[rt])&&ut(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)ut(e.list[n],[...t,String(n)],!0,r)}Y.extend=function(e,t){ct[e]=t},Y.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[lt]||(ut(t,n.path),n={...n,[lt]:!0}),t.meta?.volatile){let i=Y(t);i.meta={...t.meta,volatile:!1};let[a,o]=Y.resolve(e,i,n,r);try{return[Je(a),o]}catch(e){throw new J(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(q(e)&&t.type!==`lazy`){if(t.meta.required)throw new J(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&q(i);)r=r.list[0],i=r?.meta.default;if(q(i))return[e];e=et(i)}let i=ct[t.type];if(!i)throw new J(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},Y.from=function(e){if(q(e))return Y.any();if([`string`,`number`,`boolean`].includes(typeof e))return Y.const(e).required();if(e[rt])return e;if(typeof e==`function`)switch(e){case String:return Y.string().required();case Number:return Y.number().required();case Boolean:return Y.boolean().required();case Function:return Y.function().required();default:return Y.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},Y.lazy=function(e){let t=new Y({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[rt]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},Y.natural=function(){return Y.number().step(1).min(0)},Y.percent=function(){return Y.number().step(.01).min(0).max(1).role(`slider`)},Y.date=function(){return Y.union([Y.is(Date),Y.transform(Y.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new J(`invalid date "${e}"`,t);return n},!0)])},Y.regExp=function(e=``){return Y.union([Y.is(RegExp),Y.transform(Y.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new J(e.message,n)}},!0)])},Y.arrayBuffer=function(e){return Y.union([Y.is(ArrayBuffer),Y.is(SharedArrayBuffer),Y.transform(Y.any(),(e,t)=>{if($e.isSource(e))return $e.fromSource(e);throw new J(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[Y.transform(Y.string(),(t,n)=>{try{return e===`base64`?$e.fromBase64(t):$e.fromHex(t)}catch(e){throw new J(e.message,n)}},!0)]:[]])},Y.extend(`lazy`,(e,t,n,r)=>(t.inner[rt]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},ut(t.inner,n.path,!0)),Y.resolve(e,t.inner,n,r))),Y.extend(`any`,e=>[e]),Y.extend(`never`,(e,t,n)=>{throw new J(`expected nullable but got ${e}`,n)}),Y.extend(`const`,(e,{value:t},n)=>{if(tt(e,t))return[t];throw new J(`expected ${t} but got ${e}`,n)});function dt(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new J(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new J(`expected ${n} >= ${o} but got ${e}`,r)}Y.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new J(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new J(`expect string to match regexp ${r}`,n)}return dt(e.length,t,`string length`,n),[e]});function ft(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function pt(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(ft(e,i)-ft(t,i))%ft(n,i)===0}Y.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new J(`expected number but got ${e}`,n);dt(e,t,`number`,n);let{step:r}=t;if(r&&!pt(e,t.min??0,r))throw new J(`expected number multiple of ${r} but got ${e}`,n);return[e]}),Y.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new J(`expected boolean but got ${e}`,n)}),Y.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new J(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new J(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),Y.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new J(`expected function but got ${e}`,n)}),Y.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new J(`expected ${t.name} but got ${e}`,n)}{if(q(e))throw new J(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new J(`expected ${t} but got ${e}`,n)}});function mt(e,t,n,r){try{let[i,a]=Y.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?Je(n.meta.default):n.meta.default}}Y.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new J(`expected array but got ${e}`,r);return dt(e.length,n,`array length`,r,!q(t.meta.default)),[e.map((n,i)=>mt(e,i,t,r))]}),Y.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!He(e))throw new J(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=Y.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=mt(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),Y.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new J(`expected array but got ${e}`,n);let i=t.map((t,r)=>mt(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function ht(e,t){for(let n in t)n in e||(e[n]=t[n])}Y.extend(`object`,(e,{dict:t},n,r)=>{if(!He(e))throw new J(`expected object but got ${e}`,n);let i={};for(let r in t){let a=mt(e,r,t[r],n);(!q(a)||r in e)&&(i[r]=a)}return r||ht(i,e),[i]}),Y.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return Y.resolve(e,n,r,i)}catch(e){a.push(e)}throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),Y.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=Y.resolve(e,i,r,!0)[0];if(!q(t)){if(q(a))a=t;else if(typeof a!=typeof t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)ht(a??={},t);else if(a!==t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&He(e)&&ht(a,e),[a]}),Y.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=Y.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let gt={};function X(e,t,n){gt[e]=n,Object.assign(Y,{[e](...n){let r=new Y({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??Y.string();break;case`inner`:r.inner=Y.from(n[t]);break;case`list`:r.list=n[t].map(Y.from);break;case`dict`:r.dict=We(n[t],Y.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}X(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),X(`any`,[],()=>`any`),X(`never`,[],()=>`never`),X(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),X(`string`,[],()=>`string`),X(`number`,[],()=>`number`),X(`boolean`,[],()=>`boolean`),X(`bitset`,[`bits`],()=>`bitset`),X(`function`,[],()=>`function`),X(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),X(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),X(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),X(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),X(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),X(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),X(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let _t=[0,15,30,60,120,240,1440],vt={showRecentVisits:!0,tabIdleTimeoutMinutes:60},yt={showRecentVisits:Y.boolean().default(!0),tabIdleTimeoutMinutes:Y.natural().max(1440).default(60)},bt=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(bt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=bt,e.textContent=`.s99QdG_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}.s99QdG_text{flex:160px;min-width:0}.s99QdG_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}.s99QdG_menu{flex:none;margin-inline-start:auto}.s99QdG_selector{background:var(--dsw-alias-bg-module-platform);min-width:96px;min-height:44px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:0;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:0 12px;font-size:14px;line-height:20px;display:inline-flex}.s99QdG_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}.s99QdG_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){.s99QdG_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}.s99QdG_error{padding-bottom:12px;font-size:12px;line-height:18px}.s99QdG_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.s99QdG_title{font-size:14px;line-height:20px}.s99QdG_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var xt={description:`s99QdG_description`,error:`s99QdG_error`,menu:`s99QdG_menu`,row:`s99QdG_row`,selector:`s99QdG_selector`,text:`s99QdG_text`,timeoutRow:`s99QdG_timeoutRow`,title:`s99QdG_title`,titleLine:`s99QdG_titleLine`};function St({usePreference:e,setEnabled:t,setIdleTimeout:n,t:r}){let i=e(e=>e.value),c=i?.showRecentVisits??!0,l=i?.tabIdleTimeoutMinutes??60,[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)(!1),g=(0,a.useRef)(!1),_=(0,a.useId)();(0,a.useEffect)(()=>{c||d(!1)},[c]);let v=e=>e===0?r(`recent.timeout.off`):e>=120&&e%60==0?r(`recent.timeout.hours`,{n:e/60}):r(`recent.timeout.minutes`,{n:e}),y=e=>{g.current||(g.current=!0,d(!1),p(!0),h(!1),Promise.resolve().then(e).then(e=>h(!e)).catch(()=>h(!0)).finally(()=>{g.current=!1,p(!1)}))};return/* @__PURE__ */ (0,s.jsxs)(`div`,{children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:xt.row,children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:xt.text,children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:xt.titleLine,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:xt.title,children:r(`recent.settings.title`)}),/* @__PURE__ */ (0,s.jsx)(o.Tag,{tone:`neutral`,children:r(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:xt.description,children:r(`recent.settings.description`)})]}),/* @__PURE__ */ (0,s.jsx)(o.Switch,{checked:c,disabled:f,label:`${r(`recent.settings.title`)} · ${r(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,s.jsxs)(`div`,{className:`${xt.row} ${xt.timeoutRow}`,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:xt.text,children:/* @__PURE__ */ (0,s.jsx)(`div`,{className:xt.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,s.jsx)(o.Menu,{className:xt.menu,open:u&&c&&!f,onClose:()=>d(!1),items:_t.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=_t.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,s.jsxs)(`button`,{type:`button`,className:xt.selector,disabled:!c||f,"aria-labelledby":`${_}-label ${_}-value`,"aria-haspopup":`menu`,"aria-expanded":u&&c&&!f,onClick:()=>d(e=>!e),children:[/* @__PURE__ */ (0,s.jsx)(`span`,{id:`${_}-value`,children:v(l)}),/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:xt.error,role:`alert`,children:r(`recent.settings.error`)})]})}function Ct(e,t,n){let r=e=>n.set(`showRecentVisits`,e),i=e=>n.set(`tabIdleTimeoutMinutes`,e),a={scrollLeft:0};e.inject([`uiSession`,`connection`],e=>{e.effect(()=>{let r,i=()=>{let r=n.getSnapshot().value;r!==void 0&&document.visibilityState===`visible`&&e.connection.state.getSnapshot()===`connected`&&r.showRecentVisits&&r.tabIdleTimeoutMinutes!==0&&t.opening.getSnapshot().state!==`loading`&&t.recentVisits.expireInactive(r.tabIdleTimeoutMinutes*6e4,e.uiSession.sessionStatus.getSnapshot())&&t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},o=()=>{r!==void 0&&clearInterval(r),r=void 0;let e=n.getSnapshot().value;document.visibilityState===`visible`&&e?.showRecentVisits&&e.tabIdleTimeoutMinutes>0&&(r=setInterval(i,6e4))},s=n.subscribe(o);return document.addEventListener(`visibilitychange`,o),o(),()=>{s(),r!==void 0&&clearInterval(r),document.removeEventListener(`visibilitychange`,o)}},`ui-workspace: idle session tabs`)});let o=()=>({hooks:{visits:t.recentVisits.entries,recentNavigationSettings:n},open:e=>t.openSession(e),close:e=>{t.closeSessionTab(e),t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},closeAll:()=>{t.closeAllSessionTabs(),a.scrollLeft=0},viewport:a,setEnabled:r});e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},Ve)),e.slots.inject(`conversation.header.shortcuts`,()=>e.slots.register({name:`conversation.header.shortcuts`,locale:`workspace`,inject:o,children:{"workspace.recent.shortcut.identity":{kind:`list`,scope:`root`}}},Be)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.recent-navigation`,order:12,locale:`workspace`,inject:()=>({hooks:{preference:n},setEnabled:r,setIdleTimeout:i})},St))}let wt=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(wt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=wt,e.textContent=`.mbWf4a_options{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;align-items:flex-start;gap:8px;padding-block:6px;display:flex}.mbWf4a_settingsText{flex:240px}.mbWf4a_prompt{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;border-radius:8px;min-width:0;margin:6px 2px 8px;padding:8px;font-size:12px;line-height:16px}.mbWf4a_promptHeading{justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;display:flex}.mbWf4a_promptHeading strong{font-weight:500}.mbWf4a_comparison{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.mbWf4a_choice{appearance:none;min-width:0;color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:0;border-radius:5px 0 0 5px;flex-direction:column;justify-content:flex-start;align-items:stretch;padding:8px 0 4px;display:flex;position:relative}.mbWf4a_choice+.mbWf4a_choice{border-inline-start:1px solid var(--dsw-alias-border-l2);border-radius:0 5px 5px 0}.mbWf4a_choice[aria-checked=true]{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.mbWf4a_choiceTitle{padding:0 8px 2px;font-size:12px;font-weight:500;display:block}.mbWf4a_choiceSubtitle{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-secondary);padding:0 8px 6px;font-size:10px;line-height:16px;overflow:hidden}.mbWf4a_preview{pointer-events:none;user-select:none;grid-auto-rows:44px;min-width:0;display:grid;overflow:hidden}.mbWf4a_preview .mbWf4a_sampleRow{--dsh-thread-row-height:22px;--dsh-workspace-indent:0px;--dsh-thread-indent:0px;min-height:0;padding-inline:6px}.mbWf4a_preview [data-session-title]{margin-inline:7px 0;font-size:11px}.mbWf4a_preview .mbWf4a_sampleSummary{margin-block-end:0;padding:0 0 0 7px;font-size:9px;line-height:11px}.mbWf4a_sampleIcon{flex-shrink:0;width:14px;height:14px;display:inline-flex}.mbWf4a_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 8px;font-size:11px;line-height:1.5}.mbWf4a_later{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;flex-shrink:0;padding:4px}.mbWf4a_choice:focus-visible,.mbWf4a_later:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.mbWf4a_error{color:var(--dsw-alias-state-warn-primary);overflow-wrap:anywhere;flex-basis:100%;margin-top:6px;font-size:12px}@media (width<=639px){.mbWf4a_choiceTitle,.mbWf4a_choiceSubtitle{padding-inline:6px}.mbWf4a_preview [data-session-title]{font-size:10px}}@media (hover:none),(pointer:coarse){.mbWf4a_later{min-height:44px}}`,document.head.appendChild(e)}var Z={choice:`mbWf4a_choice`,choiceSubtitle:`mbWf4a_choiceSubtitle`,choiceTitle:`mbWf4a_choiceTitle`,comparison:`mbWf4a_comparison`,error:`mbWf4a_error`,hint:`mbWf4a_hint`,later:`mbWf4a_later`,options:`mbWf4a_options`,preview:`mbWf4a_preview`,prompt:`mbWf4a_prompt`,promptHeading:`mbWf4a_promptHeading`,sampleIcon:`mbWf4a_sampleIcon`,sampleRow:`mbWf4a_sampleRow`,sampleSummary:`mbWf4a_sampleSummary`,settingsText:`mbWf4a_settingsText`};let Tt=[`summary`,`ring`];function Et(e){let[t,n]=(0,a.useState)(!1),[r,i]=(0,a.useState)(!1),o=(0,a.useRef)(!1);return{busy:t,failed:r,save:async t=>{if(o.current)return!1;o.current=!0,n(!0),i(!1);try{let n=await e(t);return i(!n),n}catch{return i(!0),!1}finally{o.current=!1,n(!1)}}}}function Dt({style:e,setStyle:t,t:n,settings:r=!1}){let i=(0,a.useId)(),{busy:c,failed:l,save:u}=Et(t);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:r?o.preferenceRowStyles.row:Z.options,children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:`${o.preferenceRowStyles.rowText} ${r?Z.settingsText:``}`,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:o.preferenceRowStyles.title,id:i,children:n(`threadTree.style.title`)}),r&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:o.preferenceRowStyles.description,id:`${i}-description`,children:n(`threadTree.style.description`)})]}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:o.preferenceRowStyles.choices,role:`radiogroup`,"aria-labelledby":i,"aria-describedby":r?`${i}-description`:void 0,"aria-busy":c,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=[...e.currentTarget.querySelectorAll(`[role="radio"]`)],n=t.indexOf(e.target),r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:1)+t.length)%t.length;t[r]?.focus(),t[r]?.click()},children:Tt.map(t=>/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,role:`radio`,className:o.preferenceRowStyles.choice,"aria-checked":e===t,"aria-disabled":c,tabIndex:e===t?0:-1,onClick:()=>void u(t),children:n(`threadTree.style.${t}`)},t))}),l&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Z.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function Ot({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,s.jsx)(Dt,{style:r,setStyle:t,t:n,settings:!0})}let kt={...vt,threadTreeCollapseStyle:`summary`},At=Y.object({...yt,threadTreeCollapseStyle:Y.union([`summary`,`ring`]).default(`summary`)});function jt(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function Mt(e){let t=e.configForms.registerBrowser(`ui-workspace`,At.toJSON(),{...kt});return e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.thread-tree-style`,order:11.5,locale:`workspace`,inject:()=>({hooks:{preference:t},setStyle:e=>t.set(`threadTreeCollapseStyle`,e)})},Ot)),t}function Nt(e,t,n){let r=e.find(e=>e.workspaceId===t),i=e.find(e=>e.workspaceId===n);return r!==void 0&&i!==void 0&&!r.remote&&!i.remote}function Pt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Pt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Q(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Pt(e))&&(r&&(r+=` `),r+=t);return r}function Ft(e,t){return e===`default-workspace`?t:e}let It={},Lt=(0,a.createContext)({t:e=>e,expansion:It,rows:e=>T(e,It),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function Rt(){return(0,a.useContext)(Lt)}function zt({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:o,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=jt(u.user),f=u.value?.threadTreeCollapseStyle??`summary`,[p,m]=(0,a.useState)(),h=(0,a.useCallback)(()=>m(void 0),[]),g=n(e=>e),_=i(e=>e),v=r(e=>e.threadExpansion??It),y=r(e=>e.archivedFilter??`default`),b=(0,a.useMemo)(()=>z(g,{pinnedSessionIds:_.pinnedSessionIds,archivedSessionIds:_.archivedSessionIds,archivedFilter:y},/* @__PURE__ */ new Map),[g,_,y]),x=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of b){let n=[{node:t,ancestors:[]}];for(let r=n.pop();r!==void 0;r=n.pop()){e.set(r.node.id,{root:t,ancestors:r.ancestors});for(let e of r.node.tree?.children??[])n.push({node:e,ancestors:[...r.ancestors,r.node.id]})}}return e},[b]),S=(0,a.useRef)(void 0),C=(0,a.useCallback)(e=>S.current===e,[]),w=(0,a.useCallback)(e=>{S.current=e,o.setThreadsExpanded(x.get(e)?.ancestors??[],!0)},[o,x]),E=(0,a.useCallback)(e=>{S.current=void 0;let t=x.get(e);t!==void 0&&o.setThreadsExpanded(t.ancestors,!0)},[o,x]),D=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,O=(0,a.useRef)(``);(0,a.useEffect)(()=>{D===void 0?O.current=``:x.get(D)!==void 0&&O.current!==D&&(O.current=D,C(D)||E(D))},[D,C,E,x]);let k=(0,a.useMemo)(()=>({t:e.t,expansion:v,rows:e=>T(e,v),toggle:(e,t,n)=>{o.setThreadsExpanded([e],t),t&&n!==void 0&&!d&&m(n)},markCompletionsRead:e.markCompletionsRead??(()=>{}),collapseStyle:f,stylePrompt:d?void 0:p,dismissStylePrompt:h,setCollapseStyle:l,rootId:e=>x.get(e)?.root.id??e,reveal:E,selectSidebarRow:w,isSidebarSelection:C}),[e.t,e.markCompletionsRead,o,v,x,E,w,C,f,d,p,h,l]);return/* @__PURE__ */ (0,s.jsx)(Lt.Provider,{value:k,children:t})}function Bt({identity:e,ambient:t,title:n,onIdentityClick:r,identityLabel:i,identityControls:a,identityExpanded:o,children:c}){let l=/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[e,/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.statusOverlay,children:t})]});return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[r?/* @__PURE__ */ (0,s.jsxs)(`button`,{type:`button`,className:`${K.slot} ${K.identityButton}`,onClick:r,"data-thread-icon-toggle":!0,"aria-label":i,title:i,"aria-expanded":o,"aria-controls":a,children:[l,/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.slot,children:l}),/* @__PURE__ */ (0,s.jsx)(`span`,{"data-session-title":!0,className:K.title,children:n}),c]})}function Vt({host:e,t}){let n=e?.displayName??t(`host.local`),r=e?.state===`connected`?t(`host.connected`):e?.state===`connecting`?t(`host.connecting`):t(`host.disconnected`),i=e?`${n} · ${r}`:n;return/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.hostBadge,"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,role:`img`,"aria-label":i,title:i,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{children:n}),e&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.hostDot,"aria-hidden":`true`})]})}let Ht=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ht)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ht,e.textContent=`._88N-4W_branch{--dsh-thread-row-height:32px;--dsh-thread-icon-size:16px;--dsh-thread-icon-center-y:calc(var(--dsh-thread-row-height) / 2);--dsh-thread-row-gap:2px;min-width:0;position:relative}._88N-4W_branch:has(>:first-child [data-harness-id]){--dsh-thread-icon-size:14px}._88N-4W_branch:has(>:first-child [data-harness-id])>._88N-4W_children{--dsh-thread-parent-icon-size:14px}._88N-4W_children{gap:var(--dsh-thread-row-gap);margin-top:var(--dsh-thread-row-gap);--dsh-thread-parent-icon-size:16px;--dsh-thread-guide-parent-gap:12px;--dsh-thread-guide-start:calc(var(--dsh-thread-guide-parent-gap) - (var(--dsh-thread-row-height) - var(--dsh-thread-parent-icon-size)) / 2 - var(--dsh-thread-row-gap));--dsh-thread-guide-axis:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-guide-indent) + var(--dsh-thread-parent-icon-size) / 2 + .5px);flex-direction:column;display:flex;position:relative}._88N-4W_children ._88N-4W_children{--dsh-thread-guide-parent-gap:10px}._88N-4W_children[hidden]{display:none}._88N-4W_children[data-thread-guide]:before,._88N-4W_children[data-thread-guide]>._88N-4W_branch:before{content:"";pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--dsh-thread-guide-axis)}._88N-4W_children[data-thread-guide]:before{top:var(--dsh-thread-guide-start);height:max(0px, calc(-1 * var(--dsh-thread-guide-start)));background:var(--dsw-alias-border-l2);width:1px}._88N-4W_children[data-thread-guide]>._88N-4W_branch:before{--dsh-thread-guide-stem-start:0px;--dsh-thread-guide-stem-end:0px;top:0;bottom:calc(-1 * var(--dsh-thread-row-gap));width:calc(24px - var(--dsh-thread-parent-icon-size) / 2 - 6.5px);background:var(--dsw-alias-border-l2);mask:linear-gradient(transparent var(--dsh-thread-guide-stem-start), black 0) 0 0 / 1px calc(100% - var(--dsh-thread-guide-stem-end)) no-repeat, url("data:image/svg+xml,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 11 8\\" preserveAspectRatio=\\"none\\"><path d=\\"M.5 0V1Q.5 3.3 2.5 4.5L10.5 7.5\\" fill=\\"none\\" stroke=\\"black\\" stroke-width=\\"1\\" vector-effect=\\"non-scaling-stroke\\"/></svg>") 0 calc(var(--dsh-thread-icon-center-y) - 8px) / 100% 8px no-repeat}._88N-4W_children[data-thread-guide]>._88N-4W_branch:first-child:before{--dsh-thread-guide-stem-start:max(0px, var(--dsh-thread-guide-start))}._88N-4W_children[data-thread-guide]>._88N-4W_branch:last-child:before{--dsh-thread-guide-stem-end:8px;bottom:calc(100% - var(--dsh-thread-icon-center-y))}._88N-4W_summary{appearance:none;width:calc(100% - var(--dsh-thread-icon-size));min-width:0;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:6px;margin-block-end:2px;margin-inline-start:var(--dsh-thread-icon-size);padding:2px 8px;font-size:11px;line-height:18px;display:block}._88N-4W_summary [data-thread-tree-activity=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}._88N-4W_summary [data-thread-tree-activity=pending]{color:var(--dsw-alias-state-warn-primary)}._88N-4W_summary [data-thread-tree-activity=completed]{color:var(--dsw-alias-state-business-primary)}@media (hover:hover) and (pointer:fine){._88N-4W_summary:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)}}._88N-4W_summary:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){._88N-4W_branch{--dsh-thread-row-height:44px}._88N-4W_summary{min-height:24px;padding-block:3px}}[data-phone-drawer] ._88N-4W_branch{--dsh-thread-row-height:44px}[data-phone-drawer] ._88N-4W_branch:has(>:first-child>[data-thread-summary]){--dsh-thread-icon-center-y:14px}`,document.head.appendChild(e)}var Ut={branch:`_88N-4W_branch`,children:`_88N-4W_children`,summary:`_88N-4W_summary`};function Wt(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function Gt(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function Kt(e,t,n){return[n(`threadTree.children`,{n:e}),...Wt(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function qt({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[n(`threadTree.children`,{n:e}),Wt(t).filter(e=>e.count>0).map(e=>/* @__PURE__ */ (0,s.jsx)(`span`,{"data-thread-tree-activity":e.state,children:` · ${n(`threadTree.${e.state}`,{n:e.count})}`},e.state))]})}let Jt=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Jt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Jt,e.textContent=`.PiR7ua_ring{inset-inline-start:50%;margin-inline-start:-11px;pointer-events:none;width:22px;height:22px;color:var(--dsw-alias-state-business-primary);margin-top:-11px;position:absolute;top:50%}.PiR7ua_ring svg{width:100%;height:100%;display:block}.PiR7ua_ring circle{stroke:currentColor;stroke-width:1.5px}.PiR7ua_ring[data-thread-ring=pending]{color:var(--dsw-alias-state-warn-primary)}.PiR7ua_ring[data-thread-ring=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.PiR7ua_ring[data-thread-ring=running] svg{animation:1.8s linear infinite PiR7ua_spin}.PiR7ua_ring[data-thread-ring=running] circle{stroke-dasharray:48 16.4}.PiR7ua_ring[data-thread-ring=idle]{color:var(--dsw-alias-label-tertiary);opacity:.55}.PiR7ua_ring[data-thread-ring=idle] circle{stroke-width:1px;stroke-dasharray:1.5 3}@keyframes PiR7ua_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.PiR7ua_ring[data-thread-ring=running] svg{animation:none}}`,document.head.appendChild(e)}var Yt={ring:`PiR7ua_ring`,spin:`PiR7ua_spin`};function Xt({activity:e}){return/* @__PURE__ */ (0,s.jsx)(`span`,{className:Yt.ring,"data-thread-ring":Gt(e),"aria-hidden":`true`,children:/* @__PURE__ */ (0,s.jsx)(`svg`,{viewBox:`0 0 22 22`,fill:`none`,children:/* @__PURE__ */ (0,s.jsx)(`circle`,{cx:`11`,cy:`11`,r:`10.25`})})})}let Zt=[{title:`threadTree.style.samplePending`,activity:{pendingInteraction:1,running:0,completed:0}},{title:`threadTree.style.sampleRunning`,activity:{pendingInteraction:0,running:1,completed:0}},{title:`threadTree.style.sampleUnread`,activity:{pendingInteraction:0,running:0,completed:1}},{title:`threadTree.style.sampleRead`,activity:{pendingInteraction:0,running:0,completed:0}}];function Qt({style:e,t}){return/* @__PURE__ */ (0,s.jsx)(`div`,{className:Z.preview,"aria-hidden":`true`,children:Zt.map(({title:n,activity:r})=>/* @__PURE__ */ (0,s.jsx)(`div`,{className:Ut.branch,children:/* @__PURE__ */ (0,s.jsxs)(`div`,{className:`${K.sessionRow} ${Z.sampleRow}`,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.sessionMain,children:/* @__PURE__ */ (0,s.jsx)(Bt,{title:t(n),identity:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(`span`,{"data-harness-id":`codex`,className:Z.sampleIcon,children:/* @__PURE__ */ (0,s.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,s.jsx)(Xt,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:`${Ut.summary} ${Z.sampleSummary}`,children:/* @__PURE__ */ (0,s.jsx)(qt,{count:2,activity:r,t})})]})},n))})}function $t({style:e,setStyle:t,onLater:n,onExit:r,t:i}){let o=(0,a.useId)(),[c,l]=(0,a.useState)(e),u=(0,a.useRef)(null),d=(0,a.useRef)(r);d.current=r,(0,a.useLayoutEffect)(()=>{let e=u.current;return e?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),()=>{e?.contains(document.activeElement)&&d.current()}},[]);let{busy:f,failed:p,save:m}=Et(t);return/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:u,className:Z.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":o,children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Z.promptHeading,children:[/* @__PURE__ */ (0,s.jsx)(`strong`,{id:o,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Z.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,s.jsx)(`p`,{className:Z.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:Z.comparison,role:`radiogroup`,"aria-labelledby":o,"aria-busy":f,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=e.key===`Home`||e.key===`End`?Tt[e.key===`Home`?0:1]:Tt[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:Tt.map(t=>/* @__PURE__ */ (0,s.jsxs)(`button`,{type:`button`,role:`radio`,className:Z.choice,"data-thread-style-choice":t,"aria-disabled":f,"aria-checked":e===t,"aria-labelledby":`${o}-${t}`,"aria-describedby":`${o}-${t}-description`,tabIndex:c===t?0:-1,onFocus:()=>l(t),onClick:()=>void m(t),children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:Z.choiceTitle,id:`${o}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:Z.choiceSubtitle,id:`${o}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,s.jsx)(Qt,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Z.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let en=(0,a.createContext)(void 0),tn=()=>(0,a.useContext)(en);function nn({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,s.jsx)(rn,{node:e,renderRow:t},e.id))}function rn({node:e,renderRow:t}){let n=(0,a.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:o,collapseStyle:c,setCollapseStyle:l,t:u}=Rt(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Ut.branch,"data-thread-branch":!0,children:[/* @__PURE__ */ (0,s.jsx)(en.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,s.jsx)($t,{style:c,setStyle:l,onLater:o,onExit:()=>document.querySelector(`[data-thread-icon-toggle][aria-controls="${CSS.escape(n)}"]`)?.focus({preventScroll:!0}),t:u}),p.length>0&&/* @__PURE__ */ (0,s.jsx)(`div`,{id:n,role:`group`,hidden:!d,"data-thread-guide":d&&f<3?``:void 0,className:Ut.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,s.jsx)(nn,{roots:p,children:t})})]})}function an({node:e,title:t,toggle:n,t:r}){let i=tn(),o=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>{let e=o.current;return()=>{e!==null&&document.activeElement===e&&e.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0})}},[]);let c=e.tree;if(!c||c.descendantCount===0)return null;let l=Kt(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,s.jsx)(`button`,{ref:o,type:`button`,"data-thread-summary":!0,className:Ut.summary,"aria-label":r(`threadTree.expandSummary`,{title:t,summary:l}),"aria-expanded":!1,"aria-controls":i,onClick:e=>{e.stopPropagation(),e.currentTarget.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0}),n()},children:/* @__PURE__ */ (0,s.jsx)(qt,{count:c.descendantCount,activity:c.activity,t:r})})}function on(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function sn(e,t,n){let{unit:r,n:i}=(0,o.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.${r}`,{n:i})}function cn(e,t,n){let{unit:r,n:i}=(0,o.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${r}`,{n:i})})}function ln(e,t){let n=new Date(e),r=e=>String(e).padStart(2,`0`);return t(`hover.created`,{time:`${t(`date.ymd`,{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()})} ${r(n.getHours())}:${r(n.getMinutes())}`})}function un({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K.hoverContent,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.hoverTitle,children:e}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.hoverPath,children:t}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.hoverTime,children:ln(n,r)})]})}function dn(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function fn({group:e,onToggle:t,onCreate:n,actions:r,drag:i,home:c,newShortcut:l,t:u}){let d=e,f=e.remote?void 0:r,p=e.remote?void 0:i,m=d.workspaceId===void 0?u(`group.ungrouped`):d.label,[h,g]=(0,a.useState)(!1),[_,v]=(0,a.useState)(null),b=[{id:`rename`,label:u(`rename`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconEditOutlineRegular,{})},{id:`delete`,label:u(`delete.workspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconTrashOutlineRegular,{}),danger:!0}],x=/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q(K.projectRow,h&&K.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":d.expanded,tabIndex:-1,onContextMenu:e=>{f&&!e.target.closest(`button`)&&(e.preventDefault(),v(new DOMRect(e.clientX,e.clientY,0,0)),g(!0))},onKeyDown:e=>{e.target===e.currentTarget&&f&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),v(null),g(!0))},onClick:t,draggable:p!==void 0,onDragStart:p===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,d.key),p.start()},onDragEnd:p?.end,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q(K.slot,d.expanded&&K.folderExpanded),children:d.expanded?/* @__PURE__ */ (0,s.jsx)(o.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{})}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.projectText,children:/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.title,children:m})}),d.workspaceId!==void 0&&d.remote&&/* @__PURE__ */ (0,s.jsx)(Vt,{host:d.remote,t:u}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.rowActions,children:[f!==void 0&&/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:h,onClose:()=>{g(!1)},items:b,onSelect:e=>{
|
|
9
|
+
default:return _(n)}}function N(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id)&&t.has(a.id)?r.push(a):i.push(a);return[...r,...i]}function P(e){return e.blank?``:e.title?.trim()??``}function ee(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function F(e,t,n,r){let i=[];for(let a of t){let t=[];for(let i of a.sessionIds){let a=e.byId[i];a!==void 0&&M(a,n,r)&&t.push(a)}(r!==`only`||t.length!==0)&&i.push(ee(a.workspaceId,a.workspaceId,a.path,Date.parse(a.createdAt),a.title,t,a.remote))}let a=k(e.ids,e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&M(e,n,r));return a.length>0&&i.push(ee(``,void 0,void 0,void 0,``,a)),i}function I(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function te(e,t,n){return e.projectionsBySession[t]?.values.subagentCatalog?.reduce((t,r)=>t+ +((n.get(r.id)?.running??e.byId[r.id]?.running)===!0),0)??0}function L(e,t,n){let r=n.get(e.id),i=I(r?.pendingInteraction?.kind);return{running:r?.running??e.running,runningSubagentCount:te(t,e.id,n),completed:r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function ne(e,t,n,r,i){return{id:e.id,reference:x(e),remote:e.projectionValues?.remoteHost??void 0,title:P(e),...e.cwd===void 0?{}:{cwd:e.cwd},blank:e.blank,...L(e,t,n),pinned:!i.has(e.id)&&r.has(e.id),archived:i.has(e.id),updatedAt:e.updatedAt}}function re(e,t){if(e.projectionValues?.remoteHost)return null;let n=e.projectionValues?.threadTreeParent??null,r=n===null?void 0:t?.byId[f(n)];if(r?.projectionValues?.remoteHost)return null;let i=e.projectionValues?.threadReference?.hostId,a=r?.projectionValues?.threadReference?.hostId;return i!==void 0&&a!==void 0&&i!==a?null:n}function R(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return w(B(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[ne(a,e,n,i,r)]}),n=>{if(t.sectionedSessionIds?.has(n.id))return null;let r=e.byId[n.id];return r===void 0?null:re(r,e)})}function z(e,t,n,r,i){let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=new Set(i.expandedGroups),c=D(e),l=new Map(R(e,n,r).map(e=>[e.id,e])),u=[];for(let r of F(e,t,a,n.archivedFilter)){let e=s.has(r.key),t=r.sessions.flatMap(e=>{let t=l.get(e.id);return t===void 0||i.excludePinned&&(t.pinned||n.sectionedSessionIds?.has(t.id))?[]:[t]});r.key===``&&t.sort((e,t)=>(t.tree?.updatedAt??t.updatedAt)-(e.tree?.updatedAt??e.updatedAt)||e.id.localeCompare(t.id)),u.push({key:r.key,workspaceId:r.workspaceId,cwd:r.cwd,createdAt:r.createdAt,label:r.label,remote:r.remote,sessionCount:t.length,expanded:e,containsCurrent:t.some(e=>e.id===c||c!==void 0&&e.tree?.descendantIds.includes(c)),sessions:e?N(t,o,a):[]})}return u}function ie(e,t=[]){return[...B(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function B(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&M(i,r,n)})}function ae(e,t,n,r){let i=new Set(n.archivedSessionIds),a=new Set(n.pinnedSessionIds),o=new Map(R(e,n,r).map(e=>[e.id,e]));return N(t.flatMap(e=>{let t=o.get(e);return t===void 0?[]:[t]}),a,i)}function oe(e,t,n,r,i,a,o,s){let c=n.trim().toLowerCase();if(c===``)return{items:[],hasMore:!1};let l=new Set(r),u=/* @__PURE__ */ new Map;for(let e of t)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=e=>u.get(e.id)??O(e.cwd),p=/* @__PURE__ */ new Map;for(let e of o.items)p.has(e.sessionId)||p.set(e.sessionId,e);let m=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&M(n,l,i)&&(P(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&m.push(n)}let h=new Map(m.map(e=>[e.id,e])),g=k(m.map(e=>e.id),e.byId).map(e=>h.get(e)),_=[],v=/* @__PURE__ */ new Set,y=e=>{v.has(e.id)||(v.add(e.id),_.push(e))};for(let e of g)y(e);for(let t of o.items){let n=e.byId[t.sessionId];n!==void 0&&!n.blank&&M(n,l,i)&&y(n)}return{items:_.slice(0,s).map(t=>{let n=p.get(t.id),r=a.get(t.id),i=I(r?.pendingInteraction?.kind),o=re(t,e);return{id:t.id,title:P(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[f(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:te(e,t.id,a),...i===void 0?{}:{pendingInteraction:i},completed:r?.completionUnread===!0,archived:l.has(t.id),...n===void 0?{}:{snippet:n.snippet}}}),hasMore:o.hasMore||_.length>s}}function V(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function se(e,t){let n=V(e),r,i=-1;for(let e of t){let t=V(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let H=`__flat_session_order__`,ce=`pinned`,le=`workspaces`;function ue(e,t){return e?.[t]??!0}function de(e,t,n){let r=new Map(Object.entries(n.summaries)),i=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(n.members))if(e!==`__flat_session_order__`)for(let n of t)i.set(n,e);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let a=[...n],o=n[0]===void 0?void 0:r.get(n[0]),s=o?.blank&&(o.retainedBy.mainView??0)>0?1:0;for(let n of t[e]??[]){let t=a.indexOf(n);t===-1?!r.has(n)&&(e===`__flat_session_order__`||!i.has(n)||i.get(n)===e)&&a.splice(s++,0,n):s=t+1}return[e,a]}))}function fe(){return(0,r.defineStore)({init:()=>({groupBy:`workspace`,orderBy:`updated`,groupExpansion:{},threadExpansion:{},sectionExpansion:{},sessionOrderByAccount:{},archivedFilter:`default`}),persist:`dsh.workspace.view.v5`,actions:{setGroupBy:(e,t)=>{e.groupBy=t},setOrderBy:(e,t,n,r)=>{t!==e.orderBy&&(e.sessionOrderByAccount=t===`manual`?de(n,e.sessionOrderByAccount,r):{},e.orderBy=t)},setGroupExpanded:(e,t,n)=>{e.groupExpansion[t]=n},setThreadsExpanded:(e,t,n)=>{e.threadExpansion??={};for(let r of t)e.threadExpansion[r]=n},setSectionExpanded:(e,t,n)=>{e.sectionExpansion={...e.sectionExpansion,[t]:n}},retainAccountKeys:(e,t)=>{let n=new Set(t);e.groupExpansion=Object.fromEntries(Object.entries(e.groupExpansion).filter(([e])=>n.has(e))),e.sessionOrderByAccount=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([e])=>n.has(e))),delete e.sessionUpdatedAtByAccount},syncSessionOrders:(e,t,n)=>{e.orderBy===`manual`&&Object.assign(e.sessionOrderByAccount,de(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=de({...r,[t]:n},e.sessionOrderByAccount,i);e.orderBy===`updated`?e.sessionOrderByAccount=a:Object.assign(e.sessionOrderByAccount,a),e.orderBy=`manual`},pinSessionOrder:(e,t,n,r)=>{let i=new Set(n),a=de(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,A(n,e.sessionOrderByAccount[t],r.summaries,r.rowState)])),e.sessionOrderByAccount,r);for(let e of i)a[e]!==void 0&&(a[e]=[t,...a[e].filter(e=>e!==t)]);Object.assign(e.sessionOrderByAccount,a)},setArchivedFilter:(e,t)=>{e.archivedFilter=t}}})}function pe(e,t){let n=R(e,t,/* @__PURE__ */ new Map),r=new Set(B(e,t.archivedSessionIds,t.archivedFilter)),i=/* @__PURE__ */ new Set([...n.map(e=>e.id),...ie(e,t.archivedSessionIds).filter(e=>!r.has(e))]),a=/* @__PURE__ */ new Map,o={...e.byId};for(let e of n){for(let t of e.tree?.descendantIds??[])a.set(f(t),e.id);let t=o[e.id];t!==void 0&&(o[e.id]={...t,updatedAt:e.tree?.updatedAt??e.updatedAt})}return{rootIds:i,rootOf:a,summaries:o}}function me(e,t){let n=new Set(e),r=[],i=/* @__PURE__ */ new Set;for(let a of e){if(t.summaries[a]===void 0||t.rootIds.has(a)){r.push(a);continue}let e=t.rootOf.get(a);e===void 0||n.has(e)||i.has(e)||(i.add(e),r.push(e))}return{memberIds:r,linkedRootIds:i}}function he(e,t,n){let r=pe(t,{...n,archivedFilter:n.archivedFilter??`default`}),i=e=>e.filter(e=>t.byId[e]===void 0||r.rootIds.has(e)),a=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,me(e.sessionIds,r).memberIds]),[``,i([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!a.has(e))],[H,i(ie(t,n.archivedSessionIds))]]),summaries:r.summaries,rowState:n}}function ge(e,t){return[E(e,t),H]}var U=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;active=!1;reconciling=!1;dirty=!1;constructor(e,t){this.sessions=e,this.workspaces=t}start(){this.active=!0;let e=this.sessions.list.subscribe(()=>this.reconcile()),t=this.workspaces.list.subscribe(()=>this.reconcile());return this.reconcile(),()=>{this.active=!1,e(),t();let n=[...this.held.values()];this.held.clear(),this.recent.clear(),this.running.clear(),this.failed.clear();for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.failed.delete(e.sessionId),this.remember(e.sessionId,typeof t==`string`?this.sessions.subagentAddress(e.sessionId)??t:t),this.reconcile())}remember(e,t){this.recent.delete(e),this.recent.set(e,t)}reconcile(){if(this.active&&(this.dirty=!0,!this.reconciling)){this.reconciling=!0;try{for(;this.dirty&&this.active;)this.dirty=!1,this.update()}finally{this.reconciling=!1}}}update(){let e=this.sessions.list.getSnapshot(),t=new Set(e.ids),n=new Set(e.summaryOnlyIds??[]),r=new Set(this.workspaces.list.getSnapshot().archivedSessionIds),i=/* @__PURE__ */ new Set;for(let t of e.ids){let a=e.byId[t];a?.running&&a.origin!==`subagent`&&!r.has(t)&&(!n.has(t)||this.recent.has(t))&&i.add(t)}if(e.phase===`pending`)for(let e of this.running)r.has(e)||i.add(e);else for(let e of this.running)!i.has(e)&&t.has(e)&&!r.has(e)&&this.remember(e,e);this.running=i;for(let[n,i]of this.recent)(r.has(n)||this.sessions.binding(n)?.session.getSnapshot().removed||e.phase===`ready`&&!t.has(n)&&typeof i==`string`)&&this.recent.delete(n);let a=[...this.recent.keys()].filter(e=>!i.has(e));for(let e of a.slice(0,Math.max(0,a.length-8)))this.recent.delete(e);let o=new Map(this.recent);for(let e of i)o.set(e,e);for(let e of this.failed)o.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!o.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of o){if(this.held.has(e)||this.failed.has(e))continue;let n;try{n=this.sessions.retain(t,{source:`backgroundWarm`});let r={reference:n,binding:n.binding};this.held.set(e,r),n.ready.catch(()=>this.fail(e,r))}catch{this.failed.add(e),n?.release()}}}fail(e,t){this.active&&this.held.get(e)===t&&(this.failed.add(e),this.held.delete(e),t.reference.release())}};let _e=`codexhost.web.session-tabs.v2:local`,ve=`codexhost.web.session-tabs.v1:local`,ye=`codexhost.web.recent-visits.v1:local`,be=1048576;function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xe(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?f(e):void 0}function Se(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!W(e)||Object.keys(e).length!==3)return;let n=xe(e.parentSessionId),r=xe(e.childSessionId),i=e.mode;if(!(n===void 0||r!==t||n===r||i!==`one-shot`&&i!==`continuable`&&i!==`unknown`))return{parentSessionId:n,childSessionId:r,mode:i}}function Ce(e,t){if(e===null||e.length>be)return[];try{let n=JSON.parse(e);if(!W(n)||Object.keys(n).length!==2||n.version!==t||!Array.isArray(n.entries))return[];let r=[],i=/* @__PURE__ */ new Set,a=Date.now();for(let e of n.entries){if(!W(e))continue;let n=Object.keys(e);if(t===2&&n.length!==3||n.length!==2&&(n.length!==3||!Object.hasOwn(e,`lastVisitedAt`)))continue;let o=xe(e.sessionId);if(o===void 0||i.has(o))continue;let s=Object.hasOwn(e,`lastVisitedAt`)?e.lastVisitedAt:a;if(typeof s!=`number`||!Number.isSafeInteger(s)||s<0||s>a)continue;let c=Se(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var we=class{onFailure;enabled=typeof window<`u`&&/^https?:$/u.test(window.location.protocol);reported=!1;constructor(e){this.onFailure=e}read(){if(!this.enabled)return[];try{return this.latest()}catch{return this.failed(),[]}}update(e,t){if(this.enabled)try{let n=this.latest().filter(e=>t?.(e)!==!0),r=new Map(n.map((e,t)=>[e.sessionId,t]));for(let i of e){if(t?.(i)===!0)continue;let e=r.get(i.sessionId);e===void 0?(r.set(i.sessionId,n.length),n.push(i)):n[e]=i}let i=JSON.stringify({version:2,entries:n.map(e=>({sessionId:e.sessionId,lastVisitedAt:e.lastVisitedAt,target:typeof e.target==`string`?e.target:{parentSessionId:e.target.parentSessionId,childSessionId:e.target.childSessionId,mode:e.target.mode}}))});if(i.length>be){this.failed();return}localStorage.getItem(_e)!==i&&localStorage.setItem(_e,i),localStorage.removeItem(ve),localStorage.removeItem(ye)}catch{this.failed()}}latest(){let e=localStorage.getItem(_e);return e===null?Ce(localStorage.getItem(ve)??localStorage.getItem(ye),1):Ce(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},G=class{sessions;workspaces;subscribeRemoved;entries=(0,r.createSnapshotStore)([]);records=[];current;awaitingFormalSession=!1;active=!1;headRevision=0;restoring=!1;cache;constructor(e,t,n,r=()=>{}){this.sessions=e,this.workspaces=t,this.subscribeRemoved=n,this.cache=new we(r)}start(e){this.active=!0,this.headRevision=this.sessions.list.getSnapshot().headRefreshRevision??0,this.records=this.cache.read(),this.cache.update([]);let t=this.sessions.list.subscribe(()=>{let t=this.sessions.list.getSnapshot().headRefreshRevision??0;t!==this.headRevision&&(this.headRevision=t,this.restoreSummaries(this.current?.sessionId??e)),this.reconcile()}),n=this.workspaces.list.subscribe(()=>this.reconcile()),r=this.subscribeRemoved?.(e=>{this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`||this.records.some(t=>t.sessionId===e&&typeof t.target!=`string`)||(this.records=this.records.filter(t=>!this.includesIdentity(t,e)),this.cache.update([],t=>this.includesIdentity(t,e)),this.publish())});return this.reconcile(),this.restoreSummaries(e),()=>{this.active=!1,t(),n(),r?.(),this.current=void 0,this.awaitingFormalSession=!1,this.records=[],this.entries.set([])}}visit(e,t){let n=Date.now(),r=this.depart(n);r!==void 0&&this.remember(r),this.current={sessionId:e,target:typeof t==`string`?this.sessions.subagentAddress(e)??t:t,lastVisitedAt:n},this.awaitingFormalSession=!0,this.reconcile(r===void 0?[]:[r])}clearCurrent(){let e=this.depart(Date.now());e!==void 0&&this.remember(e),this.current=void 0,this.awaitingFormalSession=!1,this.reconcile(e===void 0?[]:[e])}depart(e){let t=this.current;return t!==void 0&&this.records.some(e=>e.sessionId===t.sessionId)&&this.formal(t)?{...t,lastVisitedAt:e}:void 0}close(e){this.records=this.records.filter(t=>t.sessionId!==e),this.cache.update([],t=>t.sessionId===e),this.current?.sessionId===e&&(this.awaitingFormalSession=!1),this.publish()}closeAll(){let e=new Set(this.records.map(e=>e.sessionId));this.records=[],this.awaitingFormalSession=!1,this.cache.update([],t=>e.has(t.sessionId)),this.publish()}expireInactive(e,t,n=Date.now()){let r=this.sessions.list.getSnapshot();if(!this.active||!Number.isFinite(e)||e<=0||r.phase!==`ready`||r.loading===!0||r.listError!=null||this.workspaces.list.getSnapshot().phase!==`ready`)return!1;let i=new Set(this.entries.getSnapshot().map(e=>e.sessionId)),a=a=>{let o=r.byId[a.sessionId];if(a.sessionId===this.current?.sessionId||!i.has(a.sessionId)||o===void 0||o.blank||(o.retainedBy.mainView??0)>0||o.running||t.get(a.sessionId)?.pendingInteraction!==void 0||typeof a.target!=`string`&&t.get(a.sessionId)?.running===void 0||!Number.isFinite(o.updatedAt))return!1;let s=L(o,r,t);return s.running||s.runningSubagentCount>0?!1:n-Math.max(a.lastVisitedAt,o.updatedAt)>=e},o=new Set(this.records.filter(a).map(e=>e.sessionId));return o.size!==0&&(this.records=this.records.filter(e=>!o.has(e.sessionId)),this.cache.update([],e=>o.has(e.sessionId)&&a(e)),this.publish(),!0)}remember(e){let t=this.records.findIndex(t=>t.sessionId===e.sessionId);this.records=t===-1?[...this.records,e]:this.records.map((n,r)=>r===t?e:n)}formal(e){let t=this.sessions.list.getSnapshot();return t.byId[e.sessionId]?.blank===!1&&!this.invalid(e,t)}reconcile(e=[]){if(!this.active)return;let t=this.sessions.list.getSnapshot(),n=new Set(this.records.filter(e=>this.invalid(e,t)).map(e=>e.sessionId));this.records=this.records.filter(e=>!n.has(e.sessionId));let r=[...e],i=this.current;this.awaitingFormalSession&&i!==void 0&&this.formal(i)&&(this.awaitingFormalSession=!1,this.remember(i),r.push(i)),this.publish(),(r.length>0||n.size>0)&&this.cache.update(r,e=>n.has(e.sessionId))}publish(){let e=this.sessions.list.getSnapshot(),t=this.workspaces.list.getSnapshot().phase===`ready`,n=this.records.flatMap(n=>{if(!t||e.byId[n.sessionId]?.blank!==!1||this.invalid(n,e))return[];if(typeof n.target==`string`)return[n];let r=this.sessions.subagentAddress(n.sessionId);if(r===void 0||r.parentSessionId!==n.target.parentSessionId||r.childSessionId!==n.sessionId)return[];if(r.mode===n.target.mode)return[n];let i={...n,target:r};return this.records=this.records.map(e=>e===n?i:e),[i]}),r=this.entries.getSnapshot();(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&this.entries.set(n)}restoreSummaries(e=this.current?.sessionId){if(this.restoring)return;let t=this.records.filter(t=>t.sessionId!==e&&this.sessions.list.getSnapshot().byId[t.sessionId]===void 0);if(t.length===0)return;this.restoring=!0;let n=0;Promise.all(Array.from({length:Math.min(4,t.length)},async()=>{for(;this.active;){let e=t[n++];if(e===void 0)return;let r=e.sessionId;if(this.records.some(e=>e.sessionId===r)&&this.sessions.list.getSnapshot().byId[r]===void 0){try{await this.sessions.loadSummary(r)}catch{}this.active&&this.reconcile()}}})).finally(()=>{this.restoring=!1})}includesIdentity(e,t){if(e.sessionId===t)return!0;if(typeof e.target==`string`)return!1;let n=/* @__PURE__ */ new Set,r=e.target.parentSessionId;for(;r!==void 0&&!n.has(r);){if(r===t)return!0;n.add(r),r=this.sessions.subagentAddress(r)?.parentSessionId}return!1}invalid(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=e=>n.includes(e)||this.sessions.binding(e)?.session.getSnapshot().removed===!0;if(r(e.sessionId))return!0;if(typeof e.target==`string`)return!1;let i=/* @__PURE__ */ new Set([e.sessionId]),a=e.target;for(;!i.has(a.parentSessionId);){if(r(a.parentSessionId)||Te(t,a.parentSessionId,a.childSessionId))return!0;i.add(a.parentSessionId);let e=this.sessions.subagentAddress(a.parentSessionId);if(e===void 0)break;a=e}return!1}};function Te(e,t,n){let r=e.projectionsBySession[t];return e.phase===`ready`&&r?.state!==`loading`&&r?.state!==`error`&&r?.values.subagentCatalog!==void 0&&!r.values.subagentCatalog.some(e=>e.id===n)}var Ee=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},De=class extends i.Service{directoryPicker;workspaces;sessions;view;notify;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,r.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;opening=(0,r.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;creating=(0,r.createSnapshotStore)({state:`idle`});retryCreate;creatingLoad;creationToken=0;keepalive;recentVisits;constructor(e,t,n,r,i,a){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.keepalive=new U(r,n);let o=e.get(`remote`);this.recentVisits=new G(r,n,o===void 0?void 0:e=>o.$on(`api-session/removed`,e),()=>a({kind:`recentVisitsStorageFailed`})),e.effect(()=>{let e=this.selection.getSnapshot(),t=this.recentVisits.start(e.subagentAddress?.childSessionId??e.sessionId),n=this.keepalive.start(),r=this.watchNavigation();return()=>{r(),this.lifetime.abort(),n(),t();let e=this.mainReference;this.mainReference=void 0,e?.release()}},`ui-workspace: Workspace navigation policy`)}async connectWorkspace(e){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0)throw Error(`uiWorkspace.connectWorkspace: unknown workspace ${e}`);let n=this.connecting.get(e);if(n!==void 0)return n;let r=this.reuseOrCreateBlank(t).finally(()=>{this.connecting.delete(e)});return this.connecting.set(e,r),r}reuseOrCreateBlank(e){let t=this.workspaces.list.getSnapshot().archivedSessionIds,n=this.sessions.list.getSnapshot();for(let r of n.ids){let i=n.byId[r];if(i!==void 0&&i.blank&&i.cwd===e.path&&e.sessionIds.includes(r)&&!t.includes(r))return this.reuseBlank(e.workspaceId,r)}return this.sessions.create({workspaceId:e.workspaceId})}async reuseBlank(e,t){try{return await this.sessions.create({workspaceId:e,sessionId:t})}catch(t){if(Oe(t)?.rpcError.code!==`session/writer-held`)throw t;return this.sessions.create({workspaceId:e})}}openSession(e){let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.opening.set({state:`idle`}),this.retryOpen=void 0,typeof e!=`string`||this.sessions.list.getSnapshot().byId[e]!==void 0?this.replaceMain(e,t,`reveal`):this.resolveSession(e,t,()=>{this.replaceMain(e,t,`reveal`)},()=>this.openSession(e))}closeSessionTab(e){this.recentVisits.close(e)}closeAllSessionTabs(){this.recentVisits.closeAll()}retryOpening(){this.retryOpen?.()}retryCreating(){this.retryCreate?.()}async resolveSession(e,t,n,r){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let i={stop:()=>t.removeEventListener(`abort`,a)},a=()=>{i.stop(),this.openingLoad===i&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,a,{once:!0}),this.openingLoad=i,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==i||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==i))return;if(this.sessions.list.getSnapshot().byId[e]===void 0)throw Error(`Session not found: ${e}`);n(),a()}catch(n){if(t.aborted||this.openingLoad!==i)return;this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:je(n)})}}async openWorkspace(e,t){if(this.mainReference===void 0){let n=this.creating.getSnapshot(),r=n.state===`idle`?++this.creationToken:n.token,i=n.state===`idle`?void 0:n.initialPrompt;await this.runCreation({workspaceId:e,token:r,...i===void 0?{}:{initialPrompt:i},...t===void 0?{}:{beforeOpen:t}});return}let n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),r;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new ke;r=e===null?await this.sessions.create():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:je(e)}),e}n.aborted||this.replaceMain(r,n,`reveal`,t)}async forkSession(e,t){return this.sessions.fork({sessionId:e,increaseTitle:!0,...t===void 0?{}:{onCreated:t}})}startSession(e,t){let n=t===void 0?void 0:{...t},r=n!==void 0&&(n.prompt!==void 0||n.clearPreviousDraft===!0),i=this.workspaces.list.getSnapshot(),a=this.sessions.list.getSnapshot(),o=this.mainReference?.sessionId,s=o===void 0?void 0:i.items.find(e=>e.sessionIds.includes(o))?.workspaceId,c=i.phase===`ready`&&a.phase===`ready`?Me(i.items,a.byId):void 0,l=e??(i.canStartProjectless?null:s??c);if(l===void 0){if(this.ctx.layout.beginNavigation(),r){this.notify({kind:`createFailed`,message:this.ctx.locale.bind(`workspace`)(`draft.workspaceRequired`)});return}this.clearMain();return}this.ctx.layout.selectPanel(null),this.releaseMainSelection();let u=++this.creationToken;this.runCreation({workspaceId:l,token:u,...n?.prompt===void 0?{}:{initialPrompt:n.prompt},...r?{draftOptions:n}:{}}).catch(e=>{console.warn(`new session failed:`,e)})}async runCreation(e){this.creatingLoad?.stop(),this.creatingLoad=void 0,this.retryCreate=void 0;let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.openingLoad?.stop(),this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0;let n={stop:()=>t.removeEventListener(`abort`,r)},r=()=>{n.stop(),this.creatingLoad===n&&(this.creatingLoad=void 0,this.retryCreate=void 0,this.creating.set({state:`idle`}))};t.addEventListener(`abort`,r,{once:!0}),this.creatingLoad=n,this.creating.set({state:`creating`,workspaceId:e.workspaceId,token:e.token,...e.initialPrompt===void 0?{}:{initialPrompt:e.initialPrompt}});try{if(e.workspaceId===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new ke;let i=e.workspaceId===null?await this.sessions.create():await this.connectWorkspace(e.workspaceId);if(t.aborted||this.creatingLoad!==n)return;this.replaceMain(i,t,`preserve`,t=>{e.beforeOpen?.(t),this.handoffPendingDraft(t,e.draftOptions)}),r()}catch(r){if(t.aborted||this.creatingLoad!==n)return;this.retryCreate=()=>{this.runCreation(e).catch(e=>{console.warn(`new session retry failed:`,e)})};let i=K(r),a=i===`unknown`?Ae(r):void 0;throw this.creating.set({state:`error`,workspaceId:e.workspaceId,reason:i,...a===void 0?{}:{message:a},token:e.token,...e.initialPrompt===void 0?{}:{initialPrompt:e.initialPrompt}}),r}}handoffPendingDraft(e,t){let n=this.sessions.binding(e),r=this.ctx.get(`conversation`);t===void 0?n!==void 0&&r!==void 0&&r.input.adoptPendingDraft(n):((n===void 0||r===void 0)&&this.draftPreparationFailed(),r.input.adoptPendingDraft(n,t)===`blocked`&&this.draftPreparationFailed())}draftPreparationFailed(){let e=this.ctx.locale.bind(`workspace`)(`draft.initializationFailed`);throw this.notify({kind:`createFailed`,message:e}),Error(e)}async archiveSession(e,t={}){await this.workspaces.archiveSession(e,t),this.mainReference?.sessionId===e&&this.clearMain()}async unarchiveSession(e){await this.workspaces.unarchiveSession(e)}async pinSession(e){await this.workspaces.pinSession(e);let{items:t,pinnedSessionIds:n,archivedSessionIds:r}=this.workspaces.list.getSnapshot();this.view.pinSessionOrder(e,ge(t,e),he(t,this.sessions.list.getSnapshot(),{pinnedSessionIds:n,archivedSessionIds:r}))}async unpinSession(e){await this.workspaces.unpinSession(e)}async pickDirectory(){let e=await this.directoryPicker.pick();if(!e.ok)throw Error(`directory picker failed: ${e.error.message}`);return e.value}async listDirectory(e,t){let n=await this.directoryPicker.list(e,t);if(!n.ok)throw new Ee(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new Ee(n.error);return n.value}watchNavigation(){let e=`waiting`,t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);t.addEventListener(`abort`,()=>{e=`done`},{once:!0});let n=()=>{if(this.lifetime.signal.aborted||this.clearArchivedCurrent()||e!==`waiting`)return;let n=this.workspaces.list.getSnapshot(),r=this.sessions.list.getSnapshot();this.mainReference===void 0?n.phase===`ready`&&r.phase===`ready`&&(e=`connecting`,this.restoreSelection(n,r,t).then(()=>{e=`done`},n=>{t.aborted||(e=`waiting`,console.warn(`initial Session restoration failed:`,n))})):e=`done`},r=this.workspaces.list.subscribe(n),i=this.sessions.list.subscribe(n),a=this.selection.getSnapshot();if(a.sessionId!==void 0||a.subagentAddress!==void 0){if(e=`connecting`,a.subagentAddress!==void 0)this.replaceMain(a.subagentAddress,t,`preserve`),e=`done`;else if(a.sessionId!==void 0){let r=a.sessionId,i=()=>{this.resolveSession(r,t,()=>{this.sessions.list.getSnapshot().byId[r]?.blank===!0?(e=`waiting`,n()):(this.replaceMain(r,t,`preserve`),e=`done`)},i)};i()}}return n(),()=>{this.lifetime.abort(),i(),r()}}async restoreSelection(e,t,n){let r=this.selection.getSnapshot();if(r.subagentAddress!==void 0){this.replaceMain(r.subagentAddress,n,`preserve`);return}let i=r.sessionId===void 0?void 0:t.byId[r.sessionId],a=i===void 0?void 0:e.items.find(e=>e.sessionIds.includes(i.id));if(i!==void 0&&(!i.blank||a===void 0)){this.replaceMain(i.id,n,`preserve`);return}let o;if(i!==void 0&&a!==void 0&&i.cwd===a.path&&!e.archivedSessionIds.includes(i.id)&&(o=await this.reuseBlank(a.workspaceId,i.id)),o===void 0&&e.canStartProjectless&&i===void 0){o=await this.sessions.create(),n.aborted||this.replaceMain(o,n,`preserve`);return}let s=a?.workspaceId??Me(e.items,t.byId);if(s===void 0&&e.items.length===0&&t.ids.length===0){let e=await this.initializeDefaultWorkspace(n);if(n.aborted)return;s=e?.workspaceId}o===void 0&&s!==void 0&&(o=await this.connectWorkspace(s)),o!==void 0&&!n.aborted&&this.replaceMain(o,n,`preserve`)}async initializeDefaultWorkspace(e){try{return await this.workspaces.initializeDefault(e)}catch{e.aborted||this.notify({kind:`defaultWorkspaceFailed`});return}}clearArchivedCurrent(){let e=this.mainReference?.sessionId;return e===void 0||!this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?!1:(this.clearMain(),!0)}releaseMainSelection(){let e=this.mainReference;this.mainReference=void 0,this.recentVisits.clearCurrent(),this.selection.set({}),e?.release()}clearMain(){this.releaseMainSelection(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r){t.throwIfAborted();let i=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(i.sessionId),t.aborted){i.release();return}let n=typeof e==`string`?this.sessions.subagentAddress(i.sessionId):e;this.selection.set({sessionId:i.sessionId,...n===void 0?{}:{subagentAddress:n}})}catch(e){throw i.release(),e}let a=this.mainReference;this.mainReference=i,this.keepalive.visit(i,e),this.recentVisits.visit(i.sessionId,e),a?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function Oe(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}var ke=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function K(e){return Oe(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof ke?`workspace-required`:`unknown`}function Ae(e){let t=Oe(e),n=(t===void 0?e instanceof Error?e.message:String(e):t.rpcError.message).trim();return n===``?void 0:n}function je(e){let t=Oe(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function Me(e,t){let n,r=-1/0;for(let i of e){let e=-1/0;for(let n of i.sessionIds){let r=t[n];r!==void 0&&(e=Math.max(e,r.updatedAt))}e===-1/0&&(e=Date.parse(i.createdAt)),(n===void 0||e>r)&&(n=i.workspaceId,r=e)}return n}let Ne=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ne)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ne,e.textContent=`.bYAjiW_button{display:none}[data-phone] .bYAjiW_button{corner-shape:round;width:34px;height:34px;color:var(--dsw-alias-label-primary);cursor:pointer;-webkit-app-region:no-drag;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:9999px;flex:none;justify-content:center;align-items:center;padding:0;transition:transform .14s,background-color .14s;display:inline-flex;position:relative}[data-phone] .bYAjiW_button:after{content:"";position:absolute;inset:-5px -1px}[data-phone] .bYAjiW_icon{width:17px;height:17px}[data-phone] .bYAjiW_button:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);transform:scale(.92)}[data-phone] .bYAjiW_button:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}@media (prefers-reduced-motion:reduce){[data-phone] .bYAjiW_button{transition:none}[data-phone] .bYAjiW_button:active{transform:none}}@media (forced-colors:active){[data-phone] .bYAjiW_button{color:buttontext}[data-phone] .bYAjiW_button:focus-visible{outline-color:highlight}}`,document.head.appendChild(e)}var Pe={button:`bYAjiW_button`,icon:`bYAjiW_icon`};function Fe({startSession:e,useShortcuts:t,t:n}){let r=t(e=>e.find(e=>e.id===`session.new`));return/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:n(`actions.newSession`),shortcutKeys:r?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Pe.button,"aria-label":n(`actions.newSession`),"aria-keyshortcuts":r?.aria,"data-phone-new-session":!0,onClick:()=>{e()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:17,className:Pe.icon})})})}let Ie=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ie)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ie,e.textContent=`._6puhIG_shortcut{isolation:isolate;box-sizing:border-box;width:max-content;min-width:0;max-width:min(164px,100% - 24px);min-height:44px;color:var(--dsw-alias-label-primary);background:0 0;border:0;border-radius:8px;flex:none;align-items:center;padding:0;font-size:13px;font-weight:500;line-height:20px;display:inline-flex;position:relative}._6puhIG_select,._6puhIG_close{border-radius:inherit;min-height:44px;color:inherit;font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;align-items:center;padding:0;display:inline-flex}._6puhIG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}._6puhIG_close{width:28px;color:var(--dsw-alias-label-secondary);flex:0 0 28px;justify-content:center}._6puhIG_close:active{color:var(--dsw-alias-label-primary)}._6puhIG_shortcut:before{content:"";z-index:-1;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l2);border-radius:inherit;background:var(--dsw-alias-bg-module-platform);box-shadow:inset 0 .5px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);pointer-events:none;position:absolute;inset:6px 0}._6puhIG_shortcut[data-active]:before{border-width:1px;border-color:color-mix(in srgb, var(--dsw-alias-label-primary) 34%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary))}._6puhIG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){._6puhIG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}._6puhIG_shortcut[data-active]:before{background:color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary)) 82%, transparent)}._6puhIG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}._6puhIG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}._6puhIG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}._6puhIG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){._6puhIG_shortcut:before,._6puhIG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}._6puhIG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}._6puhIG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){._6puhIG_shortcut{color:buttontext}._6puhIG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}._6puhIG_shortcut[data-active],._6puhIG_shortcut:active{color:highlighttext}._6puhIG_shortcut[data-active]:before,._6puhIG_shortcut:active:before{background:highlight;border-color:highlight}._6puhIG_close,._6puhIG_close:active{color:inherit}._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline-color:highlight}._6puhIG_shortcut[data-active] ._6puhIG_select:focus-visible,._6puhIG_shortcut[data-active] ._6puhIG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var Le={activity:`_6puhIG_activity`,close:`_6puhIG_close`,identity:`_6puhIG_identity`,select:`_6puhIG_select`,shortcut:`_6puhIG_shortcut`,title:`_6puhIG_title`};function Re({visit:e,summary:t,identity:n,activityLabel:r,activity:i,active:c,closeLabel:l,closeHint:u,open:d,close:f,restoreNavigationFocus:p}){let m=(0,s.useRef)(null),h=(0,s.useCallback)(e=>{e===null&&m.current?.contains(document.activeElement)&&p(),m.current=e},[p]);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:h,className:Le.shortcut,"data-active":c||void 0,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Le.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,r].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Le.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Le.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Le.activity,title:r,children:i})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Le.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseOutlineRegular,{size:12})})]})}let ze=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ze)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ze,e.textContent=`.rjHY3q_hostBadge{max-width:96px;color:var(--dsw-alias-label-secondary);flex-shrink:0;align-items:center;gap:6px;font-size:11px;display:inline-flex}.rjHY3q_hostBadge>span:first-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rjHY3q_hostDot{background:#92949a;border-radius:50%;flex-shrink:0;width:7px;height:7px}.rjHY3q_hostBadge[data-state=connected] .rjHY3q_hostDot{background:#16a34a}.rjHY3q_hostBadge[data-state=connecting] .rjHY3q_hostDot{background:#d97706}.rjHY3q_projectRow,.rjHY3q_sessionRow{--dsh-row-surface:var(--dsw-specific-sidebar-fill);border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex;position:relative}.rjHY3q_projectRow:is(:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen),.rjHY3q_sessionRow:is(:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected:is(:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}@media (hover:hover){.rjHY3q_projectRow:hover,.rjHY3q_sessionRow:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}}.rjHY3q_sessionRow,.rjHY3q_searchResultRow{--ch-sidebar-text-primary:#1a1c1f;letter-spacing:normal;color:color-mix(in oklab, var(--ch-sidebar-text-primary) 85%, transparent);font-family:-apple-system,"system-ui",Segoe UI,sans-serif;font-size:14px;font-weight:430;line-height:20px}body[data-ds-dark-theme] .rjHY3q_sessionRow,body[data-ds-dark-theme] .rjHY3q_searchResultRow{--ch-sidebar-text-primary:#fff}.rjHY3q_projectRow:focus-visible,.rjHY3q_sessionRow:focus-visible,.rjHY3q_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.rjHY3q_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;background:0 0;border:none;flex-direction:column;align-items:stretch;width:100%;min-height:48px;padding:4px 8px;display:flex}.rjHY3q_searchResultRow:hover,.rjHY3q_searchResultRow.rjHY3q_selected{background:var(--dsw-alias-interactive-bg-hover)}.rjHY3q_searchResultHeading{align-items:center;min-width:0;display:flex}.rjHY3q_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.rjHY3q_searchResultWorkspace,.rjHY3q_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.rjHY3q_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.rjHY3q_searchResultWorkspace:only-child{max-width:100%}.rjHY3q_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.rjHY3q_projectRow{box-sizing:border-box;align-items:center;height:34px}.rjHY3q_sessionRow{box-sizing:border-box;min-width:0;max-width:100%;flex-direction:column;align-items:stretch;gap:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-indent,0px))}.rjHY3q_sessionMain{min-width:0;height:var(--dsh-thread-row-height);flex:none;align-items:center;display:flex;position:relative}.rjHY3q_identityButton{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:4px;padding:0}.rjHY3q_identityButton:after{content:"";position:absolute;inset:-6px -4px -6px -8px}@media (hover:none),(pointer:coarse){.rjHY3q_sessionRow:not(:has(>[data-thread-summary])) .rjHY3q_identityButton:after{inset:-12px -6px -12px -8px}}.rjHY3q_foldChevron{justify-content:center;align-items:center;display:none;position:absolute;inset:0}.rjHY3q_foldChevron:before{content:"";border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transform:translate(-1px)rotate(-45deg)}.rjHY3q_identityButton[aria-expanded=true] .rjHY3q_foldChevron:before{transform:translateY(-1px)rotate(45deg)}.rjHY3q_identityButton[aria-expanded=true]>:not(.rjHY3q_foldChevron){visibility:hidden}.rjHY3q_identityButton[aria-expanded=true] .rjHY3q_foldChevron{color:var(--dsw-alias-label-secondary,currentColor);display:flex}@media (hover:hover) and (pointer:fine){.rjHY3q_identityButton:hover>:not(.rjHY3q_foldChevron),.rjHY3q_identityButton:focus-visible>:not(.rjHY3q_foldChevron){visibility:hidden}.rjHY3q_identityButton:hover .rjHY3q_foldChevron,.rjHY3q_identityButton:focus-visible .rjHY3q_foldChevron{color:var(--dsw-alias-text-secondary,currentColor);display:flex}}.rjHY3q_identityButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.rjHY3q_sessionRow .rjHY3q_title{margin:0 6px 0 4px}.rjHY3q_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.rjHY3q_slot:has([data-harness-id]){width:14px;color:inherit}.rjHY3q_sessionRow:has([data-harness-id]) .rjHY3q_title,.rjHY3q_searchResultHeading:has([data-harness-id]) .rjHY3q_searchResultTitle{margin-left:8px}.rjHY3q_statusOverlay{display:contents}.rjHY3q_slot:has([data-harness-id]) .rjHY3q_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}.rjHY3q_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.rjHY3q_projectRow>.rjHY3q_slot:not(.rjHY3q_folderExpanded){color:inherit}.rjHY3q_folderExpanded{color:var(--dsw-alias-state-business-primary)}.rjHY3q_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.rjHY3q_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.rjHY3q_sessionRow .rjHY3q_title{flex:1}.rjHY3q_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.rjHY3q_trailing{flex:none;place-items:center end;display:grid}.rjHY3q_trailing:empty{display:none}.rjHY3q_trailing>*{grid-area:1/1}.rjHY3q_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.rjHY3q_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}.rjHY3q_timeStatus [data-state=done]{color:var(--dsw-alias-state-business-primary)}.rjHY3q_timeStatus .rjHY3q_visuallyHidden{visibility:visible}.rjHY3q_sessionRow.rjHY3q_archived .rjHY3q_title,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultTitle,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultWorkspace,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultSnippet{color:var(--dsw-alias-label-caption)}.rjHY3q_dot{flex:none}.rjHY3q_quickActions{align-items:center;gap:2px;display:inline-flex}.rjHY3q_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) .rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_searchResultHeading .rjHY3q_rowActions{margin-left:auto}@media (hover:hover) and (pointer:fine){.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_time{visibility:hidden}.rjHY3q_projectRow>.rjHY3q_rowActions,.rjHY3q_sessionRow .rjHY3q_rowActions{inset-inline-end:0;z-index:1;background:var(--dsh-row-surface);border-radius:var(--dsw-radius-sm);position:absolute;top:50%;transform:translateY(-50%)}.rjHY3q_projectRow>.rjHY3q_rowActions{inset-inline-end:8px}.rjHY3q_projectRow>.rjHY3q_rowActions:before,.rjHY3q_sessionRow .rjHY3q_rowActions:before{content:"";background:linear-gradient(to right, transparent, var(--dsh-row-surface));pointer-events:none;width:12px;position:absolute;inset-block:0;inset-inline-end:100%}}[data-phone-drawer] .rjHY3q_sessionRow{min-height:44px}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]){grid-template-columns:var(--dsh-thread-icon-size,16px) minmax(0, 1fr) auto;grid-template-rows:24px 24px;column-gap:8px;padding-block:2px;display:grid}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_sessionMain{display:contents;position:static}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_slot{grid-area:1/1;align-self:center}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_title{grid-area:1/2;align-self:center;margin:0}[data-phone-drawer] .rjHY3q_sessionRow:has(>[data-thread-summary]) .rjHY3q_trailing{grid-area:1/3/span 2;align-self:center}[data-phone-drawer] .rjHY3q_sessionRow>[data-thread-summary]{text-overflow:ellipsis;white-space:nowrap;grid-area:2/2;width:100%;margin:0;padding-inline:0;overflow:hidden}.rjHY3q_phoneDetails{padding:8px 8px 16px}.rjHY3q_phoneDetails .rjHY3q_hoverTitle{display:none}.rjHY3q_phoneDetails :is(.rjHY3q_hoverTitle,.rjHY3q_hoverTime,.rjHY3q_hoverStatus,.rjHY3q_hoverPath){color:inherit}.rjHY3q_sessionRow.rjHY3q_dropBefore,.rjHY3q_sessionRow.rjHY3q_dropAfter{position:relative}.rjHY3q_sessionRow.rjHY3q_dropBefore:before,.rjHY3q_sessionRow.rjHY3q_dropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.rjHY3q_sessionRow.rjHY3q_dropBefore:before{top:-7px}.rjHY3q_sessionRow.rjHY3q_dropAfter:after{bottom:-7px}.rjHY3q_hoverContent{flex-direction:column;gap:8px;display:flex}.rjHY3q_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.rjHY3q_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.rjHY3q_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.rjHY3q_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.rjHY3q_hoverArchived svg{flex-shrink:0;margin:0 -4px}.rjHY3q_iconButton{cursor:pointer;-webkit-tap-highlight-color:transparent;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}@media (hover:hover){.rjHY3q_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):is(:active,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] .rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] .rjHY3q_rowActions,[data-phone-drawer] .rjHY3q_rowActions:before{background:0 0}body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow){--dsh-row-surface:transparent}body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):is(:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] .rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}body[data-codexhost-wallpaper] .rjHY3q_sessionRow.rjHY3q_selected:is(:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}@media (hover:hover){body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] .rjHY3q_sessionRow.rjHY3q_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}}@media (hover:hover) and (pointer:fine){body[data-codexhost-wallpaper] :is(.rjHY3q_projectRow>.rjHY3q_rowActions,.rjHY3q_sessionRow .rjHY3q_rowActions){background:color-mix(in srgb, var(--dsw-specific-sidebar-fill) 82%, transparent);backdrop-filter:blur(10px)}body[data-codexhost-wallpaper] :is(){display:none}}[data-phone-drawer] .rjHY3q_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] .rjHY3q_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.rjHY3q_projectRow,.rjHY3q_sessionRow{min-height:44px}.rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_sessionRow .rjHY3q_quickActions{display:none}.rjHY3q_sessionRow .rjHY3q_trailing{align-items:center;gap:4px;display:flex}.rjHY3q_sessionRow .rjHY3q_time:not(.rjHY3q_timeStatus){display:none}.rjHY3q_sessionRow .rjHY3q_timeStatus{visibility:visible;padding-inline-end:0}.rjHY3q_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var q={archived:`rjHY3q_archived`,dot:`rjHY3q_dot`,dropAfter:`rjHY3q_dropAfter`,dropBefore:`rjHY3q_dropBefore`,foldChevron:`rjHY3q_foldChevron`,folderExpanded:`rjHY3q_folderExpanded`,hostBadge:`rjHY3q_hostBadge`,hostDot:`rjHY3q_hostDot`,hoverArchived:`rjHY3q_hoverArchived`,hoverContent:`rjHY3q_hoverContent`,hoverPath:`rjHY3q_hoverPath`,hoverStatus:`rjHY3q_hoverStatus`,hoverTime:`rjHY3q_hoverTime`,hoverTitle:`rjHY3q_hoverTitle`,iconButton:`rjHY3q_iconButton`,identityButton:`rjHY3q_identityButton`,menuOpen:`rjHY3q_menuOpen`,meta:`rjHY3q_meta`,phoneDetails:`rjHY3q_phoneDetails`,projectRow:`rjHY3q_projectRow`,projectText:`rjHY3q_projectText`,quickActions:`rjHY3q_quickActions`,renameInput:`rjHY3q_renameInput`,rowActions:`rjHY3q_rowActions`,searchResultHeading:`rjHY3q_searchResultHeading`,searchResultMeta:`rjHY3q_searchResultMeta`,searchResultRow:`rjHY3q_searchResultRow`,searchResultSnippet:`rjHY3q_searchResultSnippet`,searchResultTitle:`rjHY3q_searchResultTitle`,searchResultWorkspace:`rjHY3q_searchResultWorkspace`,selected:`rjHY3q_selected`,sessionMain:`rjHY3q_sessionMain`,sessionRow:`rjHY3q_sessionRow`,slot:`rjHY3q_slot`,statusOverlay:`rjHY3q_statusOverlay`,time:`rjHY3q_time`,timeStatus:`rjHY3q_timeStatus`,title:`rjHY3q_title`,trailing:`rjHY3q_trailing`,visuallyHidden:`rjHY3q_visuallyHidden`};function Be(e,t){let n=e.runningSubagentCount===0?void 0:{state:`ongoing`,label:t(e.runningSubagentCount===1?`status.subagentsRunning.one`:`status.subagentsRunning.other`,{n:e.runningSubagentCount})},r;switch(e.pendingInteraction){case`approval`:r={state:`warning`,label:t(`status.waitingApproval`),trailingLabel:t(`status.compact.approval`)};break;case`plan-review`:r={state:`warning`,label:t(`status.planReview`),trailingLabel:t(`status.compact.planReview`)};break;case`question`:r={state:`warning`,label:t(`status.waitingAnswer`),trailingLabel:t(`status.compact.answer`)};break;case void 0:break;default:return Ve(e.pendingInteraction)}if(r!==void 0)return n===void 0?[r]:[r,n];if(e.running){let e={state:`ongoing`,label:t(`status.running`)};return n===void 0?[e]:[e,n]}return n===void 0?e.completed?[{state:`done`,label:t(`status.completed`)}]:[{state:`idle`,label:t(`status.idle`)}]:[n]}function Ve(e){throw Error(`unknown pending interaction: ${String(e)}`)}function He({statuses:e}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.visuallyHidden,children:e.label},e.label))]})}let Ue=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ue)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ue,e.textContent=`.F2-n5a_trigger,.F2-n5a_shortcuts{display:none}[data-phone] .F2-n5a_trigger{width:auto;height:auto;color:var(--dsw-alias-label-secondary);cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-app-region:no-drag;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[data-phone] .F2-n5a_trigger:after{content:"";position:absolute;inset:-12px -10px}[data-phone] .F2-n5a_trigger>svg{transition:transform .18s;display:block}.F2-n5a_trigger[aria-disabled=true]{cursor:wait}.F2-n5a_trigger:focus-visible{outline:none}.F2-n5a_expanded{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){[data-phone] .F2-n5a_trigger>svg{transition:none}}[data-phone] .F2-n5a_shortcuts{overflow-anchor:none;scroll-behavior:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none;-webkit-app-region:no-drag;grid-column:1/-1;gap:6px;min-width:0;min-height:44px;margin-inline:-12px -20px;padding-inline-end:16px;scroll-padding-inline:8px 20px;display:flex;overflow-x:auto}.F2-n5a_clear{min-width:44px;min-height:44px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:8px;flex:none;align-self:center;padding:0 6px;font-size:12px}.F2-n5a_clear:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.F2-n5a_clear:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.F2-n5a_clear:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.F2-n5a_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var We={clear:`F2-n5a_clear`,expanded:`F2-n5a_expanded`,shortcuts:`F2-n5a_shortcuts`,trigger:`F2-n5a_trigger`};function Ge({useVisits:e,useSessions:t,useWorkspaces:n,useSessionStatus:r,t:i}){let a=e(e=>e),o=t(e=>e),s=n(e=>e.archivedSessionIds),c=r(e=>e);return a.flatMap(e=>{let t=o.byId[e.sessionId];return t===void 0||t.blank||s.includes(e.sessionId)?[]:[{visit:e,summary:t,statuses:Be(L(t,o,c),i)}]})}function Ke(e){let{useRecentNavigationSettings:t,open:n,close:r,closeAll:i,viewport:c,restoreNavigationFocus:l,renderSlot:u,t:d}=e,f=t(e=>e.value?.showRecentVisits??!0),p=Ge(e),m=f&&p.length>0,h=(0,s.useRef)(null),[g,_]=(0,s.useState)(!1),v=(0,s.useCallback)((e=h.current)=>{e?.isConnected&&e.clientWidth>0&&(c.scrollLeft=Math.max(0,Math.min(e.scrollLeft,e.scrollWidth-e.clientWidth)))},[c]);return(0,s.useLayoutEffect)(()=>{let e=h.current;if(e===null)return;e.scrollLeft=c.scrollLeft;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,e.scrollLeft=c.scrollLeft)});return n.observe(e),()=>{v(e),n.disconnect()}},[m,c,v]),m?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`nav`,{ref:h,className:We.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,o.jsx)(Re,{visit:t,summary:i,identity:u(`workspace.recent.shortcut.identity`,{sessionId:t.sessionId}),activityLabel:a[0].state===`idle`?void 0:a.map(e=>e.label).join(` · `),activity:a[0].state===`idle`?null:/* @__PURE__ */ (0,o.jsx)(He,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:d(`recent.close`,{name:i.displayTitle}),closeHint:d(`recent.closeHint`),open:e=>{v(),n(e)},close:e=>{v();try{r(e)}catch{_(!0)}},restoreNavigationFocus:l},t.sessionId)),p.length>=3&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:We.clear,"aria-label":d(`recent.clearAll`),title:d(`recent.clearAllHint`),onMouseDown:e=>e.preventDefault(),onClick:()=>{l();try{i()}catch{_(!0)}},children:d(`recent.clear`)})]}),g&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:d(`recent.closeFailed`),onDone:()=>_(!1)})]}):null}function qe(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=Ge(e),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(!1),p=(0,s.useRef)(!1);return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[c.length>0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,"data-navigation-focus-return":!0,className:We.trigger,"aria-label":r(i?`recent.collapse`:`recent.expand`),"aria-expanded":i,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!i).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:14,className:i?We.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function Je(e){return e==null}function Ye(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Xe(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function Ze(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Qe(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let $e=Symbol.for(`cosmokit.volatile.write`);function et(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>et(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,et(n,t)])))}finally{t.delete(e)}}function tt(e){let t=et(e);return Object.freeze({get:()=>t,[$e]:e=>{t=e}})}function nt(e){return typeof e==`object`&&!!e&&$e in e}function rt(e,t){return arguments.length===1?t=>rt(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function it(e){return rt(`ArrayBuffer`,e)||rt(`SharedArrayBuffer`,e)}function at(e){return it(e)||ArrayBuffer.isView(e)}let ot;(function(e){e.is=it,e.isSource=at;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(ot||={}),ot.fromBase64,ot.toBase64,ot.fromHex,ot.toHex;function st(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(rt(`Date`,e))return new Date(e.valueOf());if(rt(`RegExp`,e))return new RegExp(e.source,e.flags);if(it(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(st,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(st,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function ct(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(nt(e)||nt(t))return nt(e)&&nt(t);if(!n&&Je(e)&&Je(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(rt(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(rt(`URL`),(e,t)=>e.href===t.href)??a(rt(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(it,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let lt;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(lt||={});let ut=Symbol.for(`schemastery`),dt=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var J=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[dt]}};Object.defineProperty(J.prototype,dt,{value:!0});let Y=function(e){let t=function(e,n={}){return Y.resolve(e,t,n)[0]};if(e.refs){let t=Ze(e.refs,e=>new Y(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&Ze(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,Y.prototype),t.meta||={},t.toString=t.toString.bind(t),t};Y.prototype=Object.create(Function.prototype),Y.prototype[ut]=!0,Object.defineProperty(Y.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:Y.resolve(e,this,{})[0]}}catch(e){if(J.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),Y.ValidationError=J,Y.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},Y.prototype.set=function(e,t){return this.dict[e]=t,this},Y.prototype.push=function(e){return this.list.push(e),this};function ft(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function pt(e){return e?.$value??e?.$inner}function mt(e){return Xe(e??{},e=>!e.startsWith(`$`))}Y.prototype.i18n=function(e){let t=Y(this),n=ft(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=Ze(t.dict,(t,n)=>t.i18n(Ze(e,e=>pt(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(Ze(e,(e={})=>Array.isArray(pt(e))?pt(e)[n]:Array.isArray(e)?e[n]:mt(e)))),t.inner&&=t.inner.i18n(Ze(e,e=>pt(e)?pt(e):mt(e))),t.sKey&&=t.sKey.i18n(Ze(e,e=>e?.$key)),t},Y.prototype.extra=function(e,t){let n=Y(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(Y.prototype,{[e](t=!0){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.deprecated=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},Y.prototype.experimental=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},Y.prototype.pattern=function(e){let t=Y(this),n=Qe(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},Y.prototype.simplify=function(e){if(nt(e)&&(e=e.get()),ct(e,this.meta.default,this.type===`dict`))return null;if(Je(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!Je(r))&&(t[n]=r)}return ct(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return Y.resolve(e,t,{}),t.simplify(e)}catch{}return e},Y.prototype.toString=function(e){return Ct[this.type]?.(this,e)??`Schema<${this.type}>`},Y.prototype.role=function(e,t){let n=Y(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(Y.prototype,{[e](t){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let ht={},gt=Symbol(`checked-volatile-schema`);function _t(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new J(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))_t(i,[...t,n],a,r);if(e.sKey&&_t(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[ut])&&_t(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)_t(e.list[n],[...t,String(n)],!0,r)}Y.extend=function(e,t){ht[e]=t},Y.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[gt]||(_t(t,n.path),n={...n,[gt]:!0}),t.meta?.volatile){let i=Y(t);i.meta={...t.meta,volatile:!1};let[a,o]=Y.resolve(e,i,n,r);try{return[tt(a),o]}catch(e){throw new J(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(Je(e)&&t.type!==`lazy`){if(t.meta.required)throw new J(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&Je(i);)r=r.list[0],i=r?.meta.default;if(Je(i))return[e];e=st(i)}let i=ht[t.type];if(!i)throw new J(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},Y.from=function(e){if(Je(e))return Y.any();if([`string`,`number`,`boolean`].includes(typeof e))return Y.const(e).required();if(e[ut])return e;if(typeof e==`function`)switch(e){case String:return Y.string().required();case Number:return Y.number().required();case Boolean:return Y.boolean().required();case Function:return Y.function().required();default:return Y.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},Y.lazy=function(e){let t=new Y({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[ut]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},Y.natural=function(){return Y.number().step(1).min(0)},Y.percent=function(){return Y.number().step(.01).min(0).max(1).role(`slider`)},Y.date=function(){return Y.union([Y.is(Date),Y.transform(Y.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new J(`invalid date "${e}"`,t);return n},!0)])},Y.regExp=function(e=``){return Y.union([Y.is(RegExp),Y.transform(Y.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new J(e.message,n)}},!0)])},Y.arrayBuffer=function(e){return Y.union([Y.is(ArrayBuffer),Y.is(SharedArrayBuffer),Y.transform(Y.any(),(e,t)=>{if(ot.isSource(e))return ot.fromSource(e);throw new J(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[Y.transform(Y.string(),(t,n)=>{try{return e===`base64`?ot.fromBase64(t):ot.fromHex(t)}catch(e){throw new J(e.message,n)}},!0)]:[]])},Y.extend(`lazy`,(e,t,n,r)=>(t.inner[ut]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},_t(t.inner,n.path,!0)),Y.resolve(e,t.inner,n,r))),Y.extend(`any`,e=>[e]),Y.extend(`never`,(e,t,n)=>{throw new J(`expected nullable but got ${e}`,n)}),Y.extend(`const`,(e,{value:t},n)=>{if(ct(e,t))return[t];throw new J(`expected ${t} but got ${e}`,n)});function vt(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new J(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new J(`expected ${n} >= ${o} but got ${e}`,r)}Y.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new J(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new J(`expect string to match regexp ${r}`,n)}return vt(e.length,t,`string length`,n),[e]});function yt(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function bt(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(yt(e,i)-yt(t,i))%yt(n,i)===0}Y.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new J(`expected number but got ${e}`,n);vt(e,t,`number`,n);let{step:r}=t;if(r&&!bt(e,t.min??0,r))throw new J(`expected number multiple of ${r} but got ${e}`,n);return[e]}),Y.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new J(`expected boolean but got ${e}`,n)}),Y.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new J(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new J(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),Y.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new J(`expected function but got ${e}`,n)}),Y.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new J(`expected ${t.name} but got ${e}`,n)}{if(Je(e))throw new J(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new J(`expected ${t} but got ${e}`,n)}});function xt(e,t,n,r){try{let[i,a]=Y.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?tt(n.meta.default):n.meta.default}}Y.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new J(`expected array but got ${e}`,r);return vt(e.length,n,`array length`,r,!Je(t.meta.default)),[e.map((n,i)=>xt(e,i,t,r))]}),Y.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!Ye(e))throw new J(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=Y.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=xt(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),Y.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new J(`expected array but got ${e}`,n);let i=t.map((t,r)=>xt(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function St(e,t){for(let n in t)n in e||(e[n]=t[n])}Y.extend(`object`,(e,{dict:t},n,r)=>{if(!Ye(e))throw new J(`expected object but got ${e}`,n);let i={};for(let r in t){let a=xt(e,r,t[r],n);(!Je(a)||r in e)&&(i[r]=a)}return r||St(i,e),[i]}),Y.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return Y.resolve(e,n,r,i)}catch(e){a.push(e)}throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),Y.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=Y.resolve(e,i,r,!0)[0];if(!Je(t)){if(Je(a))a=t;else if(typeof a!=typeof t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)St(a??={},t);else if(a!==t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&Ye(e)&&St(a,e),[a]}),Y.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=Y.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let Ct={};function X(e,t,n){Ct[e]=n,Object.assign(Y,{[e](...n){let r=new Y({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??Y.string();break;case`inner`:r.inner=Y.from(n[t]);break;case`list`:r.list=n[t].map(Y.from);break;case`dict`:r.dict=Ze(n[t],Y.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}X(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),X(`any`,[],()=>`any`),X(`never`,[],()=>`never`),X(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),X(`string`,[],()=>`string`),X(`number`,[],()=>`number`),X(`boolean`,[],()=>`boolean`),X(`bitset`,[`bits`],()=>`bitset`),X(`function`,[],()=>`function`),X(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),X(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),X(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),X(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),X(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),X(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),X(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let wt=[0,15,30,60,120,240,1440],Tt={showRecentVisits:!0,tabIdleTimeoutMinutes:60},Et={showRecentVisits:Y.boolean().default(!0),tabIdleTimeoutMinutes:Y.natural().max(1440).default(60)},Dt=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Dt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Dt,e.textContent=`.s99QdG_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}.s99QdG_text{flex:160px;min-width:0}.s99QdG_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}.s99QdG_menu{flex:none;margin-inline-start:auto}.s99QdG_selector{background:var(--dsw-alias-bg-module-platform);min-width:96px;min-height:44px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:0;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:0 12px;font-size:14px;line-height:20px;display:inline-flex}.s99QdG_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}.s99QdG_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){.s99QdG_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}.s99QdG_error{padding-bottom:12px;font-size:12px;line-height:18px}.s99QdG_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.s99QdG_title{font-size:14px;line-height:20px}.s99QdG_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Ot={description:`s99QdG_description`,error:`s99QdG_error`,menu:`s99QdG_menu`,row:`s99QdG_row`,selector:`s99QdG_selector`,text:`s99QdG_text`,timeoutRow:`s99QdG_timeoutRow`,title:`s99QdG_title`,titleLine:`s99QdG_titleLine`};function kt({usePreference:e,setEnabled:t,setIdleTimeout:n,t:r}){let i=e(e=>e.value),c=i?.showRecentVisits??!0,l=i?.tabIdleTimeoutMinutes??60,[u,d]=(0,s.useState)(!1),[f,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),g=(0,s.useRef)(!1),_=(0,s.useId)();(0,s.useEffect)(()=>{c||d(!1)},[c]);let v=e=>e===0?r(`recent.timeout.off`):e>=120&&e%60==0?r(`recent.timeout.hours`,{n:e/60}):r(`recent.timeout.minutes`,{n:e}),y=e=>{g.current||(g.current=!0,d(!1),p(!0),h(!1),Promise.resolve().then(e).then(e=>h(!e)).catch(()=>h(!0)).finally(()=>{g.current=!1,p(!1)}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Ot.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Ot.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Ot.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Ot.title,children:r(`recent.settings.title`)}),/* @__PURE__ */ (0,o.jsx)(a.Tag,{tone:`neutral`,children:r(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Ot.description,children:r(`recent.settings.description`)})]}),/* @__PURE__ */ (0,o.jsx)(a.Switch,{checked:c,disabled:f,label:`${r(`recent.settings.title`)} · ${r(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${Ot.row} ${Ot.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Ot.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:Ot.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(a.Menu,{className:Ot.menu,open:u&&c&&!f,onClose:()=>d(!1),items:wt.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=wt.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Ot.selector,disabled:!c||f,"aria-labelledby":`${_}-label ${_}-value`,"aria-haspopup":`menu`,"aria-expanded":u&&c&&!f,onClick:()=>d(e=>!e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{id:`${_}-value`,children:v(l)}),/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Ot.error,role:`alert`,children:r(`recent.settings.error`)})]})}function At(e,t,n){let r=e=>n.set(`showRecentVisits`,e),i=e=>n.set(`tabIdleTimeoutMinutes`,e),a={scrollLeft:0};e.inject([`uiSession`,`connection`],e=>{e.effect(()=>{let r,i=()=>{let r=n.getSnapshot().value;r!==void 0&&document.visibilityState===`visible`&&e.connection.state.getSnapshot()===`connected`&&r.showRecentVisits&&r.tabIdleTimeoutMinutes!==0&&t.opening.getSnapshot().state!==`loading`&&t.recentVisits.expireInactive(r.tabIdleTimeoutMinutes*6e4,e.uiSession.sessionStatus.getSnapshot())&&t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},o=()=>{r!==void 0&&clearInterval(r),r=void 0;let e=n.getSnapshot().value;document.visibilityState===`visible`&&e?.showRecentVisits&&e.tabIdleTimeoutMinutes>0&&(r=setInterval(i,6e4))},s=n.subscribe(o);return document.addEventListener(`visibilitychange`,o),o(),()=>{s(),r!==void 0&&clearInterval(r),document.removeEventListener(`visibilitychange`,o)}},`ui-workspace: idle session tabs`)});let o=()=>({hooks:{visits:t.recentVisits.entries,recentNavigationSettings:n},open:e=>t.openSession(e),close:e=>{t.closeSessionTab(e),t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},closeAll:()=>{t.closeAllSessionTabs(),a.scrollLeft=0},viewport:a,setEnabled:r});e.slots.inject(`conversation.header.trailing`,()=>e.slots.register({name:`conversation.header.trailing`,locale:`workspace`,inject:()=>({startSession:()=>t.startSession(),hooks:{shortcuts:e.shortcuts.catalog}})},Fe)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},qe)),e.slots.inject(`conversation.header.shortcuts`,()=>e.slots.register({name:`conversation.header.shortcuts`,locale:`workspace`,inject:o,children:{"workspace.recent.shortcut.identity":{kind:`list`,scope:`root`}}},Ke)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.recent-navigation`,order:12,locale:`workspace`,inject:()=>({hooks:{preference:n},setEnabled:r,setIdleTimeout:i})},kt))}let jt=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(jt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=jt,e.textContent=`.mbWf4a_options{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;align-items:flex-start;gap:8px;padding-block:6px;display:flex}.mbWf4a_settingsText{flex:240px}.mbWf4a_prompt{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;border-radius:8px;min-width:0;margin:6px 2px 8px;padding:8px;font-size:12px;line-height:16px}.mbWf4a_promptHeading{justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;display:flex}.mbWf4a_promptHeading strong{font-weight:500}.mbWf4a_comparison{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.mbWf4a_choice{appearance:none;min-width:0;color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:0;border-radius:5px 0 0 5px;flex-direction:column;justify-content:flex-start;align-items:stretch;padding:8px 0 4px;display:flex;position:relative}.mbWf4a_choice+.mbWf4a_choice{border-inline-start:1px solid var(--dsw-alias-border-l2);border-radius:0 5px 5px 0}.mbWf4a_choice[aria-checked=true]{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.mbWf4a_choiceTitle{padding:0 8px 2px;font-size:12px;font-weight:500;display:block}.mbWf4a_choiceSubtitle{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-secondary);padding:0 8px 6px;font-size:10px;line-height:16px;overflow:hidden}.mbWf4a_preview{pointer-events:none;user-select:none;grid-auto-rows:44px;min-width:0;display:grid;overflow:hidden}.mbWf4a_preview .mbWf4a_sampleRow{--dsh-thread-row-height:22px;--dsh-workspace-indent:0px;--dsh-thread-indent:0px;min-height:0;padding-inline:6px}.mbWf4a_preview [data-session-title]{margin-inline:7px 0;font-size:11px}.mbWf4a_preview .mbWf4a_sampleSummary{margin-block-end:0;padding:0 0 0 7px;font-size:9px;line-height:11px}.mbWf4a_sampleIcon{flex-shrink:0;width:14px;height:14px;display:inline-flex}.mbWf4a_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 8px;font-size:11px;line-height:1.5}.mbWf4a_later{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;flex-shrink:0;padding:4px}.mbWf4a_choice:focus-visible,.mbWf4a_later:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.mbWf4a_error{color:var(--dsw-alias-state-warn-primary);overflow-wrap:anywhere;flex-basis:100%;margin-top:6px;font-size:12px}@media (width<=639px){.mbWf4a_choiceTitle,.mbWf4a_choiceSubtitle{padding-inline:6px}.mbWf4a_preview [data-session-title]{font-size:10px}}@media (hover:none),(pointer:coarse){.mbWf4a_later{min-height:44px}}`,document.head.appendChild(e)}var Z={choice:`mbWf4a_choice`,choiceSubtitle:`mbWf4a_choiceSubtitle`,choiceTitle:`mbWf4a_choiceTitle`,comparison:`mbWf4a_comparison`,error:`mbWf4a_error`,hint:`mbWf4a_hint`,later:`mbWf4a_later`,options:`mbWf4a_options`,preview:`mbWf4a_preview`,prompt:`mbWf4a_prompt`,promptHeading:`mbWf4a_promptHeading`,sampleIcon:`mbWf4a_sampleIcon`,sampleRow:`mbWf4a_sampleRow`,sampleSummary:`mbWf4a_sampleSummary`,settingsText:`mbWf4a_settingsText`};let Mt=[`summary`,`ring`];function Nt(e){let[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(!1),a=(0,s.useRef)(!1);return{busy:t,failed:r,save:async t=>{if(a.current)return!1;a.current=!0,n(!0),i(!1);try{let n=await e(t);return i(!n),n}catch{return i(!0),!1}finally{a.current=!1,n(!1)}}}}function Pt({style:e,setStyle:t,t:n,settings:r=!1}){let i=(0,s.useId)(),{busy:c,failed:l,save:u}=Nt(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:r?a.preferenceRowStyles.row:Z.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${a.preferenceRowStyles.rowText} ${r?Z.settingsText:``}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.title,id:i,children:n(`threadTree.style.title`)}),r&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.description,id:`${i}-description`,children:n(`threadTree.style.description`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.choices,role:`radiogroup`,"aria-labelledby":i,"aria-describedby":r?`${i}-description`:void 0,"aria-busy":c,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=[...e.currentTarget.querySelectorAll(`[role="radio"]`)],n=t.indexOf(e.target),r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:1)+t.length)%t.length;t[r]?.focus(),t[r]?.click()},children:Mt.map(t=>/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`radio`,className:a.preferenceRowStyles.choice,"aria-checked":e===t,"aria-disabled":c,tabIndex:e===t?0:-1,onClick:()=>void u(t),children:n(`threadTree.style.${t}`)},t))}),l&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function Ft({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)(Pt,{style:r,setStyle:t,t:n,settings:!0})}function It({usePreference:e,setMode:t,t:n}){let r=e(e=>e.value?.archiveChildren??`ask`),[i,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(!1);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:a.preferenceRowStyles.row,children:[/* @__PURE__ */ (0,o.jsxs)(`label`,{className:a.preferenceRowStyles.rowText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:a.preferenceRowStyles.title,children:n(`archive.children.preference`)}),/* @__PURE__ */ (0,o.jsx)(`select`,{value:r,disabled:i,onChange:async({target:e})=>{let n=Lt.find(t=>t===e.value);if(n&&n!==r){c(!0),u(!1);try{u(!await t(n))}catch{u(!0)}finally{c(!1)}}},children:Lt.map(e=>/* @__PURE__ */ (0,o.jsx)(`option`,{value:e,children:n(`archive.children.${e}`)},e))})]}),l&&/* @__PURE__ */ (0,o.jsx)(`span`,{role:`alert`,children:n(`archive.children.preferenceFailed`)})]})}let Lt=[`ask`,`always`,`never`],Rt={...Tt,threadTreeCollapseStyle:`summary`,archiveChildren:`ask`},zt=Y.object({...Et,threadTreeCollapseStyle:Y.union([`summary`,`ring`]).default(`summary`),archiveChildren:Y.union([...Lt]).default(`ask`)});function Bt(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function Vt(e){let t=e.configForms.registerBrowser(`ui-workspace`,zt.toJSON(),{...Rt});return e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.thread-tree-style`,order:11.5,locale:`workspace`,inject:()=>({hooks:{preference:t},setStyle:e=>t.set(`threadTreeCollapseStyle`,e)})},Ft)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.archive-children`,order:11.6,locale:`workspace`,inject:()=>({hooks:{preference:t},setMode:e=>t.set(`archiveChildren`,e)})},It)),t}function Ht(e,t,n){let r=e.find(e=>e.workspaceId===t),i=e.find(e=>e.workspaceId===n);return r!==void 0&&i!==void 0&&!r.remote&&!i.remote}function Ut(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ut(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Q(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ut(e))&&(r&&(r+=` `),r+=t);return r}function Wt(e,t){return e===`default-workspace`?t:e}let Gt={},Kt=(0,s.createContext)({t:e=>e,expansion:Gt,rows:e=>T(e,Gt),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function qt(){return(0,s.useContext)(Kt)}function Jt({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:a,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=Bt(u.user),f=u.value?.threadTreeCollapseStyle??`summary`,[p,m]=(0,s.useState)(),h=(0,s.useCallback)(()=>m(void 0),[]),g=n(e=>e),_=i(e=>e),v=r(e=>e.threadExpansion??Gt),y=r(e=>e.archivedFilter??`default`),b=(0,s.useMemo)(()=>R(g,{pinnedSessionIds:_.pinnedSessionIds,archivedSessionIds:_.archivedSessionIds,archivedFilter:y,...y===`only`||!_.threadSections?.length?{}:{sectionedSessionIds:new Set(_.threadSections.flatMap(e=>e.threadIds))}},/* @__PURE__ */ new Map),[g,_,y]),x=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of b){let n=[{node:t,ancestors:[]}];for(let r=n.pop();r!==void 0;r=n.pop()){e.set(r.node.id,{root:t,ancestors:r.ancestors});for(let e of r.node.tree?.children??[])n.push({node:e,ancestors:[...r.ancestors,r.node.id]})}}return e},[b]),S=(0,s.useRef)(void 0),C=(0,s.useCallback)(e=>S.current===e,[]),w=(0,s.useCallback)(e=>{S.current=e,a.setThreadsExpanded(x.get(e)?.ancestors??[],!0)},[a,x]),E=(0,s.useCallback)(e=>{S.current=void 0;let t=x.get(e);t!==void 0&&a.setThreadsExpanded(t.ancestors,!0)},[a,x]),D=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,O=(0,s.useRef)(``);(0,s.useEffect)(()=>{D===void 0?O.current=``:x.get(D)!==void 0&&O.current!==D&&(O.current=D,C(D)||E(D))},[D,C,E,x]);let k=(0,s.useMemo)(()=>({t:e.t,expansion:v,rows:e=>T(e,v),toggle:(e,t,n)=>{a.setThreadsExpanded([e],t),t&&n!==void 0&&!d&&m(n)},markCompletionsRead:e.markCompletionsRead??(()=>{}),collapseStyle:f,stylePrompt:d?void 0:p,dismissStylePrompt:h,setCollapseStyle:l,rootId:e=>x.get(e)?.root.id??e,reveal:E,selectSidebarRow:w,isSidebarSelection:C}),[e.t,e.markCompletionsRead,a,v,x,E,w,C,f,d,p,h,l]);return/* @__PURE__ */ (0,o.jsx)(Kt.Provider,{value:k,children:t})}function Yt({identity:e,ambient:t,title:n,onIdentityClick:r,identityLabel:i,identityControls:a,identityExpanded:s,children:c}){let l=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[e,/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[r?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${q.slot} ${q.identityButton}`,onClick:r,"data-thread-icon-toggle":!0,"aria-label":i,title:i,"aria-expanded":s,"aria-controls":a,children:[l,/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.slot,children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:q.title,children:n}),c]})}function Xt({host:e,t}){let n=e?.displayName??t(`host.local`),r=e?.state===`connected`?t(`host.connected`):e?.state===`connecting`?t(`host.connecting`):t(`host.disconnected`),i=e?`${n} · ${r}`:n;return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.hostBadge,"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,role:`img`,"aria-label":i,title:i,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:n}),e&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.hostDot,"aria-hidden":`true`})]})}let Zt=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Zt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Zt,e.textContent=`._88N-4W_branch{--dsh-thread-row-height:32px;--dsh-thread-icon-size:16px;--dsh-thread-icon-center-y:calc(var(--dsh-thread-row-height) / 2);--dsh-thread-row-gap:2px;min-width:0;position:relative}._88N-4W_branch:has(>:first-child [data-harness-id]){--dsh-thread-icon-size:14px}._88N-4W_branch:has(>:first-child [data-harness-id])>._88N-4W_children{--dsh-thread-parent-icon-size:14px}._88N-4W_children{gap:var(--dsh-thread-row-gap);margin-top:var(--dsh-thread-row-gap);--dsh-thread-parent-icon-size:16px;--dsh-thread-guide-parent-gap:12px;--dsh-thread-guide-start:calc(var(--dsh-thread-guide-parent-gap) - (var(--dsh-thread-row-height) - var(--dsh-thread-parent-icon-size)) / 2 - var(--dsh-thread-row-gap));--dsh-thread-guide-axis:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-guide-indent) + var(--dsh-thread-parent-icon-size) / 2 + .5px);flex-direction:column;display:flex;position:relative}._88N-4W_children ._88N-4W_children{--dsh-thread-guide-parent-gap:10px}._88N-4W_children[hidden]{display:none}._88N-4W_children[data-thread-guide]:before,._88N-4W_children[data-thread-guide]>._88N-4W_branch:before{content:"";pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--dsh-thread-guide-axis)}._88N-4W_children[data-thread-guide]:before{top:var(--dsh-thread-guide-start);height:max(0px, calc(-1 * var(--dsh-thread-guide-start)));background:var(--dsw-alias-border-l2);width:1px}._88N-4W_children[data-thread-guide]>._88N-4W_branch:before{--dsh-thread-guide-stem-start:0px;--dsh-thread-guide-stem-end:0px;top:0;bottom:calc(-1 * var(--dsh-thread-row-gap));width:calc(24px - var(--dsh-thread-parent-icon-size) / 2 - 6.5px);background:var(--dsw-alias-border-l2);mask:linear-gradient(transparent var(--dsh-thread-guide-stem-start), black 0) 0 0 / 1px calc(100% - var(--dsh-thread-guide-stem-end)) no-repeat, url("data:image/svg+xml,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 11 8\\" preserveAspectRatio=\\"none\\"><path d=\\"M.5 0V1Q.5 3.3 2.5 4.5L10.5 7.5\\" fill=\\"none\\" stroke=\\"black\\" stroke-width=\\"1\\" vector-effect=\\"non-scaling-stroke\\"/></svg>") 0 calc(var(--dsh-thread-icon-center-y) - 8px) / 100% 8px no-repeat}._88N-4W_children[data-thread-guide]>._88N-4W_branch:first-child:before{--dsh-thread-guide-stem-start:max(0px, var(--dsh-thread-guide-start))}._88N-4W_children[data-thread-guide]>._88N-4W_branch:last-child:before{--dsh-thread-guide-stem-end:8px;bottom:calc(100% - var(--dsh-thread-icon-center-y))}._88N-4W_summary{appearance:none;width:calc(100% - var(--dsh-thread-icon-size));min-width:0;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:6px;margin-block-end:2px;margin-inline-start:var(--dsh-thread-icon-size);padding:2px 8px;font-size:11px;line-height:18px;display:block}._88N-4W_summary [data-thread-tree-activity=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}._88N-4W_summary [data-thread-tree-activity=pending]{color:var(--dsw-alias-state-warn-primary)}._88N-4W_summary [data-thread-tree-activity=completed]{color:var(--dsw-alias-state-business-primary)}@media (hover:hover) and (pointer:fine){._88N-4W_summary:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)}}._88N-4W_summary:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){._88N-4W_branch{--dsh-thread-row-height:44px}._88N-4W_summary{min-height:24px;padding-block:3px}}[data-phone-drawer] ._88N-4W_branch{--dsh-thread-row-height:44px}[data-phone-drawer] ._88N-4W_branch:has(>:first-child>[data-thread-summary]){--dsh-thread-icon-center-y:14px}`,document.head.appendChild(e)}var Qt={branch:`_88N-4W_branch`,children:`_88N-4W_children`,summary:`_88N-4W_summary`};function $t(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function en(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function tn(e,t,n){return[n(`threadTree.children`,{n:e}),...$t(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function nn({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),$t(t).filter(e=>e.count>0).map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{"data-thread-tree-activity":e.state,children:` · ${n(`threadTree.${e.state}`,{n:e.count})}`},e.state))]})}let rn=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(rn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=rn,e.textContent=`.PiR7ua_ring{inset-inline-start:50%;margin-inline-start:-11px;pointer-events:none;width:22px;height:22px;color:var(--dsw-alias-state-business-primary);margin-top:-11px;position:absolute;top:50%}.PiR7ua_ring svg{width:100%;height:100%;display:block}.PiR7ua_ring circle{stroke:currentColor;stroke-width:1.5px}.PiR7ua_ring[data-thread-ring=pending]{color:var(--dsw-alias-state-warn-primary)}.PiR7ua_ring[data-thread-ring=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.PiR7ua_ring[data-thread-ring=running] svg{animation:1.8s linear infinite PiR7ua_spin}.PiR7ua_ring[data-thread-ring=running] circle{stroke-dasharray:48 16.4}.PiR7ua_ring[data-thread-ring=idle]{color:var(--dsw-alias-label-tertiary);opacity:.55}.PiR7ua_ring[data-thread-ring=idle] circle{stroke-width:1px;stroke-dasharray:1.5 3}@keyframes PiR7ua_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.PiR7ua_ring[data-thread-ring=running] svg{animation:none}}`,document.head.appendChild(e)}var an={ring:`PiR7ua_ring`,spin:`PiR7ua_spin`};function on({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:an.ring,"data-thread-ring":en(e),"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(`svg`,{viewBox:`0 0 22 22`,fill:`none`,children:/* @__PURE__ */ (0,o.jsx)(`circle`,{cx:`11`,cy:`11`,r:`10.25`})})})}let sn=[{title:`threadTree.style.samplePending`,activity:{pendingInteraction:1,running:0,completed:0}},{title:`threadTree.style.sampleRunning`,activity:{pendingInteraction:0,running:1,completed:0}},{title:`threadTree.style.sampleUnread`,activity:{pendingInteraction:0,running:0,completed:1}},{title:`threadTree.style.sampleRead`,activity:{pendingInteraction:0,running:0,completed:0}}];function cn({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.preview,"aria-hidden":`true`,children:sn.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:Qt.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${q.sessionRow} ${Z.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Yt,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:Z.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(on,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${Qt.summary} ${Z.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(nn,{count:2,activity:r,t})})]})},n))})}function ln({style:e,setStyle:t,onLater:n,onExit:r,t:i}){let a=(0,s.useId)(),[c,l]=(0,s.useState)(e),u=(0,s.useRef)(null),d=(0,s.useRef)(r);d.current=r,(0,s.useLayoutEffect)(()=>{let e=u.current;return e?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),()=>{e?.contains(document.activeElement)&&d.current()}},[]);let{busy:f,failed:p,save:m}=Nt(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:Z.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:Z.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.comparison,role:`radiogroup`,"aria-labelledby":a,"aria-busy":f,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=e.key===`Home`||e.key===`End`?Mt[e.key===`Home`?0:1]:Mt[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:Mt.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:Z.choice,"data-thread-style-choice":t,"aria-disabled":f,"aria-checked":e===t,"aria-labelledby":`${a}-${t}`,"aria-describedby":`${a}-${t}-description`,tabIndex:c===t?0:-1,onFocus:()=>l(t),onClick:()=>void m(t),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(cn,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let un=(0,s.createContext)(void 0),dn=()=>(0,s.useContext)(un);function fn({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(pn,{node:e,renderRow:t},e.id))}function pn({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=qt(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Qt.branch,"data-thread-branch":!0,children:[/* @__PURE__ */ (0,o.jsx)(un.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(ln,{style:c,setStyle:l,onLater:a,onExit:()=>document.querySelector(`[data-thread-icon-toggle][aria-controls="${CSS.escape(n)}"]`)?.focus({preventScroll:!0}),t:u}),p.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{id:n,role:`group`,hidden:!d,"data-thread-guide":d&&f<3?``:void 0,className:Qt.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(fn,{roots:p,children:t})})]})}function mn({node:e,title:t,toggle:n,t:r}){let i=dn(),a=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=a.current;return()=>{e!==null&&document.activeElement===e&&e.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0})}},[]);let c=e.tree;if(!c||c.descendantCount===0)return null;let l=tn(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,o.jsx)(`button`,{ref:a,type:`button`,"data-thread-summary":!0,className:Qt.summary,"aria-label":r(`threadTree.expandSummary`,{title:t,summary:l}),"aria-expanded":!1,"aria-controls":i,onClick:e=>{e.stopPropagation(),e.currentTarget.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0}),n()},children:/* @__PURE__ */ (0,o.jsx)(nn,{count:c.descendantCount,activity:c.activity,t:r})})}function hn(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function gn(e,t,n){let{unit:r,n:i}=(0,a.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.${r}`,{n:i})}function _n(e,t,n){let{unit:r,n:i}=(0,a.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${r}`,{n:i})})}function vn(e,t){let n=new Date(e),r=e=>String(e).padStart(2,`0`);return t(`hover.created`,{time:`${t(`date.ymd`,{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()})} ${r(n.getHours())}:${r(n.getMinutes())}`})}function yn({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTitle,children:e}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverPath,children:t}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTime,children:vn(n,r)})]})}function bn(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function xn({group:e,onToggle:t,onCreate:n,actions:r,drag:i,home:c,newShortcut:l,t:u}){let d=e,f=e.remote?void 0:r,p=e.remote?void 0:i,m=d.workspaceId===void 0?u(`group.ungrouped`):d.label,[h,g]=(0,s.useState)(!1),[_,v]=(0,s.useState)(null),b=[{id:`rename`,label:u(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{})},{id:`delete`,label:u(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{}),danger:!0}],x=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q(q.projectRow,h&&q.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":d.expanded,tabIndex:-1,onContextMenu:e=>{f&&!e.target.closest(`button`)&&(e.preventDefault(),v(new DOMRect(e.clientX,e.clientY,0,0)),g(!0))},onKeyDown:e=>{e.target===e.currentTarget&&f&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),v(null),g(!0))},onClick:t,draggable:p!==void 0,onDragStart:p===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,d.key),p.start()},onDragEnd:p?.end,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q(q.slot,d.expanded&&q.folderExpanded),children:d.expanded?/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.title,children:m})}),d.workspaceId!==void 0&&d.remote&&/* @__PURE__ */ (0,o.jsx)(Xt,{host:d.remote,t:u}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.rowActions,children:[f!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:h,onClose:()=>{g(!1)},items:b,onSelect:e=>{
|
|
10
10
|
/* v8 ignore next -- Menu can emit only the rename and delete rows supplied above. */
|
|
11
|
-
g(!1),(e===`rename`||e===`delete`)&&(e===`rename`?f.rename():f.delete())},portal:!0,autoFocus:!0,getAnchorRect:_===null?void 0:()=>_,anchor:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K.iconButton,"aria-label":u(`actions.workspace.aria`,{name:m}),"aria-haspopup":`menu`,"aria-expanded":h,onClick:e=>{e.stopPropagation(),v(null),g(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconEllipsisOutlineRegular,{})})}),!d.remote&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:u(`actions.newSession`),shortcutKeys:l?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K.iconButton,"aria-keyshortcuts":l?.aria,"aria-label":u(`actions.newSession.aria`,{name:m}),onClick:e=>{e.stopPropagation(),n()},children:/* @__PURE__ */ (0,s.jsx)(o.IconNewChatOutlineRegular,{})})})]})]});return d.createdAt===void 0?x:/* @__PURE__ */ (0,s.jsx)(o.HoverCard,{anchor:x,content:/* @__PURE__ */ (0,s.jsx)(un,{label:d.label,cwd:d.cwd===void 0?void 0:y(d.cwd,c),createdAt:d.createdAt,t:u}),openDelayMs:800,disabled:h,copyText:d.cwd,copyLabel:u(`copy`),copiedLabel:u(`hover.copied`)})}function pn({node:e,now:t,renderSlot:n,t:r}){let i=Pe(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K.hoverContent,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.hoverTitle,children:on(e,r)}),e.cwd&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.hoverTime,children:cn(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K.hoverStatus,children:[/* @__PURE__ */ (0,s.jsx)(o.StateDot,{state:e.state}),/* @__PURE__ */ (0,s.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q(K.hoverStatus,K.hoverArchived),children:[/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,s.jsx)(`span`,{children:r(`row.archived`)})]})]})}function mn({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let a=e.id===t,c=Pe(e,i),l=c[0];return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q(K.searchResultRow,a&&K.selected,e.archived&&K.archived),role:`treeitem`,"aria-selected":a,"aria-description":e.archived?i(`toast.archivedNotOpenable`):void 0,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.searchResultHeading,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.slot}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.searchResultTitle,children:e.title||i(`session.untitled`)}),e.remote&&/* @__PURE__ */ (0,s.jsx)(Vt,{host:e.remote,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,s.jsx)(Ie,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.rowActions,children:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K.iconButton,"aria-label":i(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),r(e.id)},children:/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.searchResultMeta,children:[/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.searchResultWorkspace,children:[e.workspace||i(`group.ungrouped`),e.parentTitle!==void 0&&` · ${e.parentTitle||i(`session.untitled`)}`]}),e.snippet!==void 0&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.searchResultSnippet,children:e.snippet})]})]})}function hn({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:r,onOpen:i,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,showHost:f=!0,t:p}){let m=e,{expansion:h,toggle:g,markCompletionsRead:_,collapseStyle:v}=Rt(),y=tn(),b=e.tree?.depth??0,x=h[e.id]===!0,S=b===0?d:void 0,w=on(e,p),T=e.id===n,E=Pe(e,p),D=E[0],O=!m.archived&&D.state!==`idle`,k=S!==void 0&&!m.blank&&!m.archived,A=m.blank?void 0:m.reference,j=k||A!==void 0,M=(0,a.useRef)(!1),[N,P]=(0,a.useState)(!1),[F,I]=(0,a.useState)(null),L=(0,a.useMemo)(()=>[N,P],[N]),ee=(0,a.useRef)(null);(0,a.useEffect)(()=>{u!==void 0&&(ee.current?.scrollIntoView({block:`nearest`}),u())},[u]);let te=/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:ee,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":b,"data-thread-sortable":String(k),"data-thread-pinned":String(e.pinned),style:{"--dsh-thread-indent":`${Math.min(b,3)*24}px`},className:Q(K.sessionRow,T&&K.selected,N&&K.menuOpen,m.archived&&K.archived,S?.marker===`before`&&K.dropBefore,S?.marker===`after`&&K.dropAfter),role:`treeitem`,"aria-selected":T,"aria-current":T?`page`:void 0,"aria-level":b+1,"aria-expanded":e.tree?.descendantCount?x:void 0,tabIndex:-1,onContextMenu:e=>{m.blank||e.target.closest(`button`)||(e.preventDefault(),I(new DOMRect(e.clientX,e.clientY,0,0)),P(!0))},onKeyDown:t=>{t.target!==t.currentTarget||m.blank||(M.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),I(null),P(!0)):t.key===`F2`&&!m.archived&&(t.preventDefault(),c(e.id,m.title)))},"aria-description":m.archived?p(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{M.current=!1},onClick:()=>{M.current||(T&&!m.archived&&e.tree?.descendantCount?(x&&_(e.tree.descendantIds),g(e.id,!x,y)):i(e.id))},draggable:j,onDragStart:j?t=>{M.current=!0,t.dataTransfer.effectAllowed=A===void 0?`move`:k?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,A===void 0?e.id:C(A).clipboardText),A!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(A)),k&&S?.start()}:void 0,onDragEnd:j?e=>S?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:S===void 0?void 0:e=>{S.active&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,S.hover(dn(e)))},onDrop:S===void 0?void 0:e=>{S.active&&(e.preventDefault(),S.drop(dn(e)))},children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.sessionMain,children:/* @__PURE__ */ (0,s.jsxs)(Bt,{identityLabel:e.tree?.descendantCount?!x&&v===`ring`?p(`threadTree.expandSummary`,{title:w,summary:Kt(e.tree.descendantCount,e.tree.activity,p)}):p(x?`threadTree.collapse`:`threadTree.expand`,{n:e.tree.descendantCount}):void 0,identityExpanded:e.tree?.descendantCount?x:void 0,identityControls:y,identity:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[l(`sidebar.session.row.identity`,{sessionId:e.id}),!x&&v===`ring`&&!!e.tree?.descendantCount&&/* @__PURE__ */ (0,s.jsx)(Xt,{activity:e.tree.activity})]}),ambient:!m.archived&&!m.blank&&!O&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:w,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),g(e.id,!x,y)}:void 0,children:[f&&m.remote&&/* @__PURE__ */ (0,s.jsx)(Vt,{host:m.remote,t:p}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.trailing,children:[!m.blank&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q(K.time,O&&K.timeStatus),"data-session-status":O?D.state:void 0,children:O?/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(Ie,{statuses:E}),D.trailingLabel!==void 0&&/* @__PURE__ */ (0,s.jsx)(`span`,{"aria-hidden":`true`,children:D.trailingLabel})]}):sn(m.updatedAt,r,p)}),!m.blank&&/* @__PURE__ */ (0,s.jsxs)(`span`,{className:K.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:N,onClose:()=>{P(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:w,phoneSidebarFooterBackLabel:p(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,s.jsx)(`div`,{className:K.phoneDetails,children:/* @__PURE__ */ (0,s.jsx)(pn,{node:e,now:r,renderSlot:l,t:p})}),getAnchorRect:F===null?void 0:()=>F,anchor:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K.iconButton,"aria-label":p(`actions.session.aria`,{name:w}),"aria-haspopup":`menu`,"aria-expanded":N,onClick:()=>{I(null),P(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:b>0},{hookContext:L})}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:K.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:b>0})})]})]})]})}),!x&&v===`summary`&&/* @__PURE__ */ (0,s.jsx)(an,{node:e,title:w,toggle:()=>g(e.id,!0,y),t:p})]});return/* @__PURE__ */ (0,s.jsx)(o.HoverCard,{anchor:te,content:/* @__PURE__ */ (0,s.jsx)(pn,{node:e,now:r,renderSlot:l,t:p}),openDelayMs:800,disabled:N||S?.active===!0,copyText:m.blank||m.title===``?void 0:m.title,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}let gn=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=gn,e.textContent=`.ZhksEq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var _n={exits:`ZhksEq_exits`};function vn(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function yn(e){if(!e)return;let t=vn(e),n=document.activeElement?.closest(`[data-row-key]`),r=t.find(e=>e===n)??t.find(e=>e.getAttribute(`aria-selected`)===`true`)??t[0];for(let e of t)e.tabIndex=e===r?0:-1}function bn(e){if(e.defaultPrevented||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget,n=e.target;if(!(n instanceof HTMLElement)||!n.matches(`[data-row-key]`)||!t.contains(n))return;let r=vn(t),i=r.indexOf(n);if(i<0)return;let a=n.matches(`[role="treeitem"][aria-expanded]`),o=n.querySelector(`[data-thread-icon-toggle]`),s=()=>{o?o.click():n.click()},c;switch(e.key){case`ArrowDown`:c=r[i+1];break;case`ArrowUp`:c=r[i-1];break;case`Home`:c=r[0];break;case`End`:c=r.at(-1);break;case`ArrowRight`:a&&n.getAttribute(`aria-expanded`)===`false`?s():a&&(c=r[i+1]);break;case`ArrowLeft`:if(a&&n.getAttribute(`aria-expanded`)===`true`)s();else{let e=n.dataset.threadParent;if(e!==void 0){let t=n.dataset.rowKey?.startsWith(`recent:`)?`recent:`:`session:`;c=r.find(n=>n.dataset.rowKey===`${t}${e}`);break}let t=n.closest(`[data-sidebar-group]`),i=t?.querySelector(`[data-row-key^="workspace:"]`);i===n&&(t=t?.parentElement?.closest(`[data-sidebar-group]`)??null,i=t?.querySelector(`[data-row-key^="workspace:"]`)),c=i??void 0}break;case`Enter`:case` `:n.click();break;default:return}e.preventDefault(),c&&(c.focus({preventScroll:!0}),c.scrollIntoView({block:`nearest`}),yn(t))}function xn(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function Sn(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var Cn=class extends a.Component{armed=!1;list=(0,a.createRef)();overlay=(0,a.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;componentDidMount(){yn(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||xn(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null||typeof t.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return null;let n=t.getBoundingClientRect(),r=this.readPositions(),i=new Set(this.props.rowKeys),a=/* @__PURE__ */ new Map;for(let[e,t]of r){if(i.has(e)||!Sn(t.rect,n))continue;let r=t.element.cloneNode(!0);r.removeAttribute(`data-row-key`),r.inert=!0,r.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),a.set(e,{...t,element:r})}return{positions:r,removed:a}}componentDidUpdate(e,t,n){if(yn(this.list.current),n===null){(!xn(e,this.props)||e.resetKey!==this.props.resetKey||e.ready!==this.props.ready)&&this.clear();return}this.cancelMovements();let r=this.list.current,i=this.overlay.current,a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=this.readPositions();for(let[e,t]of s){this.removeExit(e);let r=n.positions.get(e);if(!Sn(t.rect,a)&&(r===void 0||!Sn(r.rect,a)))continue;if(r===void 0){this.move(t.element,[{opacity:0},{opacity:1}],100);continue}let i=r.rect.left-t.rect.left,o=r.rect.top-t.rect.top;(i!==0||o!==0||r.opacity!==1)&&this.move(t.element,[{transform:`translate(${String(i)}px, ${String(o)}px)`,opacity:r.opacity},{transform:`translate(0, 0)`,opacity:1}],200)}for(let[e,t]of n.removed){let{element:n}=t;this.removeExit(e),Object.assign(n.style,{position:`absolute`,margin:`0`,transform:`none`,boxSizing:`border-box`,left:`${String(t.rect.left-o.left)}px`,top:`${String(t.rect.top-o.top)}px`,width:`${String(t.rect.width)}px`,height:`${String(t.rect.height)}px`}),i.append(n);let r=n.animate([{opacity:t.opacity},{opacity:0}],{duration:100,easing:`ease-out`,fill:`forwards`});this.exits.set(e,{element:n,animation:r}),r.onfinish=()=>{this.removeExit(e)}}}componentWillUnmount(){this.clear()}readPositions(){let e=this.list.current.querySelectorAll(`[data-row-key]`);return new Map(Array.from(e,e=>[e.dataset.rowKey,{element:e,rect:e.getBoundingClientRect(),opacity:this.movements.has(e)?Number(getComputedStyle(e).opacity):1}]))}move(e,t,n){let r=e.animate(t,{duration:n,easing:`ease-out`});this.movements.set(e,r),r.onfinish=()=>{this.movements.delete(e),r.cancel()}}cancelMovements(){for(let e of this.movements.values())e.onfinish=null,e.cancel();this.movements.clear()}removeExit(e){let t=this.exits.get(e);t!==void 0&&(t.animation.onfinish=null,t.animation.cancel(),t.element.remove(),this.exits.delete(e))}clear(){this.cancelMovements();for(let e of this.exits.keys())this.removeExit(e)}render(){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(`div`,{ref:this.list,className:this.props.className,role:`tree`,"aria-label":this.props.label,onKeyDown:bn,onFocusCapture:()=>yn(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,s.jsx)(`div`,{ref:this.overlay,className:_n.exits,"aria-hidden":`true`})]})}};let wn=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(wn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=wn,e.textContent=`.LgoPOW_heading{border-radius:var(--dsw-radius-sm);min-height:30px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:0 8px;font-size:14px;font-weight:500;line-height:21px;display:flex}.LgoPOW_heading[data-row-key]{cursor:pointer}.LgoPOW_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.LgoPOW_heading[data-row-key]:focus-visible,.LgoPOW_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.LgoPOW_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.LgoPOW_chevron,.LgoPOW_collapsed{flex-shrink:0}.LgoPOW_collapsed{transform:rotate(-90deg)}.LgoPOW_action{border-radius:var(--dsw-radius-sm);width:24px;height:24px;color:inherit;cursor:pointer;background:0 0;border:none;place-items:center;margin-inline-start:auto;padding:0;display:grid}.LgoPOW_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (pointer:coarse){.LgoPOW_heading{min-height:44px}.LgoPOW_action{width:44px;height:44px}}`,document.head.appendChild(e)}var Tn={action:`LgoPOW_action`,chevron:`LgoPOW_chevron`,collapsed:`LgoPOW_collapsed`,heading:`LgoPOW_heading`,title:`LgoPOW_title`};function En({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,action:a}){let c=n!==void 0&&r!==void 0&&i!==void 0,l=/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[t,/* @__PURE__ */ (0,s.jsx)(`span`,{className:Tn.title,children:e}),c&&/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{className:n?Tn.chevron:Tn.collapsed,size:12}),a!==void 0&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:a.label,portal:!0,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Tn.action,"aria-label":a.label,onClick:e=>{e.stopPropagation(),a.onActivate()},children:a.icon})})]});return c?/* @__PURE__ */ (0,s.jsx)(`div`,{className:Tn.heading,role:`treeitem`,tabIndex:-1,"data-row-key":i,"aria-label":e,"aria-expanded":n,onClick:r,children:l}):/* @__PURE__ */ (0,s.jsx)(`div`,{className:Tn.heading,children:l})}let Dn=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Dn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Dn,e.textContent=`.ss2Ctq_section{margin-bottom:8px}.ss2Ctq_section>*+[data-thread-branch]{margin-top:2px}`,document.head.appendChild(e)}var On={section:`ss2Ctq_section`};function kn({rows:e,currentId:t,onOpen:n,onRenameRequest:r,renderSlot:i,t:a,revealSessionId:c,onSessionRevealed:l,expanded:u,onToggle:d}){return e.length===0?null:/* @__PURE__ */ (0,s.jsxs)(`div`,{role:`group`,"aria-label":a(`section.pinned`),className:On.section,"data-sidebar-pinned":!0,children:[/* @__PURE__ */ (0,s.jsx)(En,{label:a(`section.pinned`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{size:14}),expanded:u,onToggle:d,rowKey:`section:${ce}`}),u&&/* @__PURE__ */ (0,s.jsx)(nn,{roots:e,children:e=>/* @__PURE__ */ (0,s.jsx)(hn,{node:e,currentId:t,now:Date.now(),onOpen:n,onRenameRequest:r,renderSlot:i,onReveal:e.id===c?()=>l(e.id):void 0,t:a},e.id)})]})}let An=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(An)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=An,e.textContent=`.VJNMIq_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}[data-phone-drawer] .VJNMIq_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] .VJNMIq_list{scrollbar-gutter:auto}.VJNMIq_root.VJNMIq_rail{padding-right:0}.VJNMIq_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_iconButton:focus-visible,.VJNMIq_searchButton:focus-visible,.VJNMIq_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.VJNMIq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_viewOptionsMenu{min-width:200px}.VJNMIq_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:6px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;display:flex;overflow:hidden}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{margin-top:2px;margin-right:-4px}.VJNMIq_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;font-size:14px;font-weight:500;line-height:21px;overflow:hidden}.VJNMIq_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.VJNMIq_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.VJNMIq_searchSlotExpanded{max-width:100%;padding-left:0}.VJNMIq_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.VJNMIq_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.VJNMIq_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.VJNMIq_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.VJNMIq_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_searchExpanded .VJNMIq_searchButton{width:28px;height:30px}.VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_searchExpanded .VJNMIq_searchButton:hover{background:0 0}.VJNMIq_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.VJNMIq_searchExpanded .VJNMIq_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.VJNMIq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.VJNMIq_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_rail .VJNMIq_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.VJNMIq_rail .VJNMIq_headerActions{max-width:none}.VJNMIq_rail .VJNMIq_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.VJNMIq_rail .VJNMIq_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.VJNMIq_rail .VJNMIq_listArea{margin-left:0;margin-right:0;padding-left:0}.VJNMIq_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.VJNMIq_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .VJNMIq_fade,[data-phone-drawer] .VJNMIq_fade,body[data-codexhost-wallpaper] .VJNMIq_fade{display:none}.VJNMIq_wide{animation:VJNMIq_wide-in .2s var(--ds-ease-in-out)}@keyframes VJNMIq_wide-in{0%{opacity:0}}.VJNMIq_list{overscroll-behavior-y:contain;min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;scroll-padding-block:8px;overflow-y:auto}.VJNMIq_flatList>*+*,.VJNMIq_searchTree>[role=treeitem]+[role=treeitem],.VJNMIq_groupSection>*+*,.VJNMIq_groupSessions>*+*{margin-top:2px}.VJNMIq_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.VJNMIq_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.VJNMIq_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.VJNMIq_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite VJNMIq_search-skeleton}.VJNMIq_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.VJNMIq_skeletonBarWide{width:90%;height:13px}@keyframes VJNMIq_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.VJNMIq_groupSection{position:relative}.VJNMIq_groupSection+.VJNMIq_groupSection{margin-top:4px}.VJNMIq_listTopDropIndicator,.VJNMIq_workspaceDropBefore:before,.VJNMIq_workspaceDropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.VJNMIq_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.VJNMIq_listTopDropActive>.VJNMIq_workspaceDropBefore:first-child:before{display:none}.VJNMIq_workspaceDropBefore:before{top:-8px}.VJNMIq_workspaceDropAfter:after{bottom:-8px}.VJNMIq_sessionOverflowButton{width:100%;height:32px;padding:0 12px 0 calc(32px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:6px;font-size:12px}.VJNMIq_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}.VJNMIq_groupSessions>.VJNMIq_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}.VJNMIq_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.VJNMIq_sessionOverflowButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){.VJNMIq_sessionOverflowButton,.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_iconButton{min-height:44px}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{height:44px}}.VJNMIq_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.VJNMIq_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.VJNMIq_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.VJNMIq_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.VJNMIq_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.VJNMIq_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.VJNMIq_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.VJNMIq_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.VJNMIq_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.VJNMIq_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.VJNMIq_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.VJNMIq_wide,.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{animation:none}.VJNMIq_search,.VJNMIq_sectionLabel,.VJNMIq_searchSlot,.VJNMIq_searchInput,.VJNMIq_headerActions{transition:none}}`,document.head.appendChild(e)}var $={archiveActivity:`VJNMIq_archiveActivity`,clearButton:`VJNMIq_clearButton`,deleteAction:`VJNMIq_deleteAction`,deleteStatus:`VJNMIq_deleteStatus`,empty:`VJNMIq_empty`,emptyAction:`VJNMIq_emptyAction`,emptyState:`VJNMIq_emptyState`,fade:`VJNMIq_fade`,flatList:`VJNMIq_flatList`,groupSection:`VJNMIq_groupSection`,groupSessions:`VJNMIq_groupSessions`,headerActions:`VJNMIq_headerActions`,headerActionsHidden:`VJNMIq_headerActionsHidden`,iconButton:`VJNMIq_iconButton`,list:`VJNMIq_list`,listArea:`VJNMIq_listArea`,listTopDropActive:`VJNMIq_listTopDropActive`,listTopDropIndicator:`VJNMIq_listTopDropIndicator`,rail:`VJNMIq_rail`,renameError:`VJNMIq_renameError`,renameInput:`VJNMIq_renameInput`,root:`VJNMIq_root`,search:`VJNMIq_search`,"search-skeleton":`VJNMIq_search-skeleton`,searchButton:`VJNMIq_searchButton`,searchExpanded:`VJNMIq_searchExpanded`,searchInput:`VJNMIq_searchInput`,searchSlot:`VJNMIq_searchSlot`,searchSlotExpanded:`VJNMIq_searchSlotExpanded`,searchStatus:`VJNMIq_searchStatus`,searchTree:`VJNMIq_searchTree`,sectionHeader:`VJNMIq_sectionHeader`,sectionLabel:`VJNMIq_sectionLabel`,sectionLabelHidden:`VJNMIq_sectionLabelHidden`,sessionOverflowButton:`VJNMIq_sessionOverflowButton`,skeletonBar:`VJNMIq_skeletonBar`,skeletonBarWide:`VJNMIq_skeletonBarWide`,skeletonBars:`VJNMIq_skeletonBars`,skeletonDot:`VJNMIq_skeletonDot`,skeletonRow:`VJNMIq_skeletonRow`,treeBody:`VJNMIq_treeBody`,viewOptionsMenu:`VJNMIq_viewOptionsMenu`,wide:`VJNMIq_wide`,"wide-in":`VJNMIq_wide-in`,workspaceDropAfter:`VJNMIq_workspaceDropAfter`,workspaceDropBefore:`VJNMIq_workspaceDropBefore`};function jn({list:e,refreshSessions:t,loadMoreSessions:n,t:r}){return e.listError?/* @__PURE__ */ (0,s.jsxs)(`div`,{role:`alert`,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{children:e.listError}),/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.sessionOverflowButton,disabled:e.loading,onClick:e.listErrorPage===`more`?n:t,children:r(`sessions.retry`)})]}):null}function Mn(e,t,n,r){let i=0,a=e.filter(e=>e.blank||e.pinned||e.running||e.runningSubagentCount>0||e.pendingInteraction!==void 0||e.tree?.activity.running||e.tree?.activity.pendingInteraction?!0:i++<t||e.id===n||e.id===r||e.tree?.descendantIds.some(e=>e===n||e===r)===!0);return{rows:a,hiddenCount:e.length-a.length}}function Nn(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function Pn({rowKey:e,hiddenCount:t,hasMore:n,loading:r,expanded:i,expand:a,collapse:o,loadMoreSessions:c,t:l}){if(t===0&&!n&&!o)return null;let u=t===0&&n&&r;return/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,"data-row-key":e,className:$.sessionOverflowButton,"aria-expanded":i,disabled:u,onClick:()=>{t>0?a():n?(a(),c()):o?.()},children:u?l(`sessions.loading`):t>0?l(`sessions.expand`,{n:Math.min(10,t)}):l(n?`sessions.expandMore`:`sessions.collapse`)})}let Fn=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Fn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Fn,e.textContent=`.f8t-HG_modalAction{min-width:72px}.f8t-HG_modalError,.f8t-HG_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.f8t-HG_modalError{color:var(--dsw-alias-state-error-primary)}.f8t-HG_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var In={menuStatus:`f8t-HG_menuStatus`,modalAction:`f8t-HG_modalAction`,modalError:`f8t-HG_modalError`};let Ln=`::add-workspace`,Rn=`::no-workspace`;function zn({t:e,open:t,anchorRef:n,useWorkspaces:r,createWorkspace:i,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=r(e=>e),v=_.items,y=(0,a.useCallback)(()=>n?.current?.getBoundingClientRect()??null,[n]),[b,x]=(0,a.useState)(!1),[S,C]=(0,a.useState)(null),[w,T]=(0,a.useState)(!1),E=(0,o.usePhoneSidebar)(),D=(0,a.useRef)(!1),[O,k]=(0,a.useState)(!1),A=w||O;(0,a.useEffect)(()=>{m?.(A)},[A,m]);let j=c(e=>e);(0,a.useEffect)(()=>{w&&!j&&T(!1)},[w,j]);let M=j?[{id:Ln,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconPlusOutlineRegular,{size:16}),disabled:A}]:[],N=!p&&v.length>0,P=d!==void 0&&!p,F=P?[{id:Rn,label:e(`menu.noWorkspace`),disabled:A}]:[],I=N?[...F,...v.map(t=>({id:t.workspaceId,label:Ft(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{size:16}),disabled:A}))]:[...F,...M],L=I.length===0,ee=()=>{x(!1),C(null)},te=e=>i({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),R=(0,a.useCallback)(()=>{D.current=E?.open===!0,f(),x(!1),C(null),T(!0)},[f,E?.open]),ne=p||_.phase===`ready`,z=!P&&!N&&ne&&M.length===1;(0,a.useEffect)(()=>{t&&z&&!A&&R()},[t,z,A,R]);let B={open:w,busy:O,onPicked:e=>{k(!0),te(e).finally(()=>{k(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},V=e=>{e===Rn?d?.():e===Ln?R():u(e)};return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:t&&!z&&!L,anchor:null,items:I,...N?{footer:M}:{},selectedId:g??(P?Rn:void 0),onSelect:V,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!z&&!L&&_.phase===`pending`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:In.menuStatus,role:`status`,children:e(`picker.loading`)}),l(B),/* @__PURE__ */ (0,s.jsx)(o.Modal,{phoneSidebar:!0,phoneSidebarOrigin:D.current,open:b,onClose:ee,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:In.modalAction,onClick:ee,children:e(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,className:In.modalAction,disabled:!j,onClick:R,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,s.jsx)(`div`,{className:In.modalError,role:`alert`,children:S})})]})}function Bn({open:e,anchorRef:t,useWorkspaces:n,selectedId:r,onPick:i,onClose:a,createWorkspace:o,useDirectoryFlow:c,renderSlot:l,t:u}){let d=n(e=>e.canStartProjectless);return/* @__PURE__ */ (0,s.jsx)(zn,{t:u,open:e,anchorRef:t,useWorkspaces:n,createWorkspace:o,useDirectoryFlow:c,renderDirectoryFlow:e=>l(`conversation.hero.workspace.directoryFlow`,e),selectedId:r,onPick:i,...d?{onPickNone:()=>i(null)}:{},onClose:a})}function Vn(e){let t=e.replaceAll(`\0`,``);if(t.length<=500)return t;let n=500,r=t.charCodeAt(n-1),i=t.charCodeAt(n);return r>=55296&&r<=56319&&i>=56320&&i<=57343&&n--,t.slice(0,n)}function Hn(e){(0,a.useEffect)(()=>{if(!e)return;let t=e=>{e.defaultPrevented||(e.preventDefault(),e.dataTransfer!==null&&(e.dataTransfer.dropEffect=`move`))},n=e=>{e.preventDefault()};return document.addEventListener(`dragover`,t),document.addEventListener(`drop`,n),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`drop`,n)}},[e])}function Un({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:r,onOrderPick:i,onArchivedFilterPick:c,t:l}){let[u,d]=(0,a.useState)(!1),f=(0,a.useRef)(null),p=(0,o.usePhoneSidebar)(),{collapseStyle:m,setCollapseStyle:h}=Rt(),{busy:g,failed:_,save:v}=Et(h);return/* @__PURE__ */ (0,s.jsx)(o.Menu,{phoneSidebarTitle:l(`viewOptions.label`),open:u,onClose:()=>{d(!1)},items:[{type:`label`,id:`group-by`,text:l(`groupBy.label`)},{id:`workspace`,label:l(`groupBy.workspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFlatListOutlineRegular,{})},{type:`separator`,id:`order-by-separator`},{type:`label`,id:`order-by`,text:l(`orderBy.label`)},{id:`manual`,label:l(`orderBy.manual`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconClockOutlineRegular,{})},{type:`separator`,id:`archived-filter-separator`},{type:`label`,id:`filter-by`,text:l(`filterBy.label`)},{id:`hide-archived`,label:l(`viewOptions.hideArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconArchiveCheckOutlineRegular,{})},{type:`separator`,id:`thread-tree-style-separator`},{type:`label`,id:`thread-tree-style`,text:l(`threadTree.style.title`)},{id:`summary`,label:l(`threadTree.style.summary`),disabled:g},{id:`ring`,label:l(`threadTree.style.ring`),disabled:g}],selectedIds:[e,t,{default:`hide-archived`,show:`show-archived`,only:`only-archived`}[n],m],onSelect:e=>{e===`summary`||e===`ring`?v(e).then(e=>{e&&(d(!1),f.current&&(0,o.focusWithoutRing)(f.current))}):(e===`workspace`||e===`workspace-tree`||e===`flat`?r(e):e===`manual`||e===`updated`?i(e):e===`hide-archived`?c(`default`):e===`show-archived`?c(`show`):e===`only-archived`&&c(`only`),d(!1))},align:`end`,dense:!0,listClassName:$.viewOptionsMenu,portal:!0,anchor:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:l(`viewOptions.label`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,ref:f,className:Q($.iconButton,$.wide),"aria-label":l(`viewOptions.label`),"data-phone-sidebar-return":p!==null||void 0,onClick:()=>{d(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconSlidersTwoOutlineRegular,{})})}),children:_&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Z.error,role:`alert`,children:l(`threadTree.style.error`)})})}function Wn(e,t,n,r){let i=t.find(e=>e.id===n.sessionId),a=t.find(e=>e.id===r.id);if(i===void 0||a===void 0||i.blank||i.pinned!==n.pinned||a.pinned!==n.pinned||i.id===a.id||!e.includes(i.id))return;let o=t.filter(e=>e.pinned===n.pinned),s=o.findIndex(e=>e.id===i.id);if(o.filter(e=>e.id!==i.id).findIndex(e=>e.id===a.id)+ +(r.half===`after`)===s)return;let c=e.filter(e=>e!==i.id),l=c.indexOf(a.id);if(l!==-1)return c.splice(l+ +(r.half===`after`),0,i.id),j(c,t.find(e=>e.blank)?.id)}function Gn(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function Kn({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.emptyState,"data-row-key":`empty`,children:[i?/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,s.jsx)(o.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,s.jsx)(`div`,{children:r(n?`sessions.notLoaded`:i?`empty.noneArchived`:`empty.none`)}),i&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function qn({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,ungroupedSessionIds:c,rowState:l,onLeaveArchivedOnly:u,workspaceReady:d,canStartProjectless:f,animationResetKey:p,usePanelInfo:m,onRenameRequest:h,onDeleteRequest:g,onSessionRenameRequest:_,renderSlot:v,insertWorkspaceBefore:y,nestWorkspaces:b,groupExpansion:x,setGroupExpanded:S,sectionExpansion:C,setSectionExpanded:w,setSessionOrder:T,home:D,t:O,revealSessionId:k,onSessionRevealed:A,shortcuts:j,loadMoreSessions:M}){let N=Rt(),P=m(e=>e.activePanelId!==null),F=t(e=>e),I=P?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,L=k===void 0||!d?void 0:E(i,N.rootId(k)),[ee,te]=(0,a.useState)({}),[R,ne]=(0,a.useState)(null),z=(0,a.useRef)(!1),[V,re]=(0,a.useState)(null),ae=(0,a.useRef)(!1),H=R!==null||V!==null;Hn(H);let se=I===void 0||!d?void 0:E(i,N.rootId(I)),U=(0,a.useMemo)(()=>{if(!b)return/* @__PURE__ */ new Map;let e=/* @__PURE__ */ new Map;for(let t of i){let n=t.remote?.hostId??`local`,r=e.get(n)??/* @__PURE__ */ new Map;t.path&&r.set(t.path,t.workspaceId),e.set(n,r)}return new Map(i.map(t=>{let n=e.get(t.remote?.hostId??`local`),r=oe(t.path,[...n?.keys()??[]]);return[t.workspaceId,r===void 0?void 0:n?.get(r)]}))},[b,i]),de=(0,a.useMemo)(()=>{let e=new Set(U.values());return[...i.map(e=>e.workspaceId),``].filter(t=>x[t]??(t===``||e.has(t)))},[x,U,i]),fe=(0,a.useMemo)(()=>{let t=B(e,i,l,F,{expandedGroups:de,excludePinned:!0});return(f||e.hasMore&&t.length===0)&&!t.some(e=>e.key===``)&&t.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:de.includes(``),containsCurrent:!1,sessions:[]}),t},[e,i,l,F,de,f]),pe=Date.now(),me=(e,t)=>{if(z.current)return;z.current=!0,ne(null);let n=fe.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?c:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=Mn(n.sessions,ee[n.key]??5,I,k).rows,o=Wn(r,a,e,t);o!==void 0&&T(e.accountKey,o)},he=(e,t)=>{if(ae.current||(ae.current=!0,re(null),!Nt(i,e.workspaceId,t.id)))return;let n=U.get(e.workspaceId),r=i.filter(e=>!e.remote&&U.get(e.workspaceId)===n),a=r.findIndex(e=>e.workspaceId===t.id);if(a===-1)return;let o=t.half===`before`?t.id:r[a+1]?.workspaceId;if(o===e.workspaceId)return;let s=r.findIndex(t=>t.workspaceId===e.workspaceId),c=o===void 0?r.length:r.findIndex(e=>e.workspaceId===o);(s===-1||c!==s&&c!==s+1)&&y(e.workspaceId,o).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},ge=(0,a.useMemo)(()=>{let e=new Set(fe.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of fe){let r=U.get(n.key);for(;r!==void 0&&!e.has(r);)r=U.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[fe,U]),_e=ge.get(void 0)??[],ve=_e[0]?.workspaceId!==void 0&&V?.over?.id===_e[0].workspaceId&&V.over.half===`before`,ye=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of ge.get(n.key)??[])t(e,r)};for(let e of _e)t(e,e.key);return e},[ge,_e]),be=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[se,L]){let n=t===void 0?void 0:ye.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[se,L,ye]),[xe,Se]=(0,a.useState)(!1),Ce=_e.filter(e=>e.key!==``),W=Nn(Ce,5,be),we=xe?Ce:W.rows,Te=ue(C,ce),Ee=ue(C,le),De=e=>{e.expanded&&te(t=>({...t,[e.key]:5})),S(e.key,!e.expanded)},G=ie(e,l.pinnedSessionIds,l,F).filter(e=>e.pinned),Oe=[];if(G.length>0&&(Oe.push(`section:${ce}`),Te))for(let e of N.rows(G))Oe.push(`session:${e.id}`);fe.length===0&&G.length===0&&Oe.push(`empty`);let ke=(t,a)=>{let c=t.workspaceId,l=ge.get(t.key)??[],u=V!==null&&Nt(i,V.workspaceId,c)&&U.get(V.workspaceId)===U.get(t.key),d=Mn(t.sessions,ee[t.key]??5,I,k);Oe.push(`workspace:${t.key}`);let p=t.expanded?l.map(e=>ke(e,a+1)):[],m=N.rows(d.rows);for(let e of m)Oe.push(`${c===void 0?`recent`:`session`}:${e.id}`);let y=t.expanded&&(d.hiddenCount>0||e.hasMore);y&&Oe.push(`overflow:${t.key}`);let b=c!==void 0&&V?.over?.id===c?V.over.half:null,x=c===void 0||t.remote?void 0:{start:()=>{ae.current=!1,re({workspaceId:c,over:null})},end:()=>{V?.over!==null&&V?.over!==void 0?he(V,V.over):re(null),ae.current=!1}},C=c===void 0||!u?void 0:e=>{re(t=>t===null?t:{...t,over:{id:c,half:e}})},w=c===void 0||!u?void 0:e=>{he(V,{id:c,half:e})};return/* @__PURE__ */ (0,s.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${a*12}px`},className:Q($.groupSection,b===`before`&&$.workspaceDropBefore,b===`after`&&$.workspaceDropAfter),onDragOver:V===null?void 0:e=>{e.preventDefault(),(C!==void 0||U.get(t.key)===void 0)&&(e.stopPropagation(),C===void 0?(e.dataTransfer.dropEffect=`none`,V.over!==null&&re({...V,over:null})):(e.dataTransfer.dropEffect=`move`,C(Gn(e))))},onDrop:V===null?void 0:e=>{e.preventDefault(),(w!==void 0||U.get(t.key)===void 0)&&(e.stopPropagation(),w===void 0?(ae.current=!0,re(null)):w(Gn(e)))},children:[c===void 0?/* @__PURE__ */ (0,s.jsx)(En,{label:O(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{De(t)},rowKey:`workspace:${t.key}`,action:f?{label:O(`actions.newSession`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{S(t.key,!0),n()}}:void 0}):/* @__PURE__ */ (0,s.jsx)(fn,{newShortcut:j.find(e=>e.id===`session.new`),group:t,home:D,t:O,onToggle:()=>{De(t)},onCreate:()=>{t.workspaceId!==void 0&&(S(t.key,t.expanded),n(t.workspaceId))},drag:x,actions:t.workspaceId===void 0?void 0:{rename:()=>{
|
|
11
|
+
g(!1),(e===`rename`||e===`delete`)&&(e===`rename`?f.rename():f.delete())},portal:!0,autoFocus:!0,getAnchorRect:_===null?void 0:()=>_,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":u(`actions.workspace.aria`,{name:m}),"aria-haspopup":`menu`,"aria-expanded":h,onClick:e=>{e.stopPropagation(),v(null),g(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})})}),(!d.remote||d.remote.state===`connected`&&!!e.cwd)&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:u(`actions.newSession`),shortcutKeys:l?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-keyshortcuts":l?.aria,"aria-label":u(`actions.newSession.aria`,{name:m}),onClick:e=>{e.stopPropagation(),n()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{})})})]})]});return d.createdAt===void 0?x:/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:x,content:/* @__PURE__ */ (0,o.jsx)(yn,{label:d.label,cwd:d.cwd===void 0?void 0:y(d.cwd,c),createdAt:d.createdAt,t:u}),openDelayMs:800,disabled:h,copyText:d.cwd,copyLabel:u(`copy`),copiedLabel:u(`hover.copied`)})}function Sn({node:e,now:t,renderSlot:n,t:r}){let i=Be(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTitle,children:hn(e,r)}),e.cwd&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTime,children:_n(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverStatus,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:e.state}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q(q.hoverStatus,q.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`row.archived`)})]})]})}function Cn({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let s=e.id===t,c=Be(e,i),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q(q.searchResultRow,s&&q.selected,e.archived&&q.archived),role:`treeitem`,"aria-selected":s,"aria-description":e.archived?i(`toast.archivedNotOpenable`):void 0,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.searchResultTitle,children:e.title||i(`session.untitled`)}),e.remote&&/* @__PURE__ */ (0,o.jsx)(Xt,{host:e.remote,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(He,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.rowActions,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),r(e.id)},children:/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultWorkspace,children:[e.workspace||i(`group.ungrouped`),e.parentTitle!==void 0&&` · ${e.parentTitle||i(`session.untitled`)}`]}),e.snippet!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.searchResultSnippet,children:e.snippet})]})]})}function wn({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:r,onOpen:i,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,showHost:f=!0,t:p}){let m=e,{expansion:h,toggle:g,markCompletionsRead:_,collapseStyle:v}=qt(),y=dn(),b=e.tree?.depth??0,x=h[e.id]===!0,S=b===0?d:void 0,w=hn(e,p),T=e.id===n,E=Be(e,p),D=E[0],O=!m.archived&&D.state!==`idle`,k=S!==void 0&&!m.blank&&!m.archived,A=m.blank?void 0:m.reference,j=k||A!==void 0,M=(0,s.useRef)(!1),[N,P]=(0,s.useState)(!1),[ee,F]=(0,s.useState)(null),I=(0,s.useMemo)(()=>[N,P],[N]),te=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(te.current?.scrollIntoView({block:`nearest`}),u())},[u]);let L=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:te,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":b,"data-thread-sortable":String(k),"data-thread-pinned":String(e.pinned),style:{"--dsh-thread-indent":`${Math.min(b,3)*24}px`},className:Q(q.sessionRow,T&&q.selected,N&&q.menuOpen,m.archived&&q.archived,S?.marker===`before`&&q.dropBefore,S?.marker===`after`&&q.dropAfter),role:`treeitem`,"aria-selected":T,"aria-current":T?`page`:void 0,"aria-level":b+1,"aria-expanded":e.tree?.descendantCount?x:void 0,tabIndex:-1,onContextMenu:e=>{m.blank||e.target.closest(`button`)||(e.preventDefault(),F(new DOMRect(e.clientX,e.clientY,0,0)),P(!0))},onKeyDown:t=>{t.target!==t.currentTarget||m.blank||(M.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),F(null),P(!0)):t.key===`F2`&&!m.archived&&(t.preventDefault(),c(e.id,m.title)))},"aria-description":m.archived?p(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{M.current=!1},onClick:()=>{M.current||(T&&!m.archived&&e.tree?.descendantCount?(x&&_(e.tree.descendantIds),g(e.id,!x,y)):i(e.id))},draggable:j,onDragStart:j?t=>{M.current=!0,t.dataTransfer.effectAllowed=A===void 0?`move`:k?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,A===void 0?e.id:C(A).clipboardText),A!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(A)),k&&S?.start()}:void 0,onDragEnd:j?e=>S?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:S===void 0?void 0:e=>{S.active&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,S.hover(bn(e)))},onDrop:S===void 0?void 0:e=>{S.active&&(e.preventDefault(),S.drop(bn(e)))},children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.sessionMain,children:/* @__PURE__ */ (0,o.jsxs)(Yt,{identityLabel:e.tree?.descendantCount?!x&&v===`ring`?p(`threadTree.expandSummary`,{title:w,summary:tn(e.tree.descendantCount,e.tree.activity,p)}):p(x?`threadTree.collapse`:`threadTree.expand`,{n:e.tree.descendantCount}):void 0,identityExpanded:e.tree?.descendantCount?x:void 0,identityControls:y,identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[l(`sidebar.session.row.identity`,{sessionId:e.id}),!x&&v===`ring`&&!!e.tree?.descendantCount&&/* @__PURE__ */ (0,o.jsx)(on,{activity:e.tree.activity})]}),ambient:!m.archived&&!m.blank&&!O&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:w,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),g(e.id,!x,y)}:void 0,children:[f&&m.remote&&/* @__PURE__ */ (0,o.jsx)(Xt,{host:m.remote,t:p}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.trailing,children:[!m.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q(q.time,O&&q.timeStatus),"data-session-status":O?D.state:void 0,children:O?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(He,{statuses:E}),D.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:D.trailingLabel})]}):gn(m.updatedAt,r,p)}),!m.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:N,onClose:()=>{P(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:w,phoneSidebarFooterBackLabel:p(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(Sn,{node:e,now:r,renderSlot:l,t:p})}),getAnchorRect:ee===null?void 0:()=>ee,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":p(`actions.session.aria`,{name:w}),"aria-haspopup":`menu`,"aria-expanded":N,onClick:()=>{F(null),P(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:b>0},{hookContext:I})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:b>0})})]})]})]})}),!x&&v===`summary`&&/* @__PURE__ */ (0,o.jsx)(mn,{node:e,title:w,toggle:()=>g(e.id,!0,y),t:p})]});return/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:L,content:/* @__PURE__ */ (0,o.jsx)(Sn,{node:e,now:r,renderSlot:l,t:p}),openDelayMs:800,disabled:N||S?.active===!0,copyText:m.blank||m.title===``?void 0:m.title,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}let Tn=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Tn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Tn,e.textContent=`.ZhksEq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var En={exits:`ZhksEq_exits`};function Dn(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function On(e){if(!e)return;let t=Dn(e),n=document.activeElement?.closest(`[data-row-key]`),r=t.find(e=>e===n)??t.find(e=>e.getAttribute(`aria-selected`)===`true`)??t[0];for(let e of t)e.tabIndex=e===r?0:-1}function kn(e){if(e.defaultPrevented||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget,n=e.target;if(!(n instanceof HTMLElement)||!n.matches(`[data-row-key]`)||!t.contains(n))return;let r=Dn(t),i=r.indexOf(n);if(i<0)return;let a=n.matches(`[role="treeitem"][aria-expanded]`),o=n.querySelector(`[data-thread-icon-toggle]`),s=()=>{o?o.click():n.click()},c;switch(e.key){case`ArrowDown`:c=r[i+1];break;case`ArrowUp`:c=r[i-1];break;case`Home`:c=r[0];break;case`End`:c=r.at(-1);break;case`ArrowRight`:a&&n.getAttribute(`aria-expanded`)===`false`?s():a&&(c=r[i+1]);break;case`ArrowLeft`:if(a&&n.getAttribute(`aria-expanded`)===`true`)s();else{let e=n.dataset.threadParent;if(e!==void 0){let t=n.dataset.rowKey??``,i=t.startsWith(`linked:`)?t.slice(0,t.indexOf(`:`,7)+1):t.startsWith(`recent:`)?`recent:`:`session:`;c=r.find(t=>t.dataset.rowKey===`${i}${e}`);break}let t=n.closest(`[data-sidebar-group]`),i=t?.querySelector(`[data-row-key^="workspace:"]`);i===n&&(t=t?.parentElement?.closest(`[data-sidebar-group]`)??null,i=t?.querySelector(`[data-row-key^="workspace:"]`)),c=i??void 0}break;case`Enter`:case` `:n.click();break;default:return}e.preventDefault(),c&&(c.focus({preventScroll:!0}),c.scrollIntoView({block:`nearest`}),On(t))}function An(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function jn(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var Mn=class extends s.Component{armed=!1;list=(0,s.createRef)();overlay=(0,s.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;componentDidMount(){On(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||An(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null||typeof t.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return null;let n=t.getBoundingClientRect(),r=this.readPositions(),i=new Set(this.props.rowKeys),a=/* @__PURE__ */ new Map;for(let[e,t]of r){if(i.has(e)||!jn(t.rect,n))continue;let r=t.element.cloneNode(!0);r.removeAttribute(`data-row-key`),r.inert=!0,r.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),a.set(e,{...t,element:r})}return{positions:r,removed:a}}componentDidUpdate(e,t,n){if(On(this.list.current),n===null){(!An(e,this.props)||e.resetKey!==this.props.resetKey||e.ready!==this.props.ready)&&this.clear();return}this.cancelMovements();let r=this.list.current,i=this.overlay.current,a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=this.readPositions();for(let[e,t]of s){this.removeExit(e);let r=n.positions.get(e);if(!jn(t.rect,a)&&(r===void 0||!jn(r.rect,a)))continue;if(r===void 0){this.move(t.element,[{opacity:0},{opacity:1}],100);continue}let i=r.rect.left-t.rect.left,o=r.rect.top-t.rect.top;(i!==0||o!==0||r.opacity!==1)&&this.move(t.element,[{transform:`translate(${String(i)}px, ${String(o)}px)`,opacity:r.opacity},{transform:`translate(0, 0)`,opacity:1}],200)}for(let[e,t]of n.removed){let{element:n}=t;this.removeExit(e),Object.assign(n.style,{position:`absolute`,margin:`0`,transform:`none`,boxSizing:`border-box`,left:`${String(t.rect.left-o.left)}px`,top:`${String(t.rect.top-o.top)}px`,width:`${String(t.rect.width)}px`,height:`${String(t.rect.height)}px`}),i.append(n);let r=n.animate([{opacity:t.opacity},{opacity:0}],{duration:100,easing:`ease-out`,fill:`forwards`});this.exits.set(e,{element:n,animation:r}),r.onfinish=()=>{this.removeExit(e)}}}componentWillUnmount(){this.clear()}readPositions(){let e=this.list.current.querySelectorAll(`[data-row-key]`);return new Map(Array.from(e,e=>[e.dataset.rowKey,{element:e,rect:e.getBoundingClientRect(),opacity:this.movements.has(e)?Number(getComputedStyle(e).opacity):1}]))}move(e,t,n){let r=e.animate(t,{duration:n,easing:`ease-out`});this.movements.set(e,r),r.onfinish=()=>{this.movements.delete(e),r.cancel()}}cancelMovements(){for(let e of this.movements.values())e.onfinish=null,e.cancel();this.movements.clear()}removeExit(e){let t=this.exits.get(e);t!==void 0&&(t.animation.onfinish=null,t.animation.cancel(),t.element.remove(),this.exits.delete(e))}clear(){this.cancelMovements();for(let e of this.exits.keys())this.removeExit(e)}render(){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.list,className:this.props.className,role:`tree`,"aria-label":this.props.label,onKeyDown:kn,onFocusCapture:()=>On(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:En.exits,"aria-hidden":`true`})]})}};let Nn=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Nn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Nn,e.textContent=`.LgoPOW_heading{border-radius:var(--dsw-radius-sm);min-height:30px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:0 8px;font-size:14px;font-weight:500;line-height:21px;display:flex}.LgoPOW_heading[data-row-key]{cursor:pointer}.LgoPOW_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.LgoPOW_heading[data-row-key]:focus-visible,.LgoPOW_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.LgoPOW_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.LgoPOW_chevron,.LgoPOW_collapsed{flex-shrink:0}.LgoPOW_collapsed{transform:rotate(-90deg)}.LgoPOW_action{border-radius:var(--dsw-radius-sm);width:24px;height:24px;color:inherit;cursor:pointer;background:0 0;border:none;place-items:center;margin-inline-start:auto;padding:0;display:grid}.LgoPOW_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (pointer:coarse){.LgoPOW_heading{min-height:44px}.LgoPOW_action{width:44px;height:44px}}`,document.head.appendChild(e)}var Pn={action:`LgoPOW_action`,chevron:`LgoPOW_chevron`,collapsed:`LgoPOW_collapsed`,heading:`LgoPOW_heading`,title:`LgoPOW_title`};function Fn({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,action:s}){let c=n!==void 0&&r!==void 0&&i!==void 0,l=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:Pn.title,children:e}),c&&/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{className:n?Pn.chevron:Pn.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:s.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Pn.action,"aria-label":s.label,onClick:e=>{e.stopPropagation(),s.onActivate()},children:s.icon})})]});return c?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Pn.heading,role:`treeitem`,tabIndex:-1,"data-row-key":i,"aria-label":e,"aria-expanded":n,onClick:r,children:l}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Pn.heading,children:l})}let In=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(In)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=In,e.textContent=`.ss2Ctq_section{margin-bottom:8px}.ss2Ctq_section>*+[data-thread-branch]{margin-top:2px}`,document.head.appendChild(e)}var Ln={section:`ss2Ctq_section`};function Rn({rows:e,customSection:t,currentId:n,onOpen:r,onRenameRequest:i,renderSlot:s,t:c,revealSessionId:l,onSessionRevealed:u,expanded:d,onToggle:f}){if(e.length===0&&!t)return null;let p=t?.name??c(`section.pinned`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":p,className:Ln.section,"data-sidebar-pinned":!t||void 0,children:[/* @__PURE__ */ (0,o.jsx)(Fn,{label:p,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:14}),expanded:d,onToggle:f,rowKey:`section:${t?.key??`pinned`}`}),d&&/* @__PURE__ */ (0,o.jsx)(fn,{roots:e,children:e=>/* @__PURE__ */ (0,o.jsx)(wn,{node:e,currentId:n,now:Date.now(),onOpen:r,onRenameRequest:i,renderSlot:s,onReveal:e.id===l?()=>u(e.id):void 0,t:c},e.id)})]})}let zn=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(zn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=zn,e.textContent=`.VJNMIq_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}[data-phone-drawer] .VJNMIq_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] .VJNMIq_list{scrollbar-gutter:auto}.VJNMIq_root.VJNMIq_rail{padding-right:0}.VJNMIq_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_iconButton:focus-visible,.VJNMIq_searchButton:focus-visible,.VJNMIq_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.VJNMIq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_viewOptionsMenu{min-width:200px}.VJNMIq_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:6px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;display:flex;overflow:hidden}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{margin-top:2px;margin-right:-4px}.VJNMIq_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;font-size:14px;font-weight:500;line-height:21px;overflow:hidden}.VJNMIq_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.VJNMIq_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.VJNMIq_searchSlotExpanded{max-width:100%;padding-left:0}.VJNMIq_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.VJNMIq_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.VJNMIq_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.VJNMIq_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.VJNMIq_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_searchExpanded .VJNMIq_searchButton{width:28px;height:30px}.VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_searchExpanded .VJNMIq_searchButton:hover{background:0 0}.VJNMIq_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.VJNMIq_searchExpanded .VJNMIq_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.VJNMIq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.VJNMIq_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_rail .VJNMIq_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.VJNMIq_rail .VJNMIq_headerActions{max-width:none}.VJNMIq_rail .VJNMIq_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.VJNMIq_rail .VJNMIq_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.VJNMIq_rail .VJNMIq_listArea{margin-left:0;margin-right:0;padding-left:0}.VJNMIq_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.VJNMIq_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .VJNMIq_fade,[data-phone-drawer] .VJNMIq_fade,body[data-codexhost-wallpaper] .VJNMIq_fade{display:none}.VJNMIq_wide{animation:VJNMIq_wide-in .2s var(--ds-ease-in-out)}@keyframes VJNMIq_wide-in{0%{opacity:0}}.VJNMIq_list{overscroll-behavior-y:contain;min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;scroll-padding-block:8px;overflow-y:auto}.VJNMIq_flatList>*+*,.VJNMIq_searchTree>[role=treeitem]+[role=treeitem],.VJNMIq_groupSection>*+*,.VJNMIq_groupSessions>*+*{margin-top:2px}.VJNMIq_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.VJNMIq_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.VJNMIq_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.VJNMIq_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite VJNMIq_search-skeleton}.VJNMIq_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.VJNMIq_skeletonBarWide{width:90%;height:13px}@keyframes VJNMIq_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.VJNMIq_groupSection{position:relative}.VJNMIq_groupSection+.VJNMIq_groupSection{margin-top:4px}.VJNMIq_listTopDropIndicator,.VJNMIq_workspaceDropBefore:before,.VJNMIq_workspaceDropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.VJNMIq_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.VJNMIq_listTopDropActive>.VJNMIq_workspaceDropBefore:first-child:before{display:none}.VJNMIq_workspaceDropBefore:before{top:-8px}.VJNMIq_workspaceDropAfter:after{bottom:-8px}.VJNMIq_sessionOverflowButton{width:100%;height:32px;padding:0 12px 0 calc(32px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:6px;font-size:12px}.VJNMIq_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}.VJNMIq_groupSessions>.VJNMIq_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}@media (hover:hover){.VJNMIq_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}.VJNMIq_sessionOverflowButton:active{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.VJNMIq_sessionOverflowButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){.VJNMIq_sessionOverflowButton,.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_iconButton{min-height:44px}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{height:44px}.VJNMIq_searchInput,.VJNMIq_renameInput{font-size:16px}}.VJNMIq_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.VJNMIq_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.VJNMIq_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.VJNMIq_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.VJNMIq_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.VJNMIq_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.VJNMIq_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.VJNMIq_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.VJNMIq_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.VJNMIq_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.VJNMIq_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.VJNMIq_wide,.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{animation:none}.VJNMIq_search,.VJNMIq_sectionLabel,.VJNMIq_searchSlot,.VJNMIq_searchInput,.VJNMIq_headerActions{transition:none}}`,document.head.appendChild(e)}var $={archiveActivity:`VJNMIq_archiveActivity`,clearButton:`VJNMIq_clearButton`,deleteAction:`VJNMIq_deleteAction`,deleteStatus:`VJNMIq_deleteStatus`,empty:`VJNMIq_empty`,emptyAction:`VJNMIq_emptyAction`,emptyState:`VJNMIq_emptyState`,fade:`VJNMIq_fade`,flatList:`VJNMIq_flatList`,groupSection:`VJNMIq_groupSection`,groupSessions:`VJNMIq_groupSessions`,headerActions:`VJNMIq_headerActions`,headerActionsHidden:`VJNMIq_headerActionsHidden`,iconButton:`VJNMIq_iconButton`,list:`VJNMIq_list`,listArea:`VJNMIq_listArea`,listTopDropActive:`VJNMIq_listTopDropActive`,listTopDropIndicator:`VJNMIq_listTopDropIndicator`,rail:`VJNMIq_rail`,renameError:`VJNMIq_renameError`,renameInput:`VJNMIq_renameInput`,root:`VJNMIq_root`,search:`VJNMIq_search`,"search-skeleton":`VJNMIq_search-skeleton`,searchButton:`VJNMIq_searchButton`,searchExpanded:`VJNMIq_searchExpanded`,searchInput:`VJNMIq_searchInput`,searchSlot:`VJNMIq_searchSlot`,searchSlotExpanded:`VJNMIq_searchSlotExpanded`,searchStatus:`VJNMIq_searchStatus`,searchTree:`VJNMIq_searchTree`,sectionHeader:`VJNMIq_sectionHeader`,sectionLabel:`VJNMIq_sectionLabel`,sectionLabelHidden:`VJNMIq_sectionLabelHidden`,sessionOverflowButton:`VJNMIq_sessionOverflowButton`,skeletonBar:`VJNMIq_skeletonBar`,skeletonBarWide:`VJNMIq_skeletonBarWide`,skeletonBars:`VJNMIq_skeletonBars`,skeletonDot:`VJNMIq_skeletonDot`,skeletonRow:`VJNMIq_skeletonRow`,treeBody:`VJNMIq_treeBody`,viewOptionsMenu:`VJNMIq_viewOptionsMenu`,wide:`VJNMIq_wide`,"wide-in":`VJNMIq_wide-in`,workspaceDropAfter:`VJNMIq_workspaceDropAfter`,workspaceDropBefore:`VJNMIq_workspaceDropBefore`};function Bn({list:e,refreshSessions:t,loadMoreSessions:n,t:r}){return e.listError?/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`alert`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.listError}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:$.sessionOverflowButton,disabled:e.loading,onClick:e.listErrorPage===`more`?n:t,children:r(`sessions.retry`)})]}):null}function Vn(e,t,n,r){let i=0,a=e.filter(e=>e.blank||e.pinned||e.running||e.runningSubagentCount>0||e.pendingInteraction!==void 0||e.tree?.activity.running||e.tree?.activity.pendingInteraction?!0:i++<t||e.id===n||e.id===r||e.tree?.descendantIds.some(e=>e===n||e===r)===!0);return{rows:a,hiddenCount:e.length-a.length}}function Hn(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function Un({rowKey:e,hiddenCount:t,hasMore:n,loading:r,expanded:i,expand:a,collapse:s,loadMoreSessions:c,t:l}){if(t===0&&!n&&!s)return null;let u=t===0&&n&&r;return/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,"data-row-key":e,className:$.sessionOverflowButton,"aria-expanded":i,disabled:u,onClick:()=>{t>0?a():n?(a(),c()):s?.()},children:u?l(`sessions.loading`):t>0?l(`sessions.expand`,{n:Math.min(10,t)}):l(n?`sessions.expandMore`:`sessions.collapse`)})}let Wn=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Wn)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Wn,e.textContent=`.f8t-HG_modalAction{min-width:72px}.f8t-HG_modalError,.f8t-HG_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.f8t-HG_modalError{color:var(--dsw-alias-state-error-primary)}.f8t-HG_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var Gn={menuStatus:`f8t-HG_menuStatus`,modalAction:`f8t-HG_modalAction`,modalError:`f8t-HG_modalError`};let Kn=`::add-workspace`,qn=`::no-workspace`;function Jn({t:e,open:t,anchorRef:n,useWorkspaces:r,createWorkspace:i,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=r(e=>e),v=_.items,y=(0,s.useCallback)(()=>n?.current?.getBoundingClientRect()??null,[n]),[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(null),[w,T]=(0,s.useState)(!1),E=(0,a.usePhoneSidebar)(),D=(0,s.useRef)(!1),[O,k]=(0,s.useState)(!1),A=w||O;(0,s.useEffect)(()=>{m?.(A)},[A,m]);let j=c(e=>e);(0,s.useEffect)(()=>{w&&!j&&T(!1)},[w,j]);let M=j?[{id:Kn,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16}),disabled:A}]:[],N=!p&&v.length>0,P=d!==void 0&&!p,ee=P?[{id:qn,label:e(`menu.noWorkspace`),disabled:A}]:[],F=N?[...ee,...v.map(t=>({id:t.workspaceId,label:Wt(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:16}),disabled:A}))]:[...ee,...M],I=F.length===0,te=()=>{x(!1),C(null)},L=e=>i({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),ne=(0,s.useCallback)(()=>{D.current=E?.open===!0,f(),x(!1),C(null),T(!0)},[f,E?.open]),re=p||_.phase===`ready`,R=!P&&!N&&re&&M.length===1;(0,s.useEffect)(()=>{t&&R&&!A&&ne()},[t,R,A,ne]);let z={open:w,busy:O,onPicked:e=>{k(!0),L(e).finally(()=>{k(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},ie=e=>{e===qn?d?.():e===Kn?ne():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:t&&!R&&!I,anchor:null,items:F,...N?{footer:M}:{},selectedId:g??(P?qn:void 0),onSelect:ie,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!R&&!I&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Gn.menuStatus,role:`status`,children:e(`picker.loading`)}),l(z),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:D.current,open:b,onClose:te,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Gn.modalAction,onClick:te,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:Gn.modalAction,disabled:!j,onClick:ne,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:Gn.modalError,role:`alert`,children:S})})]})}function Yn({open:e,anchorRef:t,useWorkspaces:n,selectedId:r,onPick:i,onClose:a,createWorkspace:s,useDirectoryFlow:c,renderSlot:l,t:u}){let d=n(e=>e.canStartProjectless);return/* @__PURE__ */ (0,o.jsx)(Jn,{t:u,open:e,anchorRef:t,useWorkspaces:n,createWorkspace:s,useDirectoryFlow:c,renderDirectoryFlow:e=>l(`conversation.hero.workspace.directoryFlow`,e),selectedId:r,onPick:i,...d?{onPickNone:()=>i(null)}:{},onClose:a})}function Xn(e){let t=e.replaceAll(`\0`,``);if(t.length<=500)return t;let n=500,r=t.charCodeAt(n-1),i=t.charCodeAt(n);return r>=55296&&r<=56319&&i>=56320&&i<=57343&&n--,t.slice(0,n)}function Zn(e){(0,s.useEffect)(()=>{if(!e)return;let t=e=>{e.defaultPrevented||(e.preventDefault(),e.dataTransfer!==null&&(e.dataTransfer.dropEffect=`move`))},n=e=>{e.preventDefault()};return document.addEventListener(`dragover`,t),document.addEventListener(`drop`,n),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`drop`,n)}},[e])}function Qn({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:r,onOrderPick:i,onArchivedFilterPick:c,t:l}){let[u,d]=(0,s.useState)(!1),f=(0,s.useRef)(null),p=(0,a.usePhoneSidebar)(),{collapseStyle:m,setCollapseStyle:h}=qt(),{busy:g,failed:_,save:v}=Nt(h);return/* @__PURE__ */ (0,o.jsx)(a.Menu,{phoneSidebarTitle:l(`viewOptions.label`),open:u,onClose:()=>{d(!1)},items:[{type:`label`,id:`group-by`,text:l(`groupBy.label`)},{id:`workspace`,label:l(`groupBy.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFlatListOutlineRegular,{})},{type:`separator`,id:`order-by-separator`},{type:`label`,id:`order-by`,text:l(`orderBy.label`)},{id:`manual`,label:l(`orderBy.manual`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconClockOutlineRegular,{})},{type:`separator`,id:`archived-filter-separator`},{type:`label`,id:`filter-by`,text:l(`filterBy.label`)},{id:`hide-archived`,label:l(`viewOptions.hideArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconArchiveCheckOutlineRegular,{})},{type:`separator`,id:`thread-tree-style-separator`},{type:`label`,id:`thread-tree-style`,text:l(`threadTree.style.title`)},{id:`summary`,label:l(`threadTree.style.summary`),disabled:g},{id:`ring`,label:l(`threadTree.style.ring`),disabled:g}],selectedIds:[e,t,{default:`hide-archived`,show:`show-archived`,only:`only-archived`}[n],m],onSelect:e=>{e===`summary`||e===`ring`?v(e).then(e=>{e&&(d(!1),f.current&&(0,a.focusWithoutRing)(f.current))}):(e===`workspace`||e===`workspace-tree`||e===`flat`?r(e):e===`manual`||e===`updated`?i(e):e===`hide-archived`?c(`default`):e===`show-archived`?c(`show`):e===`only-archived`&&c(`only`),d(!1))},align:`end`,dense:!0,listClassName:$.viewOptionsMenu,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:l(`viewOptions.label`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,ref:f,className:Q($.iconButton,$.wide),"aria-label":l(`viewOptions.label`),"data-phone-sidebar-return":p!==null||void 0,onClick:()=>{d(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconSlidersTwoOutlineRegular,{})})}),children:_&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.error,role:`alert`,children:l(`threadTree.style.error`)})})}function $n(e,t,n,r){let i=t.find(e=>e.id===n.sessionId),a=t.find(e=>e.id===r.id);if(i===void 0||a===void 0||i.blank||i.pinned!==n.pinned||a.pinned!==n.pinned||i.id===a.id||!e.includes(i.id))return;let o=t.filter(e=>e.pinned===n.pinned),s=o.findIndex(e=>e.id===i.id);if(o.filter(e=>e.id!==i.id).findIndex(e=>e.id===a.id)+ +(r.half===`after`)===s)return;let c=e.filter(e=>e!==i.id),l=c.indexOf(a.id);if(l!==-1)return c.splice(l+ +(r.half===`after`),0,i.id),j(c,t.find(e=>e.blank)?.id)}function er(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function tr({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.emptyState,"data-row-key":`empty`,children:[i?/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,o.jsx)(`div`,{children:r(n?`sessions.notLoaded`:i?`empty.noneArchived`:`empty.none`)}),i&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:$.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function nr({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,linkedRoots:c,ungroupedSessionIds:l,rowState:u,nativeSections:d,onLeaveArchivedOnly:f,workspaceReady:p,canStartProjectless:m,animationResetKey:h,usePanelInfo:g,onRenameRequest:_,onDeleteRequest:v,onSessionRenameRequest:y,renderSlot:b,insertWorkspaceBefore:x,nestWorkspaces:S,groupExpansion:C,setGroupExpanded:w,sectionExpansion:T,setSectionExpanded:D,setSessionOrder:O,home:k,t:A,revealSessionId:j,onSessionRevealed:M,shortcuts:N,loadMoreSessions:P}){let ee=qt(),F=(0,a.usePhoneSidebar)(),I=g(e=>e.activePanelId!==null),te=t(e=>e),L=I?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,ne=(0,s.useMemo)(()=>i.map(e=>{let t=c.get(e.workspaceId);return t===void 0||t.size===0?e:{...e,sessionIds:e.sessionIds.filter(e=>!t.has(e))}}),[c,i]),re=j===void 0||!p?void 0:E(ne,ee.rootId(j)),[R,ie]=(0,s.useState)({}),[B,oe]=(0,s.useState)(null),V=(0,s.useRef)(!1),[H,de]=(0,s.useState)(null),fe=(0,s.useRef)(!1),pe=B!==null||H!==null;Zn(pe);let me=L===void 0||!p?void 0:E(ne,ee.rootId(L)),he=(0,s.useMemo)(()=>{if(!S)return/* @__PURE__ */ new Map;let e=/* @__PURE__ */ new Map;for(let t of i){let n=t.remote?.hostId??`local`,r=e.get(n)??/* @__PURE__ */ new Map;t.path&&r.set(t.path,t.workspaceId),e.set(n,r)}return new Map(i.map(t=>{let n=e.get(t.remote?.hostId??`local`),r=se(t.path,[...n?.keys()??[]]);return[t.workspaceId,r===void 0?void 0:n?.get(r)]}))},[S,i]),ge=(0,s.useMemo)(()=>{let e=new Set(he.values());return[...i.map(e=>e.workspaceId),``].filter(t=>C[t]??(t===``||e.has(t)))},[C,he,i]),U=(0,s.useMemo)(()=>{let t=z(e,i,u,te,{expandedGroups:ge,excludePinned:!0});return(m||e.hasMore&&t.length===0)&&!t.some(e=>e.key===``)&&t.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:ge.includes(``),containsCurrent:!1,sessions:[]}),t},[e,i,u,te,ge,m]),_e=Date.now(),ve=(e,t)=>{if(V.current)return;V.current=!0,oe(null);let n=U.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?l:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=Vn(n.sessions,R[n.key]??5,L,j).rows,o=$n(r,a,e,t);o!==void 0&&O(e.accountKey,o)},ye=(e,t)=>{if(fe.current||(fe.current=!0,de(null),!Ht(i,e.workspaceId,t.id)))return;let n=he.get(e.workspaceId),r=i.filter(e=>!e.remote&&he.get(e.workspaceId)===n),a=r.findIndex(e=>e.workspaceId===t.id);if(a===-1)return;let o=t.half===`before`?t.id:r[a+1]?.workspaceId;if(o===e.workspaceId)return;let s=r.findIndex(t=>t.workspaceId===e.workspaceId),c=o===void 0?r.length:r.findIndex(e=>e.workspaceId===o);(s===-1||c!==s&&c!==s+1)&&x(e.workspaceId,o).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},be=(0,s.useMemo)(()=>{let e=new Set(U.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of U){let r=he.get(n.key);for(;r!==void 0&&!e.has(r);)r=he.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[U,he]),W=be.get(void 0)??[],xe=W[0]?.workspaceId!==void 0&&H?.over?.id===W[0].workspaceId&&H.over.half===`before`,Se=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of be.get(n.key)??[])t(e,r)};for(let e of W)t(e,e.key);return e},[be,W]),Ce=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[me,re]){let n=t===void 0?void 0:Se.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[me,re,Se]),[we,G]=(0,s.useState)(!1),Te=W.filter(e=>e.key!==``),Ee=Hn(Te,5,Ce),De=we?Te:Ee.rows,Oe=ue(T,ce),ke=ir(d,e,u,te,T),K=ue(T,le),Ae=e=>{e.expanded&&ie(t=>({...t,[e.key]:5})),w(e.key,!e.expanded)},je=ae(e,u.pinnedSessionIds,u,te).filter(e=>e.pinned),Me=[];if(je.length>0&&(Me.push(`section:${ce}`),Oe))for(let e of ee.rows(je))Me.push(`session:${e.id}`);Me.push(...ar(ke,ee.rows)),U.length===0&&je.length===0&&d.length===0&&Me.push(`empty`);let Ne=(t,s)=>{let l=t.workspaceId,u=be.get(t.key)??[],d=H!==null&&Ht(i,H.workspaceId,l)&&he.get(H.workspaceId)===he.get(t.key),f=Vn(t.sessions,R[t.key]??5,L,j);Me.push(`workspace:${t.key}`);let p=t.expanded?u.map(e=>Ne(e,s+1)):[],h=ee.rows(f.rows),g=c.get(t.key),x=new Set(g===void 0?[]:f.rows.flatMap(e=>g.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),S=e=>l===void 0?`recent:${e}`:x.has(e)?`linked:${t.key}:${e}`:`session:${e}`;for(let e of h)Me.push(S(e.id));let C=t.expanded&&(f.hiddenCount>0||e.hasMore);C&&Me.push(`overflow:${t.key}`);let T=l!==void 0&&H?.over?.id===l?H.over.half:null,E=l===void 0||t.remote?void 0:{start:()=>{fe.current=!1,de({workspaceId:l,over:null})},end:()=>{H?.over!==null&&H?.over!==void 0?ye(H,H.over):de(null),fe.current=!1}},D=l===void 0||!d?void 0:e=>{de(t=>t===null?t:{...t,over:{id:l,half:e}})},O=l===void 0||!d?void 0:e=>{ye(H,{id:l,half:e})};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${s*12}px`},className:Q($.groupSection,T===`before`&&$.workspaceDropBefore,T===`after`&&$.workspaceDropAfter),onDragOver:H===null?void 0:e=>{e.preventDefault(),(D!==void 0||he.get(t.key)===void 0)&&(e.stopPropagation(),D===void 0?(e.dataTransfer.dropEffect=`none`,H.over!==null&&de({...H,over:null})):(e.dataTransfer.dropEffect=`move`,D(er(e))))},onDrop:H===null?void 0:e=>{e.preventDefault(),(O!==void 0||he.get(t.key)===void 0)&&(e.stopPropagation(),O===void 0?(fe.current=!0,de(null)):O(er(e)))},children:[l===void 0?/* @__PURE__ */ (0,o.jsx)(Fn,{label:A(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{Ae(t)},rowKey:`workspace:${t.key}`,action:m?{label:A(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{w(t.key,!0),F?.close(),n()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(xn,{newShortcut:N.find(e=>e.id===`session.new`),group:t,home:k,t:A,onToggle:()=>{Ae(t)},onCreate:()=>{t.workspaceId!==void 0&&(w(t.key,t.expanded),F?.close(),n(t.workspaceId))},drag:E,actions:t.workspaceId===void 0?void 0:{rename:()=>{
|
|
12
12
|
/* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
|
|
13
|
-
t.workspaceId!==void 0&&
|
|
13
|
+
t.workspaceId!==void 0&&_(t.workspaceId,t.label)},delete:()=>{
|
|
14
14
|
/* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
|
|
15
|
-
t.workspaceId!==void 0&&
|
|
15
|
+
t.workspaceId!==void 0&&v(t.workspaceId,t.label)}}}),p.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`group`,children:p}),(h.length>0||C)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,className:$.groupSessions,style:{"--dsh-workspace-indent":`${l===void 0?0:s*12+22}px`},children:[/* @__PURE__ */ (0,o.jsx)(fn,{roots:f.rows,children:e=>{let n=B!==null&&B.accountKey===t.key,i=n&&B.pinned===e.pinned,a=t=>e.blank?`after`:t,s={start:()=>{V.current=!1,oe({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null})},active:i,marker:n&&B.over?.id===e.id?B.over.half:null,hover:t=>{
|
|
16
16
|
/* v8 ignore next -- narrowing guard: Rows gates hover on `active`, which is false while the drag state is null. */
|
|
17
|
-
|
|
17
|
+
oe(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{
|
|
18
18
|
/* v8 ignore next -- narrowing guard: Rows gates drop on `active`, which is false while the drag state is null. */
|
|
19
|
-
R!==null&&me(R,{id:e.id,half:a(t)})},end:e=>{!e&&R?.over!==null&&R?.over!==void 0?me(R,R.over):ne(null),z.current=!1}};return/* @__PURE__ */ (0,s.jsx)(hn,{rowKey:c===void 0?`recent:${e.id}`:void 0,showHost:!t.remote,node:e,currentId:I,now:pe,onOpen:r,onRenameRequest:_,renderSlot:v,onReveal:e.id===k&&t.key===L?()=>{A(e.id)}:void 0,drag:c===void 0||t.remote||(e.tree?.depth??0)>0?void 0:o,t:O},e.id)}}),y&&/* @__PURE__ */ (0,s.jsx)(Pn,{rowKey:`overflow:${t.key}`,hiddenCount:d.hiddenCount,hasMore:e.hasMore,loading:e.loading,expand:()=>{te(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:M,t:O})]})]},t.key)},Ae=[];if(Ce.length>0&&Oe.push(`section:${le}`),Ee){for(let e of we)Ae.push(ke(e,0));!xe&&W.hiddenCount>0&&(Oe.push(`overflow:workspaces`),Ae.push(/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>{Se(!0)},children:O(`workspaces.expand`)},`overflow:workspaces`)))}let je=_e.find(e=>e.key===``);return je!==void 0&&Ae.push(ke(je,0)),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[ve&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,s.jsxs)(Cn,{className:Q($.list,ve&&$.listTopDropActive),label:O(`section.sessions`),rowKeys:Oe,ready:e.phase===`ready`&&d&&!H,resetKey:JSON.stringify([p,ee,xe,Te,Ee]),children:[/* @__PURE__ */ (0,s.jsx)(kn,{rows:G,currentId:I,onOpen:r,onRenameRequest:_,renderSlot:v,revealSessionId:k,onSessionRevealed:A,expanded:Te,onToggle:()=>{w(ce,!Te)},t:O}),fe.length===0&&G.length===0&&/* @__PURE__ */ (0,s.jsx)(Kn,{rowState:l,onLeaveArchivedOnly:u,partial:e.hasMore,t:O}),Ce.length>0&&/* @__PURE__ */ (0,s.jsx)(En,{label:O(`section.workspaces`),expanded:Ee,onToggle:()=>{Ee&&Se(!1),w(`workspaces`,!Ee)},rowKey:`section:workspaces`}),Ae]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.fade})]})}function Jn({list:e,sessionIds:t,rowState:n,onLeaveArchivedOnly:r,useSessionStatus:i,open:o,onSessionRenameRequest:c,usePanelInfo:l,setSessionOrder:u,sectionExpansion:d,setSectionExpanded:f,workspaceReady:p,animationResetKey:m,revealSessionId:h,onSessionRevealed:g,renderSlot:_,loadMoreSessions:v,t:y}){let b=l(e=>e.activePanelId!==null),x=i(e=>e),S=Rt(),C=(0,a.useMemo)(()=>ie(e,t,n,x).filter(e=>!e.pinned),[e,t,n,x]),w=ie(e,n.pinnedSessionIds,n,x).filter(e=>e.pinned),[T,E]=(0,a.useState)(null),D=(0,a.useRef)(!1),[O,k]=(0,a.useState)(10);Hn(T!==null);let A=b?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,j=Mn(C,O,A,h),M=Mn(C,10,A,h).hiddenCount>0,N=(e,n)=>{if(D.current)return;D.current=!0,E(null);let r=Wn(t,C,e,n);r!==void 0&&u(se,r)},P=Date.now(),F=ue(d,ce);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[/* @__PURE__ */ (0,s.jsxs)(Cn,{className:Q($.list,$.flatList),label:y(`section.sessions`),rowKeys:[...w.length===0?[]:[`section:${ce}`],...F?S.rows(w).map(e=>`session:${e.id}`):[],...C.length===0&&w.length===0?[`empty`]:[],...S.rows(j.rows).map(e=>`session:${e.id}`),...M||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&p&&T===null,resetKey:`${m}/${O}/${String(F)}`,children:[/* @__PURE__ */ (0,s.jsx)(kn,{rows:w,currentId:A,onOpen:o,onRenameRequest:c,renderSlot:_,revealSessionId:h,onSessionRevealed:g,expanded:F,onToggle:()=>{f(ce,!F)},t:y}),w.length>0&&/* @__PURE__ */ (0,s.jsx)(En,{label:y(`section.sessions`)}),C.length===0&&w.length===0&&/* @__PURE__ */ (0,s.jsx)(Kn,{rowState:n,onLeaveArchivedOnly:r,partial:e.hasMore,t:y}),/* @__PURE__ */ (0,s.jsx)(nn,{roots:j.rows,children:e=>{let t=T!==null&&T.pinned===e.pinned,n=t=>e.blank?`after`:t;return/* @__PURE__ */ (0,s.jsx)(hn,{node:e,currentId:A,now:P,onOpen:o,onRenameRequest:c,renderSlot:_,onReveal:e.id===h?()=>{g(e.id)}:void 0,drag:{start:()=>{D.current=!1,E({accountKey:se,sessionId:e.id,pinned:e.pinned,over:null})},active:t,marker:t&&T.over?.id===e.id?T.over.half:null,hover:t=>{E(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{T!==null&&N(T,{id:e.id,half:n(t)})},end:e=>{!e&&T?.over!==null&&T?.over!==void 0?N(T,T.over):E(null),D.current=!1}},t:y},e.id)}}),/* @__PURE__ */ (0,s.jsx)(Pn,{rowKey:`overflow:flat`,hiddenCount:j.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:O>10,expand:()=>k(O+10),collapse:M?()=>k(10):void 0,loadMoreSessions:v,t:y})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.fade})]})}function Yn({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:o,archivedFilter:c,query:l,remote:u,resultLimit:d,usePanelInfo:f,t:p}){let m=f(e=>e.activePanelId!==null),h=e(e=>e),g=t(e=>e),_=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},v=(0,a.useMemo)(()=>ae(h,i,l,o,c,g,_,d),[h,i,l,o,c,g,_,d]),y=_.status===`loading`,b=m?void 0:Object.values(h.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.list,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.searchTree,role:`tree`,"aria-label":p(`search.results.aria`),children:v.items.map(e=>/* @__PURE__ */ (0,s.jsx)(mn,{result:e,currentId:b,onOpen:n,onUnarchive:r,t:p},e.id))}),y&&/* @__PURE__ */ (0,s.jsx)(`div`,{role:`status`,"aria-label":p(`search.pending`),children:(v.items.length===0?[0,1]:[0]).map(e=>/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.skeletonDot}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:$.skeletonBars,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.skeletonBar}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q($.skeletonBar,$.skeletonBarWide)})]})]},e))}),!y&&v.items.length===0&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.empty,children:p(`search.noMatches`)}),v.hasMore&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.searchStatus,children:p(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.fade})]})}function Xn(e){return/* @__PURE__ */ (0,s.jsx)(zt,{browser:e,children:/* @__PURE__ */ (0,s.jsx)(Zn,{...e})})}function Zn({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:r,useSessionStatus:i,useWorkspaces:c,useStore:l,actions:u,startSession:d,open:f,requestSessionRename:p,notifyArchivedNotOpenable:m,renameWorkspace:h,deleteWorkspace:g,insertWorkspaceBefore:_,unarchiveSession:v,createWorkspace:y,searchSessions:b,searchResultLimit:x,useDirectoryFlow:S,useHostInfo:C,useShortcuts:w,useWorkspaceShortcuts:T,requestSearch:E,requestAddWorkspace:D,closeAddWorkspace:O,setDirectoryBusy:M,dismissForkError:N,refreshSessions:P,loadMoreSessions:F,renderSlot:I,t:L}){let ee=C(e=>e.home),te=w(e=>e),R=te.find(e=>e.id===`session.search`),ne=te.find(e=>e.id===`workspace.add`),z=T(e=>e),B=r(e=>e),re=c(e=>e.items),ie=c(e=>e.canStartProjectless===!0),ae=L(`workspace.defaultName`),H=(0,a.useMemo)(()=>re.map(e=>({...e,title:Ft(e.title,ae)})),[re,ae]),oe=c(e=>e.phase),ce=c(e=>e.state),le=c(e=>e.archivedSessionIds),ue=c(e=>e.pinnedSessionIds),U=S(e=>e),de=l(e=>e.groupBy),me=l(e=>e.orderBy),he=l(e=>e.archivedFilter??`default`),ge=l(e=>e.groupExpansion),_e=Rt(),ve=l(e=>e.sectionExpansion),ye=l(e=>e.sessionOrderByAccount),be=e=>{le.includes(e)?m():(_e.selectSidebarRow(e),f(e))},xe=()=>{u.setArchivedFilter(`default`)},Se=oe===`ready`&&ce!==`loading`,Ce=Object.values(B.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,W=Ce!==void 0&&B.byId[Ce]?.blank===!0?Ce:void 0,we=(0,a.useMemo)(()=>{let e=new Set(H.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...B.ids,...le])].filter(t=>!e.has(t))},[le,B.ids,H]),Te=(0,a.useMemo)(()=>({pinnedSessionIds:ue,archivedSessionIds:le}),[le,ue]),Ee=(0,a.useMemo)(()=>({...Te,archivedFilter:he}),[Te,he]),De=(0,a.useMemo)(()=>V(B,le),[le,B]),G=(0,a.useMemo)(()=>fe(B,Ee),[B,Ee]),Oe=(0,a.useMemo)(()=>H.map(e=>{let t=e.sessionIds.filter(e=>B.byId[e]===void 0||G.rootIds.has(e)),n=me===`updated`?k(t,G.summaries):A(t,ye[e.workspaceId],G.summaries,Te);return{...e,sessionIds:j(n,W!==void 0&&t.includes(W)?W:void 0)}}),[W,B.byId,G,me,Te,ye,H]),ke=(0,a.useMemo)(()=>k(we.filter(e=>G.rootIds.has(e)),G.summaries),[G,we]),Ae=(0,a.useMemo)(()=>{let e=De.filter(e=>G.rootIds.has(e));return j(me===`updated`?k(e,G.summaries):A(e,ye[se],G.summaries,Te),W!==void 0&&De.includes(W)?W:void 0)},[W,De,G,me,Te,ye]),je=(0,a.useMemo)(()=>pe(H,B,Ee),[B,Ee,H]),Me=(0,a.useMemo)(()=>Object.fromEntries([...Oe.map(e=>[e.workspaceId,e.sessionIds]),[``,ke],[se,Ae]]),[Ae,ke,Oe]);(0,a.useEffect)(()=>{oe===`ready`&&u.retainAccountKeys([``,se,...H.map(e=>e.workspaceId)])},[u.retainAccountKeys,oe,H]),(0,a.useEffect)(()=>{if(B.phase!==`ready`||Se||me!==`manual`||W===void 0)return;let e={};for(let[t,n]of Object.entries(Me)){if(t!==`__flat_session_order__`&&oe!==`ready`)continue;let r=ye[t]??[];n[0]===W&&r[0]!==W&&(e[t]=[W,...r.filter(e=>e!==W)])}Object.keys(e).length>0&&u.syncSessionOrders(e,je)},[u.syncSessionOrders,Me,W,B.phase,me,ye,je,oe,Se]),(0,a.useEffect)(()=>{B.phase===`ready`&&Se&&me===`manual`&&W!==void 0&&Object.entries(Me).some(([e,t])=>t[0]===W&&ye[e]?.[0]!==W)&&u.syncSessionOrders(Me,je)},[u.syncSessionOrders,Me,W,B.phase,me,ye,je,Se]);let Ne=(e,t)=>{u.setSessionOrder(e,t,Me,je)},[K,Pe]=(0,a.useState)(``),[Fe,Ie]=(0,a.useState)(!1),[Le,Re]=(0,a.useState)(void 0),ze=Vn(K).trim(),[Be,Ve]=(0,a.useState)({query:``,status:`idle`,items:[],hasMore:!1}),q=(0,a.useRef)(null),He=(0,a.useRef)(null),Ue=z.addRequested,We=(0,a.useRef)(null),Ge=(0,a.useRef)(!1),Ke=e=>{le.includes(e)?m():(Re(e),Pe(``),Ie(!1),_e.reveal(e),f(e))},qe=e=>{Re(t=>t===e?void 0:t)};(0,a.useEffect)(()=>{ze!==``&&Re(void 0)},[ze]);let[Je,Ye]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&Je){let e=window.setTimeout(()=>{He.current?.focus({preventScroll:!0}),Ye(!1)},300);return()=>{window.clearTimeout(e)}}},[e,Je]),(0,a.useEffect)(()=>{z.searchRequest!==0&&(O(),Ie(!0),e?He.current?.focus({preventScroll:!0}):(Ye(!0),n()))},[z.searchRequest]),(0,a.useEffect)(()=>{e&&Fe&&!Je&&He.current?.focus({preventScroll:!0})},[e,Fe,Je]),(0,a.useEffect)(()=>{if(!e||!Fe||Je)return;let t=e=>{e.target instanceof Node&&q.current?.contains(e.target)!==!0&&(He.current?.blur(),ze===``&&Ie(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[ze,e,Fe,Je]),(0,a.useEffect)(()=>{if(ze===``){Ve({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;Ve({query:ze,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{b(ze,e.signal).then(t=>{e.signal.aborted||Ve({query:ze,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||Ve({query:ze,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[ze,b]);let[Xe,Ze]=(0,a.useState)(null),[Qe,$e]=(0,a.useState)(``),[et,tt]=(0,a.useState)(!1),[nt,rt]=(0,a.useState)(null),it=Qe.trim(),J=Xe!==null&&it!==``&&H.some(e=>e.workspaceId!==Xe.workspaceId&&e.title===it),Y=et||it===``||Xe===null||it===Xe.storedTitle||J,at=()=>{et||(Ze(null),rt(null))},ot=()=>{Y||(tt(!0),rt(null),h(Xe.workspaceId,it).then(()=>{tt(!1),Ze(null)}).catch(e=>{tt(!1),rt(e instanceof Error?e.message:String(e))}))},st=e=>{v(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[ct,lt]=(0,a.useState)(null),[ut,dt]=(0,a.useState)(!1),[ft,pt]=(0,a.useState)(null),[mt,ht]=(0,a.useState)(null);(0,a.useEffect)(()=>{ft===null||H.some(e=>e.workspaceId===ft)||(dt(!1),pt(null),lt(null))},[ft,H]);let gt=()=>{ut||(lt(null),ht(null))},X=()=>{
|
|
19
|
+
B!==null&&ve(B,{id:e.id,half:a(t)})},end:e=>{!e&&B?.over!==null&&B?.over!==void 0?ve(B,B.over):oe(null),V.current=!1}};return/* @__PURE__ */ (0,o.jsx)(wn,{rowKey:S(e.id),showHost:!t.remote,node:e,currentId:L,now:_e,onOpen:r,onRenameRequest:y,renderSlot:b,onReveal:e.id===j&&t.key===re?()=>{M(e.id)}:void 0,drag:l===void 0||t.remote||(e.tree?.depth??0)>0?void 0:s,t:A},e.id)}}),C&&/* @__PURE__ */ (0,o.jsx)(Un,{rowKey:`overflow:${t.key}`,hiddenCount:f.hiddenCount,hasMore:e.hasMore,loading:e.loading,expand:()=>{ie(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:P,t:A})]})]},t.key)},Pe=[];if(Te.length>0&&Me.push(`section:${le}`),K){for(let e of De)Pe.push(Ne(e,0));!we&&Ee.hiddenCount>0&&(Me.push(`overflow:workspaces`),Pe.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:$.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>{G(!0)},children:A(`workspaces.expand`)},`overflow:workspaces`)))}let Fe=W.find(e=>e.key===``);return Fe!==void 0&&Pe.push(Ne(Fe,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[xe&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(Mn,{className:Q($.list,xe&&$.listTopDropActive),label:A(`section.sessions`),rowKeys:Me,ready:e.phase===`ready`&&p&&!pe,resetKey:JSON.stringify([h,R,we,Oe,K]),children:[/* @__PURE__ */ (0,o.jsx)(Rn,{rows:je,currentId:L,onOpen:r,onRenameRequest:y,renderSlot:b,revealSessionId:j,onSessionRevealed:M,expanded:Oe,onToggle:()=>{D(ce,!Oe)},t:A}),/* @__PURE__ */ (0,o.jsx)(or,{sections:ke,currentId:L,onOpen:r,onRenameRequest:y,renderSlot:b,revealSessionId:j,onSessionRevealed:M,setSectionExpanded:D,t:A}),U.length===0&&je.length===0&&d.length===0&&/* @__PURE__ */ (0,o.jsx)(tr,{rowState:u,onLeaveArchivedOnly:f,partial:e.hasMore,t:A}),Te.length>0&&/* @__PURE__ */ (0,o.jsx)(Fn,{label:A(`section.workspaces`),expanded:K,onToggle:()=>{K&&G(!1),D(`workspaces`,!K)},rowKey:`section:workspaces`}),Pe]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.fade})]})}let rr=[];function ir(e,t,n,r,i){if(!e.length)return[];let a=new Map(R(t,n,r).map(e=>[e.id,e])),o=/* @__PURE__ */ new Set;return e.map(({id:e,name:t,threadIds:n})=>{let r=`native-section:${e}`;return{key:r,name:t,rows:n.flatMap(e=>{let t=a.get(e);return!t||t.pinned||o.has(e)?[]:(o.add(e),[t])}),expanded:ue(i,r)}})}function ar(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function or({sections:e,setSectionExpanded:t,...n}){return e.map(({key:e,name:r,rows:i,expanded:a})=>/* @__PURE__ */ (0,o.jsx)(Rn,{...n,rows:i,customSection:{key:e,name:r},expanded:a,onToggle:()=>t(e,!a)},e))}function sr({list:e,sessionIds:t,rowState:n,nativeSections:r,onLeaveArchivedOnly:i,useSessionStatus:a,open:c,onSessionRenameRequest:l,usePanelInfo:u,setSessionOrder:d,sectionExpansion:f,setSectionExpanded:p,workspaceReady:m,animationResetKey:h,revealSessionId:g,onSessionRevealed:_,renderSlot:v,loadMoreSessions:y,t:b}){let x=u(e=>e.activePanelId!==null),S=a(e=>e),C=qt(),w=(0,s.useMemo)(()=>ae(e,t,n,S).filter(e=>!e.pinned&&!n.sectionedSessionIds?.has(e.id)),[e,t,n,S]),T=ae(e,n.pinnedSessionIds,n,S).filter(e=>e.pinned),[E,D]=(0,s.useState)(null),O=(0,s.useRef)(!1),[k,A]=(0,s.useState)(10);Zn(E!==null);let j=x?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,M=Vn(w,k,j,g),N=Vn(w,10,j,g).hiddenCount>0,P=(e,n)=>{if(O.current)return;O.current=!0,D(null);let r=$n(t,w,e,n);r!==void 0&&d(H,r)},ee=Date.now(),F=ue(f,ce),I=ir(r,e,n,S,f);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[/* @__PURE__ */ (0,o.jsxs)(Mn,{className:Q($.list,$.flatList),label:b(`section.sessions`),rowKeys:[...T.length===0?[]:[`section:${ce}`],...F?C.rows(T).map(e=>`session:${e.id}`):[],...ar(I,C.rows),...w.length===0&&T.length===0&&r.length===0?[`empty`]:[],...C.rows(M.rows).map(e=>`session:${e.id}`),...N||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&m&&E===null,resetKey:`${h}/${k}/${String(F)}`,children:[/* @__PURE__ */ (0,o.jsx)(Rn,{rows:T,currentId:j,onOpen:c,onRenameRequest:l,renderSlot:v,revealSessionId:g,onSessionRevealed:_,expanded:F,onToggle:()=>{p(ce,!F)},t:b}),/* @__PURE__ */ (0,o.jsx)(or,{sections:I,currentId:j,onOpen:c,onRenameRequest:l,renderSlot:v,revealSessionId:g,onSessionRevealed:_,setSectionExpanded:p,t:b}),(T.length>0||r.length>0)&&/* @__PURE__ */ (0,o.jsx)(Fn,{label:b(`section.sessions`)}),w.length===0&&T.length===0&&r.length===0&&/* @__PURE__ */ (0,o.jsx)(tr,{rowState:n,onLeaveArchivedOnly:i,partial:e.hasMore,t:b}),/* @__PURE__ */ (0,o.jsx)(fn,{roots:M.rows,children:e=>{let t=E!==null&&E.pinned===e.pinned,n=t=>e.blank?`after`:t;return/* @__PURE__ */ (0,o.jsx)(wn,{node:e,currentId:j,now:ee,onOpen:c,onRenameRequest:l,renderSlot:v,onReveal:e.id===g?()=>{_(e.id)}:void 0,drag:{start:()=>{O.current=!1,D({accountKey:H,sessionId:e.id,pinned:e.pinned,over:null})},active:t,marker:t&&E.over?.id===e.id?E.over.half:null,hover:t=>{D(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{E!==null&&P(E,{id:e.id,half:n(t)})},end:e=>{!e&&E?.over!==null&&E?.over!==void 0?P(E,E.over):D(null),O.current=!1}},t:b},e.id)}}),/* @__PURE__ */ (0,o.jsx)(Un,{rowKey:`overflow:flat`,hiddenCount:M.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:k>10,expand:()=>A(k+10),collapse:N?()=>A(10):void 0,loadMoreSessions:y,t:b})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.fade})]})}function cr({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:a,archivedFilter:c,query:l,remote:u,resultLimit:d,usePanelInfo:f,t:p}){let m=f(e=>e.activePanelId!==null),h=e(e=>e),g=t(e=>e),_=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},v=(0,s.useMemo)(()=>oe(h,i,l,a,c,g,_,d),[h,i,l,a,c,g,_,d]),y=_.status===`loading`,b=m?void 0:Object.values(h.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.list,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.searchTree,role:`tree`,"aria-label":p(`search.results.aria`),children:v.items.map(e=>/* @__PURE__ */ (0,o.jsx)(Cn,{result:e,currentId:b,onOpen:n,onUnarchive:r,t:p},e.id))}),y&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,"aria-label":p(`search.pending`),children:(v.items.length===0?[0,1]:[0]).map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.skeletonDot}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:$.skeletonBars,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.skeletonBar}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q($.skeletonBar,$.skeletonBarWide)})]})]},e))}),!y&&v.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.empty,children:p(`search.noMatches`)}),v.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.searchStatus,children:p(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.fade})]})}function lr(e){return/* @__PURE__ */ (0,o.jsx)(Jt,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(ur,{...e})})}function ur({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:r,useSessionStatus:i,useWorkspaces:c,useStore:l,actions:u,startSession:d,open:f,requestSessionRename:p,notifyArchivedNotOpenable:m,renameWorkspace:h,deleteWorkspace:g,insertWorkspaceBefore:_,unarchiveSession:v,createWorkspace:y,searchSessions:b,searchResultLimit:x,useDirectoryFlow:S,useHostInfo:C,useShortcuts:w,useWorkspaceShortcuts:T,requestSearch:E,requestAddWorkspace:D,closeAddWorkspace:O,setDirectoryBusy:M,dismissForkError:N,refreshSessions:P,loadMoreSessions:ee,renderSlot:F,t:I}){let te=C(e=>e.home),L=w(e=>e),ne=L.find(e=>e.id===`session.search`),re=L.find(e=>e.id===`workspace.add`),R=T(e=>e),z=r(e=>e),B=c(e=>e.items),ae=c(e=>e.canStartProjectless===!0),oe=I(`workspace.defaultName`),V=(0,s.useMemo)(()=>B.map(e=>({...e,title:Wt(e.title,oe)})),[B,oe]),se=c(e=>e.phase),ce=c(e=>e.state),le=c(e=>e.archivedSessionIds),ue=c(e=>e.pinnedSessionIds),de=c(e=>e.threadSections??rr),fe=S(e=>e),ge=l(e=>e.groupBy),U=l(e=>e.orderBy),_e=l(e=>e.archivedFilter??`default`),ve=l(e=>e.groupExpansion),ye=qt(),be=l(e=>e.sectionExpansion),W=l(e=>e.sessionOrderByAccount),xe=e=>{le.includes(e)?m():(ye.selectSidebarRow(e),f(e))},Se=()=>{u.setArchivedFilter(`default`)},Ce=se===`ready`&&ce!==`loading`,we=Object.values(z.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,G=we!==void 0&&z.byId[we]?.blank===!0?we:void 0,Te=(0,s.useMemo)(()=>{let e=new Set(V.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...z.ids,...le])].filter(t=>!e.has(t))},[le,z.ids,V]),Ee=(0,s.useMemo)(()=>({pinnedSessionIds:ue,archivedSessionIds:le}),[le,ue]),De=_e===`only`?rr:de,Oe=(0,s.useMemo)(()=>({...Ee,archivedFilter:_e,sectionedSessionIds:new Set(De.flatMap(e=>e.threadIds))}),[Ee,_e,De]),ke=(0,s.useMemo)(()=>ie(z,le),[le,z]),K=(0,s.useMemo)(()=>pe(z,Oe),[z,Oe]),Ae=(0,s.useMemo)(()=>V.map(e=>{let{memberIds:t,linkedRootIds:n}=me(e.sessionIds,K),r=U===`updated`?k(t,K.summaries):A(t,W[e.workspaceId],K.summaries,Ee);return{workspace:{...e,sessionIds:j(r,G!==void 0&&t.includes(G)?G:void 0)},linkedRootIds:n}}),[G,K,U,Ee,W,V]),je=(0,s.useMemo)(()=>Ae.map(({workspace:e})=>e),[Ae]),Me=(0,s.useMemo)(()=>new Map(Ae.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[Ae]),Ne=(0,s.useMemo)(()=>k(Te.filter(e=>K.rootIds.has(e)),K.summaries),[K,Te]),Pe=(0,s.useMemo)(()=>{let e=ke.filter(e=>K.rootIds.has(e));return j(U===`updated`?k(e,K.summaries):A(e,W[H],K.summaries,Ee),G!==void 0&&ke.includes(G)?G:void 0)},[G,ke,K,U,Ee,W]),Fe=(0,s.useMemo)(()=>he(V,z,Oe),[z,Oe,V]),Ie=(0,s.useMemo)(()=>Object.fromEntries([...je.map(e=>[e.workspaceId,e.sessionIds]),[``,Ne],[H,Pe]]),[Pe,Ne,je]);(0,s.useEffect)(()=>{se===`ready`&&u.retainAccountKeys([``,H,...V.map(e=>e.workspaceId)])},[u.retainAccountKeys,se,V]),(0,s.useEffect)(()=>{if(z.phase!==`ready`||Ce||U!==`manual`||G===void 0)return;let e={};for(let[t,n]of Object.entries(Ie)){if(t!==`__flat_session_order__`&&se!==`ready`)continue;let r=W[t]??[];n[0]===G&&r[0]!==G&&(e[t]=[G,...r.filter(e=>e!==G)])}Object.keys(e).length>0&&u.syncSessionOrders(e,Fe)},[u.syncSessionOrders,Ie,G,z.phase,U,W,Fe,se,Ce]),(0,s.useEffect)(()=>{z.phase===`ready`&&Ce&&U===`manual`&&G!==void 0&&Object.entries(Ie).some(([e,t])=>t[0]===G&&W[e]?.[0]!==G)&&u.syncSessionOrders(Ie,Fe)},[u.syncSessionOrders,Ie,G,z.phase,U,W,Fe,Ce]);let Le=(e,t)=>{u.setSessionOrder(e,t,Ie,Fe)},[Re,ze]=(0,s.useState)(``),[q,Be]=(0,s.useState)(!1),[Ve,He]=(0,s.useState)(void 0),Ue=Xn(Re).trim(),[We,Ge]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),Ke=(0,s.useRef)(null),qe=(0,s.useRef)(null),Je=R.addRequested,Ye=(0,s.useRef)(null),Xe=(0,s.useRef)(!1),Ze=e=>{if(le.includes(e)){m();return}let t=De.find(({threadIds:t})=>t.includes(ye.rootId(e)));t&&u.setSectionExpanded(`native-section:${t.id}`,!0),He(e),ze(``),Be(!1),ye.reveal(e),f(e)},Qe=e=>{He(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{Ue!==``&&He(void 0)},[Ue]);let[$e,et]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&$e){let e=window.setTimeout(()=>{qe.current?.focus({preventScroll:!0}),et(!1)},300);return()=>{window.clearTimeout(e)}}},[e,$e]),(0,s.useEffect)(()=>{R.searchRequest!==0&&(O(),Be(!0),e?qe.current?.focus({preventScroll:!0}):(et(!0),n()))},[R.searchRequest]),(0,s.useEffect)(()=>{e&&q&&!$e&&qe.current?.focus({preventScroll:!0})},[e,q,$e]),(0,s.useEffect)(()=>{if(!e||!q||$e)return;let t=e=>{e.target instanceof Node&&Ke.current?.contains(e.target)!==!0&&(qe.current?.blur(),Ue===``&&Be(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[Ue,e,q,$e]),(0,s.useEffect)(()=>{if(Ue===``){Ge({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;Ge({query:Ue,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{b(Ue,e.signal).then(t=>{e.signal.aborted||Ge({query:Ue,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||Ge({query:Ue,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[Ue,b]);let[tt,nt]=(0,s.useState)(null),[rt,it]=(0,s.useState)(``),[at,ot]=(0,s.useState)(!1),[st,ct]=(0,s.useState)(null),lt=rt.trim(),ut=tt!==null&<!==``&&V.some(e=>e.workspaceId!==tt.workspaceId&&e.title===lt),dt=at||lt===``||tt===null||lt===tt.storedTitle||ut,J=()=>{at||(nt(null),ct(null))},Y=()=>{dt||(ot(!0),ct(null),h(tt.workspaceId,lt).then(()=>{ot(!1),nt(null)}).catch(e=>{ot(!1),ct(e instanceof Error?e.message:String(e))}))},ft=e=>{v(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[pt,mt]=(0,s.useState)(null),[ht,gt]=(0,s.useState)(!1),[_t,vt]=(0,s.useState)(null),[yt,bt]=(0,s.useState)(null);(0,s.useEffect)(()=>{_t===null||V.some(e=>e.workspaceId===_t)||(gt(!1),vt(null),mt(null))},[_t,V]);let xt=()=>{ht||(mt(null),bt(null))},St=()=>{
|
|
20
20
|
/* v8 ignore next -- the Modal is absent without a target and its button is disabled while deleting. */
|
|
21
|
-
ut||ct===null||(dt(!0),pt(null),ht(null),g(ct.workspaceId).then(()=>{pt(ct.workspaceId)}).catch(e=>{dt(!1),ht(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.root,!e&&$.rail),children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.sectionHeader,children:[e&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q($.sectionLabel,$.wide,Fe&&$.sectionLabelHidden),children:L(`section.sessions`)}),e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q($.searchSlot,Fe&&$.searchSlotExpanded),children:/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:q,className:Q($.search,Fe&&$.searchExpanded),onClick:()=>{O(),Ie(!0),He.current?.focus()},children:[/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:L(`search`),shortcutKeys:R?.keys,side:`bottom`,delayMs:500,disabled:Fe,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.searchButton,"aria-label":L(`search.sessions.aria`),"aria-keyshortcuts":R?.aria,"aria-expanded":Fe,onClick:()=>{E()},children:/* @__PURE__ */ (0,s.jsx)(o.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,s.jsx)(`input`,{ref:He,className:$.searchInput,type:`text`,placeholder:L(`search.placeholder`),maxLength:500,value:K,tabIndex:Fe?0:-1,onChange:e=>{Pe(Vn(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),Pe(``),Ie(!1))}}),Fe&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.clearButton,"aria-label":L(`search.clear`),onClick:e=>{e.stopPropagation(),Pe(``),Ie(!1)},children:/* @__PURE__ */ (0,s.jsx)(o.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.headerActions,e&&Fe&&$.headerActionsHidden),children:[e&&/* @__PURE__ */ (0,s.jsx)(Un,{groupBy:de,orderBy:me,archivedFilter:he,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,Me,je)},onArchivedFilterPick:u.setArchivedFilter,t:L}),U&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:L(`workspace.add`),shortcutKeys:ne?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{ref:We,type:`button`,className:$.iconButton,"aria-label":L(`workspace.add`),"aria-keyshortcuts":ne?.aria,onClick:()=>{D()},children:/* @__PURE__ */ (0,s.jsx)(o.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,s.jsx)(zn,{t:L,open:Ue,anchorRef:We,useWorkspaces:c,createWorkspace:y,useDirectoryFlow:S,renderDirectoryFlow:e=>I(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:M,side:`right`,onPick:e=>{O(),d(e)},onClose:()=>{O()}})]}),!e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.search,children:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:L(`search`),shortcutKeys:R?.keys,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.searchButton,"aria-label":L(`search.sessions.aria`),"aria-keyshortcuts":R?.aria,onClick:()=>{E()},children:/* @__PURE__ */ (0,s.jsx)(o.IconSearchOutlineRegular,{size:18})})})}),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.listArea,children:[e&&B.phase===`pending`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.empty,role:`status`,children:L(`sessions.loading`)}),e&&(ze===``?de===`flat`?/* @__PURE__ */ (0,s.jsx)(Jn,{loadMoreSessions:F,usePanelInfo:t,list:B,sessionIds:Ae,rowState:Ee,onLeaveArchivedOnly:xe,workspaceReady:Se,animationResetKey:`${de}/${me}/${he}`,useSessionStatus:i,open:be,onSessionRenameRequest:p,renderSlot:I,setSessionOrder:Ne,sectionExpansion:ve,setSectionExpanded:u.setSectionExpanded,revealSessionId:Le,onSessionRevealed:qe,t:L}):/* @__PURE__ */ (0,s.jsx)(qn,{loadMoreSessions:F,usePanelInfo:t,list:B,shortcuts:te,useSessionStatus:i,onSessionRenameRequest:p,renderSlot:I,workspaces:Oe,ungroupedSessionIds:ke,canStartProjectless:ie,workspaceReady:Se,nestWorkspaces:de===`workspace-tree`,animationResetKey:`${de}/${me}/${he}`,groupExpansion:ge,setGroupExpanded:u.setGroupExpanded,sectionExpansion:ve,setSectionExpanded:u.setSectionExpanded,setSessionOrder:Ne,rowState:Ee,onLeaveArchivedOnly:xe,startSession:d,open:be,insertWorkspaceBefore:_,revealSessionId:Le,onSessionRevealed:qe,home:ee,t:L,onRenameRequest:(e,t)=>{Ze({workspaceId:e,storedTitle:re.find(t=>t.workspaceId===e)?.title??t}),$e(t),rt(null)},onDeleteRequest:(e,t)=>{lt({workspaceId:e,title:t}),ht(null)}}):/* @__PURE__ */ (0,s.jsx)(Yn,{usePanelInfo:t,useSessions:r,useSessionStatus:i,open:Ke,onUnarchive:st,workspaces:H,archivedSessionIds:le,archivedFilter:he,query:ze,remote:Be,resultLimit:x,t:L}))]}),e&&/* @__PURE__ */ (0,s.jsx)(jn,{list:B,refreshSessions:P,loadMoreSessions:F,t:L}),/* @__PURE__ */ (0,s.jsxs)(o.Modal,{open:Xe!==null,onClose:at,closeLabel:L(`close`),title:L(`rename.workspace.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:et,onClick:at,children:L(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,disabled:Y,onClick:ot,children:L(`rename`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`input`,{className:$.renameInput,value:Qe,"aria-label":L(`field.workspaceName`),"data-modal-autofocus":!0,disabled:et,onFocus:e=>{e.target.select()},onChange:e=>{$e(e.target.value),rt(null)},onCompositionStart:()=>{Ge.current=!0},onCompositionEnd:()=>{Ge.current=!1},onKeyDown:e=>{e.key===`Enter`&&!Ge.current&&(e.preventDefault(),ot())}}),J&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:L(`conflict.named`,{name:it})}),nt!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:nt})]}),/* @__PURE__ */ (0,s.jsxs)(o.Modal,{open:ct!==null,onClose:gt,closeLabel:L(`close`),title:L(`delete.workspace`),...ct===null?{}:{description:L(`delete.desc`,{name:ct.title})},footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:ut,onClick:gt,children:L(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:$.deleteAction,disabled:ut,onClick:X,children:L(`delete.workspace`)})]}),children:[ut&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.deleteStatus,role:`status`,children:L(`delete.pending`)}),mt!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:mt})]}),z.forkError!==null&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:L(z.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:N},z.forkError.seq)]})}function Qn({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:r,archiveSession:i,unarchiveSession:a,t:c}){let[,l]=n(),u=r(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?a:i)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function $n({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:r,t:i}){let a=t(t=>t.has(e));return/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(a?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K.iconButton,"aria-label":i(a?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(a?r:n)(e)},children:a?/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16})})})}function er({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,s.jsx)(tr,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function tr({request:e,stopAndArchiveSession:t,onSettle:n,t:r}){let[i,c]=(0,a.useState)(!1),[l,u]=(0,a.useState)(null),d=()=>{i||n()};return/* @__PURE__ */ (0,s.jsxs)(o.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:r(`close`),title:r(`archive.confirm.title`),description:r(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:i,onClick:d,children:r(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:$.deleteAction,disabled:i,onClick:()=>{c(!0),u(null),t(e.sessionId).then(()=>{c(!1),n()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},children:r(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,s.jsxs)(`ul`,{className:$.archiveActivity,"aria-label":r(`archive.confirm.activity`),children:[e.runningThreads?.map(e=>/* @__PURE__ */ (0,s.jsx)(`li`,{children:r(`archive.confirm.thread`,{title:e.title})},e.id)),e.activity.map((e,t)=>/* @__PURE__ */ (0,s.jsx)(`li`,{children:nr(e,r)},`${e.kind}-${String(t)}`))]}),i&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:l})]})}function nr(e,t){let n=e.items??[],r=n.length,i=n.map(e=>e.label??e.id).join(t(`archive.confirm.listSeparator`)),a=r===1?`one`:`other`;switch(e.kind){case`turn`:return t(`archive.confirm.turn`);case`subagent`:return t(`archive.confirm.subagents.${a}`,{n:r,names:i});case`job`:return t(`archive.confirm.jobs.${a}`,{n:r,names:i});case`schedule`:return t(`archive.confirm.schedules.${a}`,{n:r,names:i});default:return t(`archive.confirm.other.${a}`,{kind:e.kind,n:r})}}function rr(e,t){let n,r;return{getSnapshot:()=>{let i=e.getSnapshot();return(r===void 0||i!==n)&&(n=i,r=t(i)),r},subscribe:t=>e.subscribe(t)}}function ir({sessionId:e,useMenuOpenState:t,useShortcuts:n,forkSession:r,t:i}){let[,a]=t(),c=n(e=>e.find(e=>e.id===`session.fork`));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:c,icon:/* @__PURE__ */ (0,s.jsx)(o.IconBranchOutlineRegular,{}),onSelect:()=>{a(!1),r(e)},children:i(`menu.fork`)})}function ar({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let a=t(t=>{let n=t.byId[e];return n!==void 0&&x(n)!==void 0}),[,c]=n();return a?/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:/* @__PURE__ */ (0,s.jsx)(o.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),r(e)},children:i(`menu.copySessionLink`)}):null}function or({sessionId:e,usePinned:t,useArchived:n}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e))}}function sr(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:a}=e,[,c]=n(),{pinned:l,archived:u}=or(e);return u?null:/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:l?/* @__PURE__ */ (0,s.jsx)(o.IconPinFillRegular,{}):/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?i:r)(t)},children:a(l?`menu.unpinSession`:`menu.pinSession`)})}function cr(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:a,archived:c}=or(e);return c?null:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(a?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K.iconButton,"aria-label":i(a?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(a?r:n)(t)},children:a?/* @__PURE__ */ (0,s.jsx)(o.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{size:16})})})}function lr({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:r,requestSessionRename:i,t:a}){let[,c]=n(),l=r(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,s.jsx)(o.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),i(e,t)},children:a(`rename`)})}function ur({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,s.jsx)(dr,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function dr({request:e,renameSession:t,onSettle:n,t:r}){let[i,c]=(0,a.useState)(e.currentTitle),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(null),p=(0,a.useRef)(!1),m=i.trim(),h=l||m===``,g=()=>{l||n()},_=()=>{h||(u(!0),f(null),t(e.sessionId,m).then(()=>{u(!1),n()}).catch(e=>{u(!1),f(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,s.jsxs)(o.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:r(`close`),title:r(`rename.session.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:l,onClick:g,children:r(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,disabled:h,onClick:_,children:r(`rename`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`input`,{className:$.renameInput,value:i,"aria-label":r(`field.sessionName`),"data-modal-autofocus":!0,disabled:l,onFocus:e=>{e.target.select()},onChange:e=>{c(e.target.value),f(null)},onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:e=>{e.key===`Enter`&&!p.current&&(e.preventDefault(),_())}}),d!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:d})]})}let fr=6e3;function pr({useToast:e,useStore:t,dismissToast:n,undoArchive:r,showArchived:i,t:a}){let c=e(e=>e),l=t(e=>(e.archivedFilter??`default`)!=="default");if(c===null)return null;if(c.kind===`archived`||c.kind===`stoppedAndArchived`){let{sessionId:e}=c;return/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:a(c.kind===`archived`?`toast.archived`:`toast.stoppedAndArchived`),tone:`success`,holdMs:fr,actions:[{label:a(`toast.archivedUndo`),onClick:()=>{n(),r(e)}},...l?[]:[{prefix:a(`toast.archivedOr`),label:a(`toast.archivedFilter`),onClick:()=>{n(),i()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:a(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWarningOutlineRegular,{}),holdMs:fr,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:mr(c,a),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function mr(e,t){switch(e.kind){case`archiveFailed`:return t(`toast.archiveFailed`,{message:e.message});case`unarchiveFailed`:return t(`toast.unarchiveFailed`,{message:e.message});case`pinFailed`:return t(`toast.pinFailed`,{message:e.message});case`unpinFailed`:return t(`toast.unpinFailed`,{message:e.message});case`defaultWorkspaceFailed`:return t(`defaultWorkspace.failed`);case`archivedNotOpenable`:return t(`toast.archivedNotOpenable`);case`sessionLinkCopied`:return t(`toast.sessionLinkCopied`);case`sessionLinkCopyFailed`:return t(`toast.sessionLinkCopyFailed`);case`recentVisitsStorageFailed`:return t(`recent.cache.error`);
|
|
21
|
+
ht||pt===null||(gt(!0),vt(null),bt(null),g(pt.workspaceId).then(()=>{vt(pt.workspaceId)}).catch(e=>{gt(!1),bt(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q($.root,!e&&$.rail),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.sectionHeader,children:[e&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q($.sectionLabel,$.wide,q&&$.sectionLabelHidden),children:I(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q($.searchSlot,q&&$.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:Ke,className:Q($.search,q&&$.searchExpanded),onClick:()=>{O(),Be(!0),qe.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:I(`search`),shortcutKeys:ne?.keys,side:`bottom`,delayMs:500,disabled:q,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:$.searchButton,"aria-label":I(`search.sessions.aria`),"aria-keyshortcuts":ne?.aria,"aria-expanded":q,onClick:()=>{E()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:qe,className:$.searchInput,type:`text`,placeholder:I(`search.placeholder`),maxLength:500,value:Re,tabIndex:q?0:-1,onChange:e=>{ze(Xn(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),ze(``),Be(!1))}}),q&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:$.clearButton,"aria-label":I(`search.clear`),onClick:e=>{e.stopPropagation(),ze(``),Be(!1)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q($.headerActions,e&&q&&$.headerActionsHidden),children:[e&&/* @__PURE__ */ (0,o.jsx)(Qn,{groupBy:ge,orderBy:U,archivedFilter:_e,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,Ie,Fe)},onArchivedFilterPick:u.setArchivedFilter,t:I}),fe&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:I(`workspace.add`),shortcutKeys:re?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Ye,type:`button`,className:$.iconButton,"aria-label":I(`workspace.add`),"aria-keyshortcuts":re?.aria,onClick:()=>{D()},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(Jn,{t:I,open:Je,anchorRef:Ye,useWorkspaces:c,createWorkspace:y,useDirectoryFlow:S,renderDirectoryFlow:e=>F(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:M,side:`right`,onPick:e=>{O(),d(e)},onClose:()=>{O()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.search,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:I(`search`),shortcutKeys:ne?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:$.searchButton,"aria-label":I(`search.sessions.aria`),"aria-keyshortcuts":ne?.aria,onClick:()=>{E()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:18})})})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.listArea,children:[e&&z.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.empty,role:`status`,children:I(`sessions.loading`)}),e&&(Ue===``?ge===`flat`?/* @__PURE__ */ (0,o.jsx)(sr,{loadMoreSessions:ee,usePanelInfo:t,list:z,sessionIds:Pe,rowState:Oe,nativeSections:De,onLeaveArchivedOnly:Se,workspaceReady:Ce,animationResetKey:`${ge}/${U}/${_e}`,useSessionStatus:i,open:xe,onSessionRenameRequest:p,renderSlot:F,setSessionOrder:Le,sectionExpansion:be,setSectionExpanded:u.setSectionExpanded,revealSessionId:Ve,onSessionRevealed:Qe,t:I}):/* @__PURE__ */ (0,o.jsx)(nr,{loadMoreSessions:ee,usePanelInfo:t,list:z,shortcuts:L,useSessionStatus:i,onSessionRenameRequest:p,renderSlot:F,workspaces:je,linkedRoots:Me,ungroupedSessionIds:Ne,canStartProjectless:ae,workspaceReady:Ce,nestWorkspaces:ge===`workspace-tree`,animationResetKey:`${ge}/${U}/${_e}`,groupExpansion:ve,setGroupExpanded:u.setGroupExpanded,sectionExpansion:be,setSectionExpanded:u.setSectionExpanded,setSessionOrder:Le,rowState:Oe,nativeSections:De,onLeaveArchivedOnly:Se,startSession:d,open:xe,insertWorkspaceBefore:_,revealSessionId:Ve,onSessionRevealed:Qe,home:te,t:I,onRenameRequest:(e,t)=>{nt({workspaceId:e,storedTitle:B.find(t=>t.workspaceId===e)?.title??t}),it(t),ct(null)},onDeleteRequest:(e,t)=>{mt({workspaceId:e,title:t}),bt(null)}}):/* @__PURE__ */ (0,o.jsx)(cr,{usePanelInfo:t,useSessions:r,useSessionStatus:i,open:Ze,onUnarchive:ft,workspaces:V,archivedSessionIds:le,archivedFilter:_e,query:Ue,remote:We,resultLimit:x,t:I}))]}),e&&/* @__PURE__ */ (0,o.jsx)(Bn,{list:z,refreshSessions:P,loadMoreSessions:ee,t:I}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:tt!==null,onClose:J,closeLabel:I(`close`),title:I(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:at,onClick:J,children:I(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:dt,onClick:Y,children:I(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:$.renameInput,value:rt,"aria-label":I(`field.workspaceName`),"data-modal-autofocus":!0,disabled:at,onFocus:e=>{e.target.select()},onChange:e=>{it(e.target.value),ct(null)},onCompositionStart:()=>{Xe.current=!0},onCompositionEnd:()=>{Xe.current=!1},onKeyDown:e=>{e.key===`Enter`&&!Xe.current&&(e.preventDefault(),Y())}}),ut&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:I(`conflict.named`,{name:lt})}),st!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:st})]}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:pt!==null,onClose:xt,closeLabel:I(`close`),title:I(`delete.workspace`),...pt===null?{}:{description:I(`delete.desc`,{name:pt.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:ht,onClick:xt,children:I(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.deleteAction,disabled:ht,onClick:St,children:I(`delete.workspace`)})]}),children:[ht&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.deleteStatus,role:`status`,children:I(`delete.pending`)}),yt!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:yt})]}),R.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:I(R.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:N},R.forkError.seq)]})}function dr({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:r,archiveSession:i,unarchiveSession:s,t:c}){let[,l]=n(),u=r(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?s:i)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function fr({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:r,t:i}){let s=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(s?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(s?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(s?r:n)(e)},children:s?/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16})})})}function pr({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(mr,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function mr({request:e,stopAndArchiveSession:t,onSettle:n,t:r}){let[i,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=()=>{i||n()};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:r(`close`),title:r(`archive.confirm.title`),description:r(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:d,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.deleteAction,disabled:i,onClick:()=>{c(!0),u(null),t(e.sessionId,e.children).then(()=>{c(!1),n()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},children:r(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`ul`,{className:$.archiveActivity,"aria-label":r(`archive.confirm.activity`),children:[e.runningThreads?.map(e=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:r(`archive.confirm.thread`,{title:e.title})},e.id)),e.activity.map((e,t)=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:hr(e,r)},`${e.kind}-${String(t)}`))]}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:l})]})}function hr(e,t){let n=e.items??[],r=n.length,i=n.map(e=>e.label??e.id).join(t(`archive.confirm.listSeparator`)),a=r===1?`one`:`other`;switch(e.kind){case`turn`:return t(`archive.confirm.turn`);case`subagent`:return t(`archive.confirm.subagents.${a}`,{n:r,names:i});case`job`:return t(`archive.confirm.jobs.${a}`,{n:r,names:i});case`schedule`:return t(`archive.confirm.schedules.${a}`,{n:r,names:i});default:return t(`archive.confirm.other.${a}`,{kind:e.kind,n:r})}}function gr({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(_r,{request:n,...t},n.sessionId):null}function _r({request:e,choose:t,dismiss:n,t:r}){let[i,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(!1),p=(0,s.useRef)(!1),m=async n=>{if(!p.current){p.current=!0,u(!0),f(!1);try{await t(e,n,i)}catch{f(!0)}finally{p.current=!1,u(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,title:r(`archive.children.title`),description:r(`archive.children.description`,{title:e.title}),closeLabel:r(`close`),onClose:()=>{p.current||n()},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:l,onClick:()=>void m(!1),children:r(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.deleteAction,disabled:l,onClick:()=>void m(!0),children:r(`archive.children.include`,{n:e.children.length})})]}),children:[/* @__PURE__ */ (0,o.jsx)(`ul`,{className:$.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))}),/* @__PURE__ */ (0,o.jsxs)(`label`,{children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`checkbox`,checked:i,disabled:l,onChange:({target:e})=>c(e.checked)}),r(`archive.children.remember`)]}),d&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:r(`archive.children.preferenceFailed`)})]})}function vr(e,t){let n,r;return{getSnapshot:()=>{let i=e.getSnapshot();return(r===void 0||i!==n)&&(n=i,r=t(i)),r},subscribe:t=>e.subscribe(t)}}function yr({sessionId:e,useNativeThreads:t,useSectionWorkspace:n,useMenuOpenState:r,requestMove:i,t:s}){let[,c]=r(),l=t(t=>t.has(e)),u=n(e=>e),d=u.threadSections;return!l||!d?.length||u.pinnedSessionIds.includes(e)||u.archivedSessionIds.includes(e)?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),onSelect:()=>{c(!1),i({sessionId:e,sections:d})},children:s(`menu.moveToSection`)})}function br({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(xr,{request:n,...t},n.sessionId):null}function xr({request:e,dismiss:t,move:n,t:r}){let i=e.sections.find(t=>t.threadIds.includes(e.sessionId))?.id??``,[c,l]=(0,s.useState)(i),[u,d]=(0,s.useState)(!1),[f,p]=(0,s.useState)(!1),m=(0,s.useRef)(!1),h=()=>{m.current||t()},g=async()=>{if(!(m.current||c===i)){m.current=!0,d(!0),p(!1);try{await n(e.sessionId,c||null),t()}catch{p(!0)}finally{m.current=!1,d(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,title:r(`menu.moveToSection`),closeLabel:r(`close`),onClose:h,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:u,onClick:h,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:u||c===i,onClick:()=>void g(),children:r(`section.move`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`select`,{className:$.renameInput,"aria-label":r(`section.destination`),value:c,disabled:u,"data-modal-autofocus":!0,onChange:({target:e})=>l(e.value),children:[/* @__PURE__ */ (0,o.jsx)(`option`,{value:``,children:r(`section.unsectioned`)}),e.sections.map(({id:e,name:t})=>/* @__PURE__ */ (0,o.jsx)(`option`,{value:e,children:t},e))]}),f&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:r(`section.moveFailed`)})]})}function Sr({sessionId:e,useMenuOpenState:t,useShortcuts:n,forkSession:r,t:i}){let[,s]=t(),c=n(e=>e.find(e=>e.id===`session.fork`));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:c,icon:/* @__PURE__ */ (0,o.jsx)(a.IconBranchOutlineRegular,{}),onSelect:()=>{s(!1),r(e)},children:i(`menu.fork`)})}function Cr({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&x(n)!==void 0}),[,c]=n();return s?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),r(e)},children:i(`menu.copySessionLink`)}):null}function wr({sessionId:e,usePinned:t,useArchived:n}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e))}}function Tr(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:s}=e,[,c]=n(),{pinned:l,archived:u}=wr(e);return u?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:l?/* @__PURE__ */ (0,o.jsx)(a.IconPinFillRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?i:r)(t)},children:s(l?`menu.unpinSession`:`menu.pinSession`)})}function Er(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:s,archived:c}=wr(e);return c?null:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(s?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(s?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(s?r:n)(t)},children:s?/* @__PURE__ */ (0,o.jsx)(a.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:16})})})}function Dr({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:r,requestSessionRename:i,t:s}){let[,c]=n(),l=r(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),i(e,t)},children:s(`rename`)})}function Or({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(kr,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function kr({request:e,renameSession:t,onSettle:n,t:r}){let[i,c]=(0,s.useState)(e.currentTitle),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(!1),m=i.trim(),h=l||m===``,g=()=>{l||n()},_=()=>{h||(u(!0),f(null),t(e.sessionId,m).then(()=>{u(!1),n()}).catch(e=>{u(!1),f(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:r(`close`),title:r(`rename.session.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:l,onClick:g,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:h,onClick:_,children:r(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:$.renameInput,value:i,"aria-label":r(`field.sessionName`),"data-modal-autofocus":!0,disabled:l,onFocus:e=>{e.target.select()},onChange:e=>{c(e.target.value),f(null)},onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:e=>{e.key===`Enter`&&!p.current&&(e.preventDefault(),_())}}),d!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.renameError,role:`alert`,children:d})]})}let Ar=6e3;function jr({useToast:e,useStore:t,dismissToast:n,undoArchive:r,showArchived:i,t:s}){let c=e(e=>e),l=t(e=>(e.archivedFilter??`default`)!=="default");if(c===null)return null;if(c.kind===`archived`||c.kind===`stoppedAndArchived`){let{sessionId:e}=c;return/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:c.failedChildren?s(`archive.children.partial`,{n:c.failedChildren}):s(c.kind===`archived`?`toast.archived`:`toast.stoppedAndArchived`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{})}:{tone:`success`},holdMs:Ar,actions:[{label:s(`toast.archivedUndo`),onClick:()=>{n(),r(e)}},...l?[]:[{prefix:s(`toast.archivedOr`),label:s(`toast.archivedFilter`),onClick:()=>{n(),i()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:s(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),holdMs:Ar,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:Mr(c,s),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function Mr(e,t){switch(e.kind){case`archiveFailed`:return t(`toast.archiveFailed`,{message:e.message});case`unarchiveFailed`:return t(`toast.unarchiveFailed`,{message:e.message});case`pinFailed`:return t(`toast.pinFailed`,{message:e.message});case`unpinFailed`:return t(`toast.unpinFailed`,{message:e.message});case`defaultWorkspaceFailed`:return t(`defaultWorkspace.failed`);case`archivedNotOpenable`:return t(`toast.archivedNotOpenable`);case`sessionLinkCopied`:return t(`toast.sessionLinkCopied`);case`sessionLinkCopyFailed`:return t(`toast.sessionLinkCopyFailed`);case`recentVisitsStorageFailed`:return t(`recent.cache.error`);
|
|
22
22
|
/* v8 ignore next 2 -- closed-union backstop; only reached if a notice kind is forged */
|
|
23
|
-
default:return _(e)}}let hr={"host.local":`本机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"defaultWorkspace.failed":`无法创建默认工作区,请通过“选择工作区”选择文件夹`,"draft.workspaceRequired":`请先选择工作区`,"draft.initializationFailed":`暂时无法填入草稿,请稍后重试`,"recent.navigation":`会话标签`,"recent.expand":`展开会话标签栏`,"recent.collapse":`收起会话标签栏`,"recent.settings.title":`显示会话标签`,"recent.settings.mobile":`移动端`,"recent.settings.description":`在手机会话顶部显示可关闭的标签栏。`,"recent.settings.error":`无法在此浏览器中保存设置,已保留原设置。`,"recent.timeout.title":`自动关闭闲置标签`,"recent.timeout.off":`不自动关闭`,"recent.timeout.minutes":`{n} 分钟`,"recent.timeout.hours":`{n} 小时`,"recent.timeout.default":`{value}(默认)`,"recent.close":`关闭标签“{name}”`,"recent.closeHint":`仅关闭标签,不删除会话或停止任务`,"recent.closeFailed":`未能关闭标签,请重试。`,"recent.clear":`清空`,"recent.clearAll":`清空所有会话标签`,"recent.clearAllHint":`关闭所有标签,不删除会话或停止任务`,"recent.cache.error":`无法读取或保存会话标签。仍可在本页切换会话,刷新后标签可能丢失。`,"group.ungrouped":`最近`,"session.new":`新会话`,"session.untitled":`未命名`,"session.backToList":`返回会话列表`,"shortcut.noSession":`请先选择一个会话`,"shortcut.noPicker":`目录选择器不可用`,"shortcut.directoryBusy":`正在选择或添加工作区`,"shortcut.noCompletedTurn":`当前会话没有已结束的轮次`,"shortcut.forkFailed":`无法分叉会话,请重试`,"section.workspaces":`工作区`,"section.sessions":`会话`,"section.pinned":`置顶`,"viewOptions.label":`视图选项`,"groupBy.label":`分组方式`,"groupBy.workspace":`按工作区`,"groupBy.workspaceTree":`按工作区树`,"groupBy.flat":`单列表`,"orderBy.label":`排序方式`,"orderBy.manual":`手动排序`,"orderBy.updated":`最近更新`,"filterBy.label":`筛选会话`,"viewOptions.hideArchived":`隐藏已归档`,"viewOptions.showArchived":`全部对话(显示已归档)`,"viewOptions.onlyArchived":`仅显示已归档`,"sessions.expand":`展开显示`,"sessions.collapse":`收起`,"sessions.loading":`正在加载历史会话…`,"sessions.expandMore":`展开显示`,"sessions.retry":`重试`,"sessions.notLoaded":`已加载的会话中暂无匹配项,可按需加载更早会话`,"workspaces.expand":`展开显示`,"empty.none":`暂无会话`,"empty.noneArchived":`暂无已归档会话`,"empty.viewOthers":`查看其他会话`,"empty.noMatches":`无匹配结果`,"workspace.add":`添加工作区`,"search.sessions.aria":`搜索会话`,"search.placeholder":`搜索会话名称`,"search.clear":`清除搜索`,"search.results.aria":`搜索结果`,"search.pending":`正在搜索会话历史…`,"search.noMatches":`无匹配会话`,"search.hasMore":`仅显示前 {n} 条结果,请缩小搜索范围。`,"menu.addWorkspace":`添加工作区…`,"menu.noWorkspace":`不选择工作区`,"picker.loading":`正在加载工作区…`,"conflict.named":`已存在名为“{name}”的工作区。`,"folderError.title":`无法打开文件夹`,"folderError.retry":`重新选择`,rename:`重命名`,"rename.workspace.title":`重命名工作区`,"rename.session.title":`重命名会话`,"field.workspaceName":`工作区名称`,"field.sessionName":`会话名称`,"delete.workspace":`删除工作区`,"delete.desc":`将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。`,"delete.pending":`正在删除工作区…`,"menu.copySessionLink":`复制会话链接`,"menu.referenceSession":`引用会话`,"menu.referenceSessionFailed":`未加入草稿:编辑位置或会话已失效`,"toast.sessionLinkCopied":`已复制`,"toast.sessionLinkCopyFailed":`复制会话链接失败`,"menu.fork":`分叉会话`,"menu.archiveSession":`归档会话`,"menu.unarchiveSession":`取消归档`,"threadTree.style.title":`会话数的展示方式`,"threadTree.style.promptTitle":`选择会话数的展示方式`,"threadTree.style.description":`父会话收起时,如何显示子会话的状态。`,"threadTree.style.summary":`详细`,"threadTree.style.ring":`简洁`,"threadTree.style.summarySubtitle":`显示数量与状态`,"threadTree.style.ringSubtitle":`图标外圈显示状态`,"threadTree.style.hint":`可随时在“视图选项”或“设置”中修改。`,"threadTree.style.later":`稍后`,"threadTree.style.error":`无法保存样式,请重试;已保留原设置。`,"threadTree.style.samplePending":`有子会话等待批准`,"threadTree.style.sampleRunning":`有子会话正在运行`,"threadTree.style.sampleUnread":`有子会话未读完成`,"threadTree.style.sampleRead":`子会话都已读`,"threadTree.expand":`展开 {n} 个子会话`,"threadTree.collapse":`收起 {n} 个子会话`,"threadTree.children":`{n} 个子会话`,"threadTree.expandSummary":`{title},{summary},展开`,"threadTree.running":`{n} 运行中`,"threadTree.pending":`{n} 待批准`,"threadTree.completed":`{n} 未读`,"archive.confirm.thread":`正在运行的会话:{title}`,"menu.pinSession":`置顶会话`,"menu.unpinSession":`取消置顶`,"row.archived":`已归档`,"row.pinned":`已置顶`,"toast.archivedNotOpenable":`已归档对话暂时无法查看,请取消归档后查看`,"toast.archived":`会话已归档,可`,"toast.stoppedAndArchived":`已停止并归档,可`,"archive.confirm.title":`停止并归档此会话?`,"archive.confirm.desc":`“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。`,"archive.confirm.activity":`将被停止的工作`,"archive.confirm.turn":`进行中的回合`,"archive.confirm.subagents.one":`{n} 个运行中的子智能体:{names}`,"archive.confirm.subagents.other":`{n} 个运行中的子智能体:{names}`,"archive.confirm.jobs.one":`{n} 个后台任务:{names}`,"archive.confirm.jobs.other":`{n} 个后台任务:{names}`,"archive.confirm.schedules.one":`{n} 条定时提醒:{names}`,"archive.confirm.schedules.other":`{n} 条定时提醒:{names}`,"archive.confirm.other.one":`{n} 项其他工作({kind})`,"archive.confirm.other.other":`{n} 项其他工作({kind})`,"archive.confirm.listSeparator":`、`,"archive.confirm.action":`停止并归档`,"archive.confirm.pending":`正在停止并归档…`,"toast.archivedUndo":`撤销`,"toast.archivedOr":`或`,"toast.archivedFilter":`筛选已归档会话`,"toast.archiveFailed":`归档未确认,请检查会话状态:{message}`,"toast.unarchiveFailed":`取消归档未确认,请刷新后检查:{message}`,"toast.pinFailed":`置顶未确认,请刷新后检查:{message}`,"toast.unpinFailed":`取消置顶未确认,请刷新后检查:{message}`,"toast.createFailed":`新建会话失败:{message}`,"toast.forkFailed":`分叉未完成:{message}`,"sessions.count.one":`{n} 个会话`,"sessions.count.other":`{n} 个会话`,"actions.workspace.aria":`工作区“{name}”的操作`,"actions.session.aria":`会话“{name}”的操作`,"actions.archive":`归档会话`,"actions.unarchive":`取消归档`,"actions.pin":`置顶会话`,"actions.unpin":`取消置顶`,"actions.newSession":`新会话`,"actions.newSession.aria":`在“{name}”中新建会话`,"status.running":`进行中`,"status.subagentsRunning.one":`{n} 个子智能体运行中`,"status.subagentsRunning.other":`{n} 个子智能体运行中`,"status.idle":`空闲`,"status.waitingApproval":`等待审批`,"status.planReview":`计划待审`,"status.waitingAnswer":`等待回答`,"status.compact.approval":`待审批`,"status.compact.planReview":`计划待审`,"status.compact.answer":`待回答`,"status.completed":`已完成`,"hover.created":`创建于 {time}`,"hover.copied":`已复制`,"date.ymd":`{y}年{m}月{d}日`,"time.now":`刚刚`,"time.minutes":`{n}分钟`,"time.hours":`{n}小时`,"time.days":`{n}天`,"time.months":`{n}个月`,"time.years":`{n}年`,"time.ago":`{t}前`},gr={"host.local":`Local`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"defaultWorkspace.failed":`Unable to create default workspace. Use Choose workspace to select a folder.`,"draft.workspaceRequired":`Choose a workspace first.`,"draft.initializationFailed":`Could not fill the draft. Please try again shortly.`,"recent.navigation":`Session tabs`,"recent.expand":`Expand session tabs`,"recent.collapse":`Collapse session tabs`,"recent.settings.title":`Show session tabs`,"recent.settings.mobile":`Mobile`,"recent.settings.description":`Show closable tabs above phone conversations.`,"recent.settings.error":`Could not save in this browser. The previous setting is unchanged.`,"recent.timeout.title":`Automatically close idle tabs`,"recent.timeout.off":`Never`,"recent.timeout.minutes":`{n} minutes`,"recent.timeout.hours":`{n} hours`,"recent.timeout.default":`{value} (default)`,"recent.close":`Close tab “{name}”`,"recent.closeHint":`Close only this tab, without deleting the session or stopping tasks`,"recent.closeFailed":`Could not close the tab. Please try again.`,"recent.clear":`Clear`,"recent.clearAll":`Clear all session tabs`,"recent.clearAllHint":`Close all tabs without deleting sessions or stopping tasks`,"recent.cache.error":`Could not read or save session tabs. Switching still works in this page; tabs may be lost on reload.`,"group.ungrouped":`Recents`,"session.new":`New Session`,"session.untitled":`Untitled`,"session.backToList":`Back to session list`,"shortcut.noSession":`Select a session first`,"shortcut.noPicker":`Directory picker unavailable`,"shortcut.directoryBusy":`Selecting or adding a workspace`,"shortcut.noCompletedTurn":`This session has no completed turn`,"shortcut.forkFailed":`Could not fork the session. Try again.`,"section.workspaces":`Workspaces`,"section.sessions":`Sessions`,"section.pinned":`Pinned`,"viewOptions.label":`View options`,"groupBy.label":`Group by`,"groupBy.workspace":`WorkSpace`,"groupBy.workspaceTree":`Workspace Tree`,"groupBy.flat":`In one list`,"orderBy.label":`Order by`,"orderBy.manual":`Manual`,"orderBy.updated":`Last updated`,"filterBy.label":`Filter sessions`,"viewOptions.hideArchived":`Hide archived`,"viewOptions.showArchived":`All conversations (show archived)`,"viewOptions.onlyArchived":`Archived only`,"sessions.expand":`Show {n} more`,"sessions.collapse":`Show less`,"sessions.loading":`Loading conversation history…`,"sessions.expandMore":`Show more`,"sessions.retry":`Retry`,"sessions.notLoaded":`No matching loaded conversations. Older conversations can be loaded on demand.`,"workspaces.expand":`Show all workspaces`,"empty.none":`No sessions yet`,"empty.noneArchived":`No archived sessions yet`,"empty.viewOthers":`View other sessions`,"empty.noMatches":`No matches`,"workspace.add":`Add workspace`,"search.sessions.aria":`Search sessions`,"search.placeholder":`Search session names`,"search.clear":`Clear search`,"search.results.aria":`Search results`,"search.pending":`Searching session history…`,"search.noMatches":`No matching sessions`,"search.hasMore":`Showing the first {n} results. Narrow your search.`,"menu.addWorkspace":`Add workspace…`,"menu.noWorkspace":`No workspace`,"picker.loading":`Loading workspaces…`,"conflict.named":`A workspace named “{name}” already exists.`,"folderError.title":`Couldn’t open folder`,"folderError.retry":`Choose again`,rename:`Rename`,"rename.workspace.title":`Rename workspace`,"rename.session.title":`Rename session`,"field.workspaceName":`Workspace name`,"field.sessionName":`Session name`,"delete.workspace":`Delete workspace`,"delete.desc":`This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.`,"delete.pending":`Deleting workspace…`,"menu.copySessionLink":`Copy session link`,"menu.referenceSession":`Reference session`,"menu.referenceSessionFailed":`Not added: the editing position or session is no longer available`,"toast.sessionLinkCopied":`Copied`,"toast.sessionLinkCopyFailed":`Could not copy session link`,"menu.fork":`Fork session`,"menu.archiveSession":`Archive session`,"menu.unarchiveSession":`Unarchive session`,"threadTree.style.title":`Session count display`,"threadTree.style.promptTitle":`Choose how to display session counts`,"threadTree.style.description":`How a collapsed parent shows its child sessions' status.`,"threadTree.style.summary":`Detailed`,"threadTree.style.ring":`Compact`,"threadTree.style.summarySubtitle":`Count and status`,"threadTree.style.ringSubtitle":`Icon status ring`,"threadTree.style.hint":`Change this anytime in View options or Settings.`,"threadTree.style.later":`Later`,"threadTree.style.error":`Could not save the style. Previous setting kept; please retry.`,"threadTree.style.samplePending":`Child awaiting approval`,"threadTree.style.sampleRunning":`Child running`,"threadTree.style.sampleUnread":`Child finished, unread`,"threadTree.style.sampleRead":`All read`,"threadTree.expand":`Expand {n} child sessions`,"threadTree.collapse":`Collapse {n} child sessions`,"threadTree.children":`{n} child sessions`,"threadTree.expandSummary":`{title}, {summary}, expand`,"threadTree.running":`{n} running`,"threadTree.pending":`{n} needs approval`,"threadTree.completed":`{n} unread`,"archive.confirm.thread":`Running session: {title}`,"menu.pinSession":`Pin session`,"menu.unpinSession":`Unpin session`,"row.archived":`Archived`,"row.pinned":`Pinned`,"toast.archivedNotOpenable":`Archived sessions cannot be opened. Unarchive it to view.`,"toast.archived":`Session archived. You can `,"toast.stoppedAndArchived":`Session stopped and archived. You can `,"archive.confirm.title":`Stop and archive this session?`,"archive.confirm.desc":`“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.`,"archive.confirm.activity":`Work that will be stopped`,"archive.confirm.turn":`The turn in progress`,"archive.confirm.subagents.one":`{n} running subagent: {names}`,"archive.confirm.subagents.other":`{n} running subagents: {names}`,"archive.confirm.jobs.one":`{n} background job: {names}`,"archive.confirm.jobs.other":`{n} background jobs: {names}`,"archive.confirm.schedules.one":`{n} scheduled reminder: {names}`,"archive.confirm.schedules.other":`{n} scheduled reminders: {names}`,"archive.confirm.other.one":`{n} other item of work ({kind})`,"archive.confirm.other.other":`{n} other items of work ({kind})`,"archive.confirm.listSeparator":`, `,"archive.confirm.action":`Stop and archive`,"archive.confirm.pending":`Stopping and archiving…`,"toast.archivedUndo":`undo`,"toast.archivedOr":` or `,"toast.archivedFilter":`filter archived sessions`,"toast.archiveFailed":`Archive not confirmed. Check session status: {message}`,"toast.unarchiveFailed":`Unarchive not confirmed. Refresh to check: {message}`,"toast.pinFailed":`Pin not confirmed. Refresh to check: {message}`,"toast.unpinFailed":`Unpin not confirmed. Refresh to check: {message}`,"toast.createFailed":`New session failed: {message}`,"toast.forkFailed":`Fork did not complete: {message}`,"sessions.count.one":`{n} session`,"sessions.count.other":`{n} sessions`,"actions.workspace.aria":`Workspace actions for {name}`,"actions.session.aria":`Session actions for {name}`,"actions.archive":`Archive`,"actions.unarchive":`Unarchive`,"actions.pin":`Pin`,"actions.unpin":`Unpin`,"actions.newSession":`New session`,"actions.newSession.aria":`New session in {name}`,"status.running":`Running`,"status.subagentsRunning.one":`{n} subagent running`,"status.subagentsRunning.other":`{n} subagents running`,"status.idle":`Idle`,"status.waitingApproval":`Waiting for approval`,"status.planReview":`Plan awaiting review`,"status.waitingAnswer":`Waiting for answer`,"status.compact.approval":`Approval`,"status.compact.planReview":`Plan review`,"status.compact.answer":`Answer`,"status.completed":`Completed`,"hover.created":`Created {time}`,"hover.copied":`Copied`,"date.ymd":`{y}-{m}-{d}`,"time.now":`now`,"time.minutes":`{n}min`,"time.hours":`{n}h`,"time.days":`{n}d`,"time.months":`{n}mo`,"time.years":`{n}y`,"time.ago":`{t} ago`};function _r(e,t){let n=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){let r=ne(t,e);if(r===null)continue;let i=n.get(r)??[];i.push(t.id),n.set(r,i)}let r=/* @__PURE__ */ new Set([t]),i=[...n.get(t)??[]];for(let e=i.pop();e!==void 0;e=i.pop())r.has(e)||(r.add(e),i.push(...n.get(e)??[]));return r.delete(t),r}function vr(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&!e.projectionValues?.remoteHost&&e.projectionValues?.threadTreeParent!==void 0}function yr(e,t){let n=[t,..._r(e,t)],r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Map;for(let t=n.pop();t!==void 0;t=n.pop()){if(r.has(t))continue;r.add(t);let a=e.projectionsBySession[f(t)]?.values.subagentCatalog??[];for(let t of a)e.byId[t.id]?.running&&i.set(t.id,{id:t.id,...t.label===void 0?{}:{label:t.label}}),n.push(t.id)}return[...i.values()]}function br(e,t){let n=/* @__PURE__ */ new Set([t,..._r(e,t)]);return Object.values(e.byId).filter(e=>n.has(e.id)&&e.running).map(e=>({id:e.id,title:e.title?.trim()||e.displayTitle}))}let xr=()=>!1,Sr=()=>()=>{};function Cr(e){let t=(0,o.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,s.jsx)(wr,{...e,closeDrawer:t?.close},e.sessionId)}function wr({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,a.useState)(()=>t(e)),l=(0,a.useSyncExternalStore)(c?.subscribe??Sr,c?.getSnapshot??xr),u=(0,a.useRef)(!1),[d,f]=(0,a.useState)(!1),[,p]=r();return c===void 0?null:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:/* @__PURE__ */ (0,s.jsx)(o.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n?.();return}}catch{}f(!0)}},children:i(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,s.jsx)(`div`,{role:`status`,children:i(`menu.referenceSessionFailed`)})]})}let Tr=`workspace`,Er=[`slots`,`sessions`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function Dr(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=de(),a=i.create();a.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((a.getSnapshot().archivedFilter??`default`)!=="default")},n=a.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let o={...i,create:()=>a},s=(0,r.createSnapshotStore)(null),d=0,f=e=>{s.set({...e,seq:++d})},p=new De(e,e.remote.directoryPicker,n,t,a.actions,f),m=Mt(e);Ct(e,p,m),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(Tr,{zh:hr,en:gr}),`ui-workspace: dictionaries`);let h=l(),g=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},_=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),v=_(`sidebar.workspaces.directoryFlow`),y={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},b=_(`conversation.hero.workspace.directoryFlow`),C=e=>{p.openSession(e)},w=rr(n.list,e=>new Set(e.pinnedSessionIds)),T=rr(n.list,e=>new Set(e.archivedSessionIds)),E=rr(h.state,e=>e.renameTarget),D=(0,r.createSnapshotStore)(null),O=h.rename,k=e=>{p.unarchiveSession(e).catch(e=>{f({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},A=async(e,n)=>{let r=await t.using(e,{source:`workspaceOperation`},e=>e.binding.session.rename(n));if(!r.ok)throw Error(r.error.message)},j=()=>({hooks:{pinned:w,archived:T},pinSession:e=>{p.pinSession(e).catch(e=>{f({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{p.unpinSession(e).catch(e=>{f({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),M=()=>({hooks:{archived:T},archiveSession:e=>{let n=t.list.getSnapshot(),r=n.byId[e],i=br(n,e),a=yr(n,e);vr(r)&&(i.length>0||a.length>0)?D.set({sessionId:e,displayTitle:r?.displayTitle??e,activity:a.length===0?[]:[{kind:`subagent`,items:a}],runningThreads:i}):p.archiveSession(e).then(()=>{f({kind:`archived`,sessionId:e})}).catch(n=>{let r=Or(n);if(r===void 0){f({kind:`archiveFailed`,message:n instanceof Error?n.message:String(n)});return}let i=t.list.getSnapshot().byId[e]?.displayTitle??e;D.set({sessionId:e,displayTitle:i,activity:r})})},unarchiveSession:k});u(e,p,h,M().archiveSession);let N=()=>({hooks:{archiveRequest:D},settleSessionArchive:()=>{D.set(null)},stopAndArchiveSession:async e=>{await p.archiveSession(e,{stopActivity:!0}),f({kind:`stoppedAndArchived`,sessionId:e})}}),P=()=>({forkSession:t=>{p.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>p.openSession(e)).catch(e=>{f({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),F=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:x(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(S(r)),f({kind:`sessionLinkCopied`})}catch{f({kind:`sessionLinkCopyFailed`})}})()}}),I=()=>({requestSessionRename:O}),L=()=>({hooks:{renameRequest:E},settleSessionRename:h.closeRename,renameSession:A}),ee=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:k,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),te=()=>({startSession:e=>{p.startSession(e)},open:C,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:g,refreshSessions:()=>{t.refresh()},loadMoreSessions:()=>{t.loadMore()},searchResultLimit:t.searchResultLimit,requestSessionRename:O,notifyArchivedNotOpenable:()=>{f({kind:`archivedNotOpenable`})},renameWorkspace:async(e,t)=>{await n.rename(e,t)},deleteWorkspace:async e=>{await n.delete(e)},insertWorkspaceBefore:async(e,t)=>{await n.insertBefore(e,t)},unarchiveSession:async e=>{await p.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestSearch:h.search,requestAddWorkspace:h.add,closeAddWorkspace:h.closeAdd,setDirectoryBusy:h.directoryBusy,dismissForkError:h.dismissForkError,setThreadTreeCollapseStyle:e=>m.set(`threadTreeCollapseStyle`,e),hooks:{workspacePreferences:m,directoryFlow:v,hostInfo:y,workspaceShortcuts:h.state,shortcuts:e.shortcuts.catalog}}),R=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:b}});e.slots.inject(`sidebar.workspaces`,()=>e.slots.register({name:`sidebar.workspaces`,children:{"sidebar.workspaces.directoryFlow":{kind:`single`,scope:`root`},"sidebar.workspaces.session.menu.item":{kind:`list`,scope:`root`,inject:{hooks:{menuOpenState:c,shortcuts:e.shortcuts.catalog}}},"sidebar.workspaces.session.row.action":{kind:`list`,scope:`root`},"sidebar.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:o,inject:te,locale:Tr},Xn)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:Tr,inject:j},sr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:Tr,inject:I},lr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:Tr,inject:P},ir),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:Tr,inject:F},ar),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:Tr,inject:M},Qn)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:Tr,inject:M},$n),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:Tr,inject:j},cr)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:Tr,inject:L},ur),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:Tr,inject:N},er),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:Tr,store:o,inject:ee},pr)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:R,locale:Tr},Bn))}function Or(e){if(!(e instanceof Error)||e.name!==`WorkspaceArchiveError`)return;let{rpcError:t}=e;return t.code===`workspace/session-active`?t.details.activity:void 0}return n.ReferenceSessionMenuItem=Cr,n.apply=Dr,n.inject=Er,t.exports}});
|
|
23
|
+
default:return _(e)}}let Nr={"host.local":`本机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"defaultWorkspace.failed":`无法创建默认工作区,请通过“选择工作区”选择文件夹`,"draft.workspaceRequired":`请先选择工作区`,"draft.initializationFailed":`暂时无法填入草稿,请稍后重试`,"recent.navigation":`会话标签`,"recent.expand":`展开会话标签栏`,"recent.collapse":`收起会话标签栏`,"recent.settings.title":`显示会话标签`,"recent.settings.mobile":`移动端`,"recent.settings.description":`在手机会话顶部显示可关闭的标签栏。`,"recent.settings.error":`无法在此浏览器中保存设置,已保留原设置。`,"recent.timeout.title":`自动关闭闲置标签`,"recent.timeout.off":`不自动关闭`,"recent.timeout.minutes":`{n} 分钟`,"recent.timeout.hours":`{n} 小时`,"recent.timeout.default":`{value}(默认)`,"recent.close":`关闭标签“{name}”`,"recent.closeHint":`仅关闭标签,不删除会话或停止任务`,"recent.closeFailed":`未能关闭标签,请重试。`,"recent.clear":`清空`,"recent.clearAll":`清空所有会话标签`,"recent.clearAllHint":`关闭所有标签,不删除会话或停止任务`,"recent.cache.error":`无法读取或保存会话标签。仍可在本页切换会话,刷新后标签可能丢失。`,"group.ungrouped":`最近`,"session.new":`新会话`,"session.untitled":`未命名`,"session.backToList":`返回会话列表`,"shortcut.noSession":`请先选择一个会话`,"shortcut.noPicker":`目录选择器不可用`,"shortcut.directoryBusy":`正在选择或添加工作区`,"shortcut.noCompletedTurn":`当前会话没有已结束的轮次`,"shortcut.forkFailed":`无法分叉会话,请重试`,"section.workspaces":`工作区`,"section.sessions":`会话`,"section.pinned":`置顶`,"viewOptions.label":`视图选项`,"groupBy.label":`分组方式`,"groupBy.workspace":`按工作区`,"groupBy.workspaceTree":`按工作区树`,"groupBy.flat":`单列表`,"orderBy.label":`排序方式`,"orderBy.manual":`手动排序`,"orderBy.updated":`最近更新`,"filterBy.label":`筛选会话`,"viewOptions.hideArchived":`隐藏已归档`,"viewOptions.showArchived":`全部对话(显示已归档)`,"viewOptions.onlyArchived":`仅显示已归档`,"sessions.expand":`展开显示`,"sessions.collapse":`收起`,"sessions.loading":`正在加载历史会话…`,"sessions.expandMore":`展开显示`,"sessions.retry":`重试`,"sessions.notLoaded":`已加载的会话中暂无匹配项,可按需加载更早会话`,"workspaces.expand":`展开显示`,"empty.none":`暂无会话`,"empty.noneArchived":`暂无已归档会话`,"empty.viewOthers":`查看其他会话`,"empty.noMatches":`无匹配结果`,"workspace.add":`添加工作区`,"search.sessions.aria":`搜索会话`,"search.placeholder":`搜索会话名称`,"search.clear":`清除搜索`,"search.results.aria":`搜索结果`,"search.pending":`正在搜索会话历史…`,"search.noMatches":`无匹配会话`,"search.hasMore":`仅显示前 {n} 条结果,请缩小搜索范围。`,"menu.addWorkspace":`添加工作区…`,"menu.noWorkspace":`不选择工作区`,"picker.loading":`正在加载工作区…`,"conflict.named":`已存在名为“{name}”的工作区。`,"folderError.title":`无法打开文件夹`,"folderError.retry":`重新选择`,rename:`重命名`,"rename.workspace.title":`重命名工作区`,"rename.session.title":`重命名会话`,"field.workspaceName":`工作区名称`,"field.sessionName":`会话名称`,"delete.workspace":`删除工作区`,"delete.desc":`将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。`,"delete.pending":`正在删除工作区…`,"menu.copySessionLink":`复制会话链接`,"menu.referenceSession":`引用会话`,"menu.referenceSessionFailed":`未加入草稿:编辑位置或会话已失效`,"toast.sessionLinkCopied":`已复制`,"toast.sessionLinkCopyFailed":`复制会话链接失败`,"menu.fork":`分叉会话`,"menu.archiveSession":`归档会话`,"archive.children.title":`归档父会话`,"archive.children.description":`选择是否同时归档「{title}」下的全部子会话。`,"archive.children.parentOnly":`仅归档父会话`,"archive.children.include":`同时归档全部 {n} 个子会话`,"archive.children.remember":`记住我的选择`,"archive.children.partial":`父会话已归档,{n} 个子会话未归档。`,"archive.children.preference":`归档父会话时`,"archive.children.ask":`每次询问`,"archive.children.always":`总是归档子会话`,"archive.children.never":`从不归档子会话`,"archive.children.preferenceFailed":`无法保存归档偏好。`,"menu.moveToSection":`移动到分区`,"section.destination":`目标分区`,"section.unsectioned":`无分区`,"section.move":`移动`,"section.moveFailed":`无法移动会话。请刷新后重试。`,"menu.unarchiveSession":`取消归档`,"threadTree.style.title":`会话数的展示方式`,"threadTree.style.promptTitle":`选择会话数的展示方式`,"threadTree.style.description":`父会话收起时,如何显示子会话的状态。`,"threadTree.style.summary":`详细`,"threadTree.style.ring":`简洁`,"threadTree.style.summarySubtitle":`显示数量与状态`,"threadTree.style.ringSubtitle":`图标外圈显示状态`,"threadTree.style.hint":`可随时在“视图选项”或“设置”中修改。`,"threadTree.style.later":`稍后`,"threadTree.style.error":`无法保存样式,请重试;已保留原设置。`,"threadTree.style.samplePending":`有子会话等待批准`,"threadTree.style.sampleRunning":`有子会话正在运行`,"threadTree.style.sampleUnread":`有子会话未读完成`,"threadTree.style.sampleRead":`子会话都已读`,"threadTree.expand":`展开 {n} 个子会话`,"threadTree.collapse":`收起 {n} 个子会话`,"threadTree.children":`{n} 个子会话`,"threadTree.expandSummary":`{title},{summary},展开`,"threadTree.running":`{n} 运行中`,"threadTree.pending":`{n} 待批准`,"threadTree.completed":`{n} 未读`,"archive.confirm.thread":`正在运行的会话:{title}`,"menu.pinSession":`置顶会话`,"menu.unpinSession":`取消置顶`,"row.archived":`已归档`,"row.pinned":`已置顶`,"toast.archivedNotOpenable":`已归档对话暂时无法查看,请取消归档后查看`,"toast.archived":`会话已归档,可`,"toast.stoppedAndArchived":`已停止并归档,可`,"archive.confirm.title":`停止并归档此会话?`,"archive.confirm.desc":`“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。`,"archive.confirm.activity":`将被停止的工作`,"archive.confirm.turn":`进行中的回合`,"archive.confirm.subagents.one":`{n} 个运行中的子智能体:{names}`,"archive.confirm.subagents.other":`{n} 个运行中的子智能体:{names}`,"archive.confirm.jobs.one":`{n} 个后台任务:{names}`,"archive.confirm.jobs.other":`{n} 个后台任务:{names}`,"archive.confirm.schedules.one":`{n} 条定时提醒:{names}`,"archive.confirm.schedules.other":`{n} 条定时提醒:{names}`,"archive.confirm.other.one":`{n} 项其他工作({kind})`,"archive.confirm.other.other":`{n} 项其他工作({kind})`,"archive.confirm.listSeparator":`、`,"archive.confirm.action":`停止并归档`,"archive.confirm.pending":`正在停止并归档…`,"toast.archivedUndo":`撤销`,"toast.archivedOr":`或`,"toast.archivedFilter":`筛选已归档会话`,"toast.archiveFailed":`归档未确认,请检查会话状态:{message}`,"toast.unarchiveFailed":`取消归档未确认,请刷新后检查:{message}`,"toast.pinFailed":`置顶未确认,请刷新后检查:{message}`,"toast.unpinFailed":`取消置顶未确认,请刷新后检查:{message}`,"toast.createFailed":`新建会话失败:{message}`,"toast.forkFailed":`分叉未完成:{message}`,"sessions.count.one":`{n} 个会话`,"sessions.count.other":`{n} 个会话`,"actions.workspace.aria":`工作区“{name}”的操作`,"actions.session.aria":`会话“{name}”的操作`,"actions.archive":`归档会话`,"actions.unarchive":`取消归档`,"actions.pin":`置顶会话`,"actions.unpin":`取消置顶`,"actions.newSession":`新会话`,"actions.newSession.aria":`在“{name}”中新建会话`,"status.running":`进行中`,"status.subagentsRunning.one":`{n} 个子智能体运行中`,"status.subagentsRunning.other":`{n} 个子智能体运行中`,"status.idle":`空闲`,"status.waitingApproval":`等待审批`,"status.planReview":`计划待审`,"status.waitingAnswer":`等待回答`,"status.compact.approval":`待审批`,"status.compact.planReview":`计划待审`,"status.compact.answer":`待回答`,"status.completed":`已完成`,"hover.created":`创建于 {time}`,"hover.copied":`已复制`,"date.ymd":`{y}年{m}月{d}日`,"time.now":`刚刚`,"time.minutes":`{n}分钟`,"time.hours":`{n}小时`,"time.days":`{n}天`,"time.months":`{n}个月`,"time.years":`{n}年`,"time.ago":`{t}前`},Pr={"host.local":`Local`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"defaultWorkspace.failed":`Unable to create default workspace. Use Choose workspace to select a folder.`,"draft.workspaceRequired":`Choose a workspace first.`,"draft.initializationFailed":`Could not fill the draft. Please try again shortly.`,"recent.navigation":`Session tabs`,"recent.expand":`Expand session tabs`,"recent.collapse":`Collapse session tabs`,"recent.settings.title":`Show session tabs`,"recent.settings.mobile":`Mobile`,"recent.settings.description":`Show closable tabs above phone conversations.`,"recent.settings.error":`Could not save in this browser. The previous setting is unchanged.`,"recent.timeout.title":`Automatically close idle tabs`,"recent.timeout.off":`Never`,"recent.timeout.minutes":`{n} minutes`,"recent.timeout.hours":`{n} hours`,"recent.timeout.default":`{value} (default)`,"recent.close":`Close tab “{name}”`,"recent.closeHint":`Close only this tab, without deleting the session or stopping tasks`,"recent.closeFailed":`Could not close the tab. Please try again.`,"recent.clear":`Clear`,"recent.clearAll":`Clear all session tabs`,"recent.clearAllHint":`Close all tabs without deleting sessions or stopping tasks`,"recent.cache.error":`Could not read or save session tabs. Switching still works in this page; tabs may be lost on reload.`,"group.ungrouped":`Recents`,"session.new":`New Session`,"session.untitled":`Untitled`,"session.backToList":`Back to session list`,"shortcut.noSession":`Select a session first`,"shortcut.noPicker":`Directory picker unavailable`,"shortcut.directoryBusy":`Selecting or adding a workspace`,"shortcut.noCompletedTurn":`This session has no completed turn`,"shortcut.forkFailed":`Could not fork the session. Try again.`,"section.workspaces":`Workspaces`,"section.sessions":`Sessions`,"section.pinned":`Pinned`,"viewOptions.label":`View options`,"groupBy.label":`Group by`,"groupBy.workspace":`WorkSpace`,"groupBy.workspaceTree":`Workspace Tree`,"groupBy.flat":`In one list`,"orderBy.label":`Order by`,"orderBy.manual":`Manual`,"orderBy.updated":`Last updated`,"filterBy.label":`Filter sessions`,"viewOptions.hideArchived":`Hide archived`,"viewOptions.showArchived":`All conversations (show archived)`,"viewOptions.onlyArchived":`Archived only`,"sessions.expand":`Show {n} more`,"sessions.collapse":`Show less`,"sessions.loading":`Loading conversation history…`,"sessions.expandMore":`Show more`,"sessions.retry":`Retry`,"sessions.notLoaded":`No matching loaded conversations. Older conversations can be loaded on demand.`,"workspaces.expand":`Show all workspaces`,"empty.none":`No sessions yet`,"empty.noneArchived":`No archived sessions yet`,"empty.viewOthers":`View other sessions`,"empty.noMatches":`No matches`,"workspace.add":`Add workspace`,"search.sessions.aria":`Search sessions`,"search.placeholder":`Search session names`,"search.clear":`Clear search`,"search.results.aria":`Search results`,"search.pending":`Searching session history…`,"search.noMatches":`No matching sessions`,"search.hasMore":`Showing the first {n} results. Narrow your search.`,"menu.addWorkspace":`Add workspace…`,"menu.noWorkspace":`No workspace`,"picker.loading":`Loading workspaces…`,"conflict.named":`A workspace named “{name}” already exists.`,"folderError.title":`Couldn’t open folder`,"folderError.retry":`Choose again`,rename:`Rename`,"rename.workspace.title":`Rename workspace`,"rename.session.title":`Rename session`,"field.workspaceName":`Workspace name`,"field.sessionName":`Session name`,"delete.workspace":`Delete workspace`,"delete.desc":`This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.`,"delete.pending":`Deleting workspace…`,"menu.copySessionLink":`Copy session link`,"menu.referenceSession":`Reference session`,"menu.referenceSessionFailed":`Not added: the editing position or session is no longer available`,"toast.sessionLinkCopied":`Copied`,"toast.sessionLinkCopyFailed":`Could not copy session link`,"menu.fork":`Fork session`,"menu.archiveSession":`Archive session`,"archive.children.title":`Archive parent session`,"archive.children.description":`Choose whether to also archive all child sessions of “{title}”.`,"archive.children.parentOnly":`Archive parent only`,"archive.children.include":`Also archive all {n} child sessions`,"archive.children.remember":`Remember my choice`,"archive.children.partial":`Parent archived. {n} child sessions could not be archived.`,"archive.children.preference":`When archiving a parent session`,"archive.children.ask":`Ask each time`,"archive.children.always":`Always archive child sessions`,"archive.children.never":`Never archive child sessions`,"archive.children.preferenceFailed":`Could not save the archive preference.`,"menu.moveToSection":`Move to section`,"section.destination":`Destination section`,"section.unsectioned":`No section`,"section.move":`Move`,"section.moveFailed":`Could not move the session. Refresh and try again.`,"menu.unarchiveSession":`Unarchive session`,"threadTree.style.title":`Session count display`,"threadTree.style.promptTitle":`Choose how to display session counts`,"threadTree.style.description":`How a collapsed parent shows its child sessions' status.`,"threadTree.style.summary":`Detailed`,"threadTree.style.ring":`Compact`,"threadTree.style.summarySubtitle":`Count and status`,"threadTree.style.ringSubtitle":`Icon status ring`,"threadTree.style.hint":`Change this anytime in View options or Settings.`,"threadTree.style.later":`Later`,"threadTree.style.error":`Could not save the style. Previous setting kept; please retry.`,"threadTree.style.samplePending":`Child awaiting approval`,"threadTree.style.sampleRunning":`Child running`,"threadTree.style.sampleUnread":`Child finished, unread`,"threadTree.style.sampleRead":`All read`,"threadTree.expand":`Expand {n} child sessions`,"threadTree.collapse":`Collapse {n} child sessions`,"threadTree.children":`{n} child sessions`,"threadTree.expandSummary":`{title}, {summary}, expand`,"threadTree.running":`{n} running`,"threadTree.pending":`{n} needs approval`,"threadTree.completed":`{n} unread`,"archive.confirm.thread":`Running session: {title}`,"menu.pinSession":`Pin session`,"menu.unpinSession":`Unpin session`,"row.archived":`Archived`,"row.pinned":`Pinned`,"toast.archivedNotOpenable":`Archived sessions cannot be opened. Unarchive it to view.`,"toast.archived":`Session archived. You can `,"toast.stoppedAndArchived":`Session stopped and archived. You can `,"archive.confirm.title":`Stop and archive this session?`,"archive.confirm.desc":`“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.`,"archive.confirm.activity":`Work that will be stopped`,"archive.confirm.turn":`The turn in progress`,"archive.confirm.subagents.one":`{n} running subagent: {names}`,"archive.confirm.subagents.other":`{n} running subagents: {names}`,"archive.confirm.jobs.one":`{n} background job: {names}`,"archive.confirm.jobs.other":`{n} background jobs: {names}`,"archive.confirm.schedules.one":`{n} scheduled reminder: {names}`,"archive.confirm.schedules.other":`{n} scheduled reminders: {names}`,"archive.confirm.other.one":`{n} other item of work ({kind})`,"archive.confirm.other.other":`{n} other items of work ({kind})`,"archive.confirm.listSeparator":`, `,"archive.confirm.action":`Stop and archive`,"archive.confirm.pending":`Stopping and archiving…`,"toast.archivedUndo":`undo`,"toast.archivedOr":` or `,"toast.archivedFilter":`filter archived sessions`,"toast.archiveFailed":`Archive not confirmed. Check session status: {message}`,"toast.unarchiveFailed":`Unarchive not confirmed. Refresh to check: {message}`,"toast.pinFailed":`Pin not confirmed. Refresh to check: {message}`,"toast.unpinFailed":`Unpin not confirmed. Refresh to check: {message}`,"toast.createFailed":`New session failed: {message}`,"toast.forkFailed":`Fork did not complete: {message}`,"sessions.count.one":`{n} session`,"sessions.count.other":`{n} sessions`,"actions.workspace.aria":`Workspace actions for {name}`,"actions.session.aria":`Session actions for {name}`,"actions.archive":`Archive`,"actions.unarchive":`Unarchive`,"actions.pin":`Pin`,"actions.unpin":`Unpin`,"actions.newSession":`New session`,"actions.newSession.aria":`New session in {name}`,"status.running":`Running`,"status.subagentsRunning.one":`{n} subagent running`,"status.subagentsRunning.other":`{n} subagents running`,"status.idle":`Idle`,"status.waitingApproval":`Waiting for approval`,"status.planReview":`Plan awaiting review`,"status.waitingAnswer":`Waiting for answer`,"status.compact.approval":`Approval`,"status.compact.planReview":`Plan review`,"status.compact.answer":`Answer`,"status.completed":`Completed`,"hover.created":`Created {time}`,"hover.copied":`Copied`,"date.ymd":`{y}-{m}-{d}`,"time.now":`now`,"time.minutes":`{n}min`,"time.hours":`{n}h`,"time.days":`{n}d`,"time.months":`{n}mo`,"time.years":`{n}y`,"time.ago":`{t} ago`};function Fr(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!Ir(t))continue;let i=re(t,e)??(n?t.projectionValues?.archiveForkParent:null);if(!i)continue;let a=r.get(i)??[];a.push(t.id),r.set(i,a)}let i=/* @__PURE__ */ new Set([t]),a=[...r.get(t)??[]];for(let e=a.pop();e!==void 0;e=a.pop())i.has(e)||(i.add(e),a.push(...r.get(e)??[]));return i.delete(t),i}function Ir(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&!e.projectionValues?.remoteHost&&e.projectionValues?.threadTreeParent!==void 0}function Lr(e,t,n){let r=[];for(let i of Fr(e,t,!0)){let t=f(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function Rr(e,t,n=Fr(e,t)){let r=[t,...n],i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map;for(let t=r.pop();t!==void 0;t=r.pop()){if(i.has(t))continue;i.add(t);let n=e.projectionsBySession[f(t)]?.values.subagentCatalog??[];for(let t of n)e.byId[t.id]?.running&&a.set(t.id,{id:t.id,...t.label===void 0?{}:{label:t.label}}),r.push(t.id)}return[...a.values()]}let zr=()=>!1,Br=()=>()=>{};function Vr(e){let t=(0,a.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(Hr,{...e,closeDrawer:t?.close},e.sessionId)}function Hr({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??Br,c?.getSnapshot??zr),u=(0,s.useRef)(!1),[d,f]=(0,s.useState)(!1),[,p]=r();return c===void 0?null:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n?.();return}}catch{}f(!0)}},children:i(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:i(`menu.referenceSessionFailed`)})]})}let Ur=`workspace`,Wr=[`slots`,`sessions`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function Gr(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=fe(),a=i.create();a.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((a.getSnapshot().archivedFilter??`default`)!=="default")},n=a.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let o={...i,create:()=>a},s=(0,r.createSnapshotStore)(null),d=0,f=e=>{s.set({...e,seq:++d})},p=new De(e,e.remote.directoryPicker,n,t,a.actions,f),m=Vt(e);At(e,p,m),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(Ur,{zh:Nr,en:Pr}),`ui-workspace: dictionaries`);let h=l(),g=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},_=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),v=_(`sidebar.workspaces.directoryFlow`),y={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},b=_(`conversation.hero.workspace.directoryFlow`),C=e=>{p.openSession(e)},w=vr(n.list,e=>new Set(e.pinnedSessionIds)),T=vr(n.list,e=>new Set(e.archivedSessionIds)),E=vr(h.state,e=>e.renameTarget),D=(0,r.createSnapshotStore)(null),O=(0,r.createSnapshotStore)(null),k=h.rename,A=e=>{p.unarchiveSession(e).catch(e=>{f({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},j=async(e,n)=>{let r=await t.using(e,{source:`workspaceOperation`},e=>e.binding.session.rename(n));if(!r.ok)throw Error(r.error.message)},M=vr(t.list,e=>new Set(Object.values(e.byId).filter(e=>!e.blank&&e.origin!==`subagent`&&!e.projectionValues?.remoteHost&&e.projectionValues?.harnessIdentity?.id===`codex`).map(e=>e.id))),N=(0,r.createSnapshotStore)(null),P=()=>({hooks:{nativeThreads:M,sectionWorkspace:n.list},requestMove:e=>N.set(e)}),ee=()=>({hooks:{threadSectionMove:N},dismiss:()=>N.set(null),move:(e,t)=>n.moveSessionToSection?n.moveSessionToSection(e,t):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`))}),F=()=>({hooks:{pinned:w,archived:T},pinSession:e=>{p.pinSession(e).catch(e=>{f({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{p.unpinSession(e).catch(e=>{f({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),I=async(e,r,i=!1)=>{await p.archiveSession(e,{stopActivity:i});let a=0;for(let e of r)if(!n.list.getSnapshot().archivedSessionIds.includes(e))try{let n=t.list.getSnapshot();if(n.byId[e]?.running||Rr(n,e,[]).length)throw Error(`Child Session is active`);await p.archiveSession(e)}catch{a++}f({kind:i?`stoppedAndArchived`:`archived`,sessionId:e,failedChildren:a})},te=(e,n)=>{let r=t.list.getSnapshot(),i=r.byId[e],a=i?.displayTitle??e,o=Rr(r,e,[]);i?.running||o.length>0?D.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):I(e,n).catch(t=>{let r=Kr(t);r===void 0?f({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):D.set({sessionId:e,displayTitle:a,activity:r,children:n})})},L=()=>({hooks:{archived:T},archiveSession:e=>{let n=m.getSnapshot().value?.archiveChildren??`ask`,r=t.list.getSnapshot(),i=Lr(r,e,T.getSnapshot());!i.length||n!==`ask`?te(e,n===`always`?i.map(({id:e})=>e):[]):O.set({sessionId:e,title:r.byId[e]?.displayTitle??e,children:i})},unarchiveSession:A});u(e,p,h,L().archiveSession);let ne=()=>({hooks:{archiveChildrenRequest:O},dismiss:()=>O.set(null),async choose(e,t,n){if(O.getSnapshot()===e){if(n&&!await m.set(`archiveChildren`,t?`always`:`never`))throw Error(`Archive preference could not be saved`);O.getSnapshot()===e&&(O.set(null),te(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}}),re=()=>({hooks:{archiveRequest:D},settleSessionArchive:()=>{D.set(null)},stopAndArchiveSession:(e,t=[])=>I(e,t,!0)}),R=()=>({forkSession:t=>{p.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>p.openSession(e)).catch(e=>{f({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),z=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:x(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(S(r)),f({kind:`sessionLinkCopied`})}catch{f({kind:`sessionLinkCopyFailed`})}})()}}),ie=()=>({requestSessionRename:k}),B=()=>({hooks:{renameRequest:E},settleSessionRename:h.closeRename,renameSession:j}),ae=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:A,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),oe=()=>({startSession:e=>{p.startSession(e)},open:C,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:g,refreshSessions:()=>{t.refresh()},loadMoreSessions:()=>{t.loadMore()},searchResultLimit:t.searchResultLimit,requestSessionRename:k,notifyArchivedNotOpenable:()=>{f({kind:`archivedNotOpenable`})},renameWorkspace:async(e,t)=>{await n.rename(e,t)},deleteWorkspace:async e=>{await n.delete(e)},insertWorkspaceBefore:async(e,t)=>{await n.insertBefore(e,t)},unarchiveSession:async e=>{await p.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestSearch:h.search,requestAddWorkspace:h.add,closeAddWorkspace:h.closeAdd,setDirectoryBusy:h.directoryBusy,dismissForkError:h.dismissForkError,setThreadTreeCollapseStyle:e=>m.set(`threadTreeCollapseStyle`,e),hooks:{workspacePreferences:m,directoryFlow:v,hostInfo:y,workspaceShortcuts:h.state,shortcuts:e.shortcuts.catalog}}),V=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:b}});e.slots.inject(`sidebar.workspaces`,()=>e.slots.register({name:`sidebar.workspaces`,children:{"sidebar.workspaces.directoryFlow":{kind:`single`,scope:`root`},"sidebar.workspaces.session.menu.item":{kind:`list`,scope:`root`,inject:{hooks:{menuOpenState:c,shortcuts:e.shortcuts.catalog}}},"sidebar.workspaces.session.row.action":{kind:`list`,scope:`root`},"sidebar.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:o,inject:oe,locale:Ur},lr)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:Ur,inject:F},Tr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:Ur,inject:P},yr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:Ur,inject:ie},Dr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:Ur,inject:R},Sr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:Ur,inject:z},Cr),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:Ur,inject:L},dr)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:Ur,inject:L},fr),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:Ur,inject:F},Er)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:Ur,inject:ee},br),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:Ur,inject:B},Or),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:Ur,inject:re},pr),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:Ur,inject:ne},gr),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:Ur,store:o,inject:ae},jr)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:V,locale:Ur},Yn))}function Kr(e){if(!(e instanceof Error)||e.name!==`WorkspaceArchiveError`)return;let{rpcError:t}=e;return t.code===`workspace/session-active`?t.details.activity:void 0}return n.ReferenceSessionMenuItem=Vr,n.apply=Gr,n.inject=Wr,t.exports}});
|