@codexhost/cli-win32-arm64 0.26.1 → 0.28.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 +1010 -592
- package/app/console-web.js +1861 -1498
- package/app/desktop-controller.mjs +488 -245
- package/app/host-runtime.mjs +9177 -4006
- package/app/plugins/antigravity/plugin.mjs +9055 -548
- package/app/plugins/claude-code/plugin.mjs +1117 -423
- package/app/plugins/codebuddy/plugin.mjs +599 -261
- package/app/plugins/codex-usage/plugin.mjs +1808 -1357
- package/app/plugins/copilot/plugin.mjs +491 -235
- package/app/plugins/cursor-cli/plugin.mjs +487 -232
- package/app/plugins/deepseek-harness/plugin.mjs +493 -235
- package/app/plugins/devin/plugin.mjs +467 -232
- package/app/plugins/grok/plugin.mjs +547 -253
- package/app/plugins/hermes/plugin.mjs +468 -232
- package/app/plugins/kimi-code/plugin.mjs +762 -439
- package/app/plugins/kiro-cli/plugin.mjs +466 -232
- package/app/plugins/omp/plugin.mjs +1705 -1356
- package/app/plugins/opencode/manifest.json +1 -1
- package/app/plugins/opencode/plugin.mjs +544 -250
- package/app/plugins/pi/plugin.mjs +761 -364
- package/app/plugins/qoder/plugin.mjs +540 -246
- package/app/plugins/qoder-cn/plugin.mjs +540 -246
- package/app/plugins/qwen-code/plugin.mjs +466 -232
- package/app/plugins/workbuddy/plugin.mjs +594 -273
- package/app/plugins/zcode/plugin.mjs +468 -232
- package/app/renderer-extension.js +2653 -657
- package/app/web/assets/index-DBPgg32z.css +1 -0
- package/app/web/assets/index-DWxiVzuS.js +204 -0
- package/app/web/codexhost-settings.js +101 -66
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-shortcuts/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-approval/client.js +4 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +73 -73
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +19 -19
- 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 +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +5 -5
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-shortcuts/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +2 -2
- 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 +4 -4
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +71 -71
- package/app/web/plugins.json +2 -1
- package/app/web-modules/server.mjs +5065 -1964
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-CR4Y8Ndj.css +0 -1
- package/app/web/assets/index-Dw-yHAxN.js +0 -196
|
@@ -4,11 +4,11 @@ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:
|
|
|
4
4
|
/* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
|
|
5
5
|
case`invalid`:return;
|
|
6
6
|
/* v8 ignore next 2 -- Every scanner mode has a handler above. */
|
|
7
|
-
default:v(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){g(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===`}`||g(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 v(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function y(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function
|
|
7
|
+
default:v(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){g(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===`}`||g(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 v(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function y(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function ee(e,t){if(t===void 0||t===``||y(e)||y(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)}let x=/^remote-(?:peer:|ssh(?:-|:)|control:).+/u;function S(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||x.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 C(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function te(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${C(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function ne(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.runningSubagentCount??0)>0)+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 w(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 T(e,t){return e.find(e=>e.sessionIds.includes(t))?.workspaceId??``}function E(e){return Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id}function D(e){if(e===void 0||e===``)return``;let t=b(e);return t===``?e:t}function O(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 k(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 O([...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 re(e,t){return t===void 0?[...e]:[t,...e.filter(e=>e!==t)]}function ie(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 v(n)}}function ae(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 k(e){return e.blank?``:e.title?.trim()??``}function oe(e){let t=Date.parse(e);return Number.isFinite(t)&&t>0?t:void 0}function A(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function se(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&&ie(a,n,r)&&t.push(a)}(r!==`only`||t.length!==0)&&i.push(A(a.workspaceId,a.workspaceId,a.path,oe(a.createdAt),a.title,t,a.remote))}let a=O(e.ids,e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&ie(e,n,r));return a.length>0&&i.push(A(``,void 0,void 0,void 0,``,a)),i}function ce(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function le(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 ue(e,t,n){let r=n.get(e.id),i=ce(r?.pendingInteraction?.kind);return{running:r?.running??e.running,runningSubagentCount:le(t,e.id,n),completed:r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function de(e,t,n,r,i){return{id:e.id,reference:S(e),remote:e.projectionValues?.remoteHost??void 0,title:k(e),...e.cwd===void 0?{}:{cwd:e.cwd},blank:e.blank,...ue(e,t,n),pinned:!i.has(e.id)&&r.has(e.id),archived:i.has(e.id),updatedAt:e.updatedAt}}function j(e,t){let n=e.projectionValues?.threadTreeParent??null;if(n===null)return null;let r=t?.byId[p(n)];return r===void 0?null:(e.projectionValues?.threadReference?.hostId??e.projectionValues?.remoteHost?.hostId??`local`)===(r.projectionValues?.threadReference?.hostId??r.projectionValues?.remoteHost?.hostId??`local`)?n:null}function fe(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return T(he(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[de(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:j(r,e)})}function pe(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(fe(e,n,r).map(e=>[e.id,e])),u=[];for(let r of se(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?ae(t,o,a):[]})}return u}function me(e,t=[]){return[...he(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function he(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&ie(i,r,n)})}function ge(e,t,n,r){let i=new Set(n.archivedSessionIds),a=new Set(n.pinnedSessionIds),o=new Map(fe(e,n,r).map(e=>[e.id,e]));return ae(t.flatMap(e=>{let t=o.get(e);return t===void 0?[]:[t]}),a,i)}function _e(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)??te(e.cwd),f=/* @__PURE__ */ new Map;for(let e of o.items)f.has(e.sessionId)||f.set(e.sessionId,e);let m=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&ie(n,l,i)&&(k(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&m.push(n)}let h=new Map(m.map(e=>[e.id,e])),g=O(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&&ie(n,l,i)&&y(n)}return{items:_.slice(0,s).map(t=>{let n=f.get(t.id),r=a.get(t.id),i=ce(r?.pendingInteraction?.kind),o=j(t,e);return{id:t.id,title:k(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[p(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:le(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 ve(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function ye(e,t){let n=ve(e),r,i=-1;for(let e of t){let t=ve(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let be=`__flat_session_order__`,xe=`pinned`,Se=`workspaces`;function Ce(e,t){return e?.[t]??!0}function we(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 M(){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`?we(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,we(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=we({...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=we(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,ne(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 Te(e,t){let n=fe(e,t,/* @__PURE__ */ new Map),r=new Set(he(e,t.archivedSessionIds,t.archivedFilter)),i=/* @__PURE__ */ new Set([...n.map(e=>e.id),...me(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(p(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 Ee(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 De(e,t,n){let r=Te(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,Ee(e.sessionIds,r).memberIds]),[``,i([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!a.has(e))],[be,i(me(t,n.archivedSessionIds))]]),summaries:r.summaries,rowState:n}}function Oe(e,t){return[E(e,t),be]}var ke=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 Ae=`codexhost.web.session-tabs.v2:local`,je=`codexhost.web.session-tabs.v1:local`,Me=`codexhost.web.recent-visits.v1:local`,Ne=1048576;function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Fe(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?p(e):void 0}function Ie(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!Pe(e)||Object.keys(e).length!==3)return;let n=Fe(e.parentSessionId),r=Fe(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 N(e,t){if(e===null||e.length>Ne)return[];try{let n=JSON.parse(e);if(!Pe(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(!Pe(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=Fe(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=Ie(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var Le=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>Ne){this.failed();return}localStorage.getItem(Ae)!==i&&localStorage.setItem(Ae,i),localStorage.removeItem(je),localStorage.removeItem(Me)}catch{this.failed()}}latest(){let e=localStorage.getItem(Ae);return e===null?N(localStorage.getItem(je)??localStorage.getItem(Me),1):N(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},Re=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 Le(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=ue(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)||ze(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 ze(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 Be=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},Ve=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;mainIsRemote=!1;disposeMainSessionWatch;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 ke(r,n);let o=e.get(`remote`);this.recentVisits=new Re(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(),this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0;let e=this.mainReference;this.mainReference=void 0,this.mainIsRemote=!1,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(He(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,i){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let a={stop:()=>t.removeEventListener(`abort`,o)},o=()=>{a.stop(),this.openingLoad===a&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,o,{once:!0}),this.openingLoad=a,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==a||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==a))return;if(this.sessions.list.getSnapshot().byId[e]===void 0){if(i!==void 0){o(),i();return}throw Error(`Session not found: ${e}`)}n(),o()}catch(n){if(t.aborted||this.openingLoad!==a)return;if(i!==void 0&&Ue(n)){o(),i();return}this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:Ke(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 P;r=e===null?await this.sessions.create():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:Ke(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`?qe(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 P;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=We(r),a=i===`unknown`?Ge(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,Oe(t,e),De(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 Be(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new Be(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)return;let n=this.mainReference?.sessionId;if(n!==void 0&&!this.mainIsRemote&&this.isRemoteSession(n)&&(this.mainIsRemote=!0),this.clearArchivedCurrent()||this.clearRemovedRemoteCurrent()||e!==`waiting`)return;let r=this.workspaces.list.getSnapshot(),i=this.sessions.list.getSnapshot();this.mainReference===void 0?r.phase===`ready`&&i.phase===`ready`&&(e=`connecting`,this.restoreSelection(r,i,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.ctx.get(`remote`)?.$on(`api-session/removed`,e=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent(e)}),o=this.selection.getSnapshot();if(o.sessionId!==void 0||o.subagentAddress!==void 0){if(e=`connecting`,o.subagentAddress!==void 0)this.replaceMain(o.subagentAddress,t,`preserve`),e=`done`;else if(o.sessionId!==void 0){let r=o.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,()=>{this.selection.getSnapshot().sessionId===r&&this.selection.set({}),e=`waiting`,n()})};i()}}return n(),()=>{this.lifetime.abort(),a?.(),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??qe(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)}isDurableSubagent(e){return this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`}isRemoteSession(e){let t=this.sessions.list.getSnapshot(),n=this.workspaces.list.getSnapshot().items,r=/* @__PURE__ */ new Set,i=e;for(;i!==void 0&&!r.has(i);){let e=i;if(r.add(e),t.byId[e]?.projectionValues?.remoteHost!=null||t.projectionsBySession[e]?.values.remoteHost!=null||n.some(t=>t.remote!==void 0&&t.sessionIds.includes(e)))return!0;i=this.sessions.subagentAddress(e)?.parentSessionId}return!1}clearRemovedRemoteCurrent(e){let t=this.mainReference;if(t===void 0||e!==void 0&&this.isDurableSubagent(e))return!1;let n=/* @__PURE__ */ new Set,r=t.sessionId,i=!1;for(;r!==void 0&&!n.has(r);){let a=r;n.add(a);let o=a===t.sessionId?t.binding:this.sessions.binding(a);if(e!==void 0&&a===e||o?.session.getSnapshot().removed===!0){i=!0;break}r=this.sessions.subagentAddress(a)?.parentSessionId}return!i||!(this.mainIsRemote||this.isRemoteSession(t.sessionId)||e!==void 0&&this.isRemoteSession(e))?!1:(this.clearMain(),!0)}releaseMainSelection(){let e=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=void 0,this.mainIsRemote=!1,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.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=i,this.mainIsRemote=this.isRemoteSession(i.sessionId),this.disposeMainSessionWatch=typeof i.binding.session.subscribe==`function`?i.binding.session.subscribe(()=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent()}):void 0,this.keepalive.visit(i,e),this.recentVisits.visit(i.sessionId,e),a?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function He(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function Ue(e){return typeof e==`object`&&!!e&&e.isDSHRemoteError===!0&&e.code===`session/not-found`}var P=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function We(e){return He(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof P?`workspace-required`:`unknown`}function Ge(e){let t=He(e),n=(t===void 0?e instanceof Error?e.message:String(e):t.rpcError.message).trim();return n===``?void 0:n}function Ke(e){let t=He(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function qe(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 Je=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Je)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Je,e.textContent=`.--73Qq_button{display:none}[data-phone] .--73Qq_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] .--73Qq_button:after{content:"";position:absolute;inset:-5px -1px}[data-phone] .--73Qq_icon{width:17px;height:17px}[data-phone] .--73Qq_button:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);transform:scale(.92)}[data-phone] .--73Qq_button:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}@media (prefers-reduced-motion:reduce){[data-phone] .--73Qq_button{transition:none}[data-phone] .--73Qq_button:active{transform:none}}@media (forced-colors:active){[data-phone] .--73Qq_button{color:buttontext}[data-phone] .--73Qq_button:focus-visible{outline-color:highlight}}`,document.head.appendChild(e)}var Ye={button:`--73Qq_button`,icon:`--73Qq_icon`};function Xe({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:Ye.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:Ye.icon})})})}let Ze=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.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=`.oOF3UG_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}.oOF3UG_select,.oOF3UG_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}.oOF3UG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}.oOF3UG_close{width:28px;color:var(--dsw-alias-label-secondary);flex:0 0 28px;justify-content:center}.oOF3UG_close:active{color:var(--dsw-alias-label-primary)}.oOF3UG_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}.oOF3UG_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))}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){.oOF3UG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}.oOF3UG_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)}.oOF3UG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.oOF3UG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}.oOF3UG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oOF3UG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){.oOF3UG_shortcut:before,.oOF3UG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}.oOF3UG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){.oOF3UG_shortcut{color:buttontext}.oOF3UG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}.oOF3UG_shortcut[data-active],.oOF3UG_shortcut:active{color:highlighttext}.oOF3UG_shortcut[data-active]:before,.oOF3UG_shortcut:active:before{background:highlight;border-color:highlight}.oOF3UG_close,.oOF3UG_close:active{color:inherit}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline-color:highlight}.oOF3UG_shortcut[data-active] .oOF3UG_select:focus-visible,.oOF3UG_shortcut[data-active] .oOF3UG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var Qe={activity:`oOF3UG_activity`,close:`oOF3UG_close`,identity:`oOF3UG_identity`,select:`oOF3UG_select`,shortcut:`oOF3UG_shortcut`,title:`oOF3UG_title`};function $e({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:Qe.shortcut,"data-active":c||void 0,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Qe.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:Qe.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Qe.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Qe.activity,title:r,children:i})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Qe.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 et=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(et)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=et,e.textContent=`._5OaiBG_hostBadge{--ch-peer-dot-color:#3b82f6;letter-spacing:.01em;min-width:0;max-width:88px;height:18px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 60%, var(--dsw-alias-label-tertiary));background:0 0;border:none;flex-shrink:0;align-items:center;gap:4.5px;margin-left:4px;padding:0;font-size:11px;font-weight:500;line-height:16px;display:inline-flex;overflow:hidden}._5OaiBG_hostBadgeSession{gap:4px;max-width:74px;height:16px;margin-left:2px;font-size:10.5px}._5OaiBG_hostBadge[data-color=blue],._5OaiBG_hostRail[data-color=blue],._5OaiBG_selectedHostHint[data-color=blue],._5OaiBG_hoverHostDot[data-color=blue]{--ch-peer-dot-color:#3b76cc}._5OaiBG_hostBadge[data-color=purple],._5OaiBG_hostRail[data-color=purple],._5OaiBG_selectedHostHint[data-color=purple],._5OaiBG_hoverHostDot[data-color=purple]{--ch-peer-dot-color:#7460cc}._5OaiBG_hostBadge[data-color=cyan],._5OaiBG_hostRail[data-color=cyan],._5OaiBG_selectedHostHint[data-color=cyan],._5OaiBG_hoverHostDot[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}._5OaiBG_hostBadge[data-color=green],._5OaiBG_hostRail[data-color=green],._5OaiBG_selectedHostHint[data-color=green],._5OaiBG_hoverHostDot[data-color=green]{--ch-peer-dot-color:#2f8c70}._5OaiBG_hostBadge[data-color=amber],._5OaiBG_hostRail[data-color=amber],._5OaiBG_selectedHostHint[data-color=amber],._5OaiBG_hoverHostDot[data-color=amber]{--ch-peer-dot-color:#c27803}._5OaiBG_hostBadge[data-color=rose],._5OaiBG_hostRail[data-color=rose],._5OaiBG_selectedHostHint[data-color=rose],._5OaiBG_hoverHostDot[data-color=rose]{--ch-peer-dot-color:#c94a6a}._5OaiBG_hostBadge[data-color=slate],._5OaiBG_hostRail[data-color=slate],._5OaiBG_selectedHostHint[data-color=slate],._5OaiBG_hoverHostDot[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hostRail,._5OaiBG_selectedHostHint,._5OaiBG_hoverHostDot)[data-color=slate]{--ch-peer-dot-color:#94a3b8}._5OaiBG_hostBadge[data-state=connecting]{color:color-mix(in srgb, var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706)) 78%, var(--dsw-alias-label-secondary))}._5OaiBG_hostBadge:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){color:var(--dsw-alias-label-tertiary);opacity:.72}._5OaiBG_hostLabel{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}._5OaiBG_hostDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex-shrink:0;width:5px;height:5px}._5OaiBG_hostBadge[data-state=connected] ._5OaiBG_hostDot{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.9;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}@keyframes _5OaiBG_hostDotPulse{0%,to{opacity:.95}50%{opacity:.35}}@media (prefers-reduced-motion:reduce){._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot,._5OaiBG_hostRail[data-state=connecting]{animation:none}}._5OaiBG_hostRail{--ch-peer-dot-color:#3b76cc;inset-inline-start:2px;background:var(--dsw-alias-label-tertiary);opacity:.35;pointer-events:none;border-radius:2px;width:2px;height:16px;position:absolute;top:8px}._5OaiBG_hostRailWorkspace{height:18px;top:8px}._5OaiBG_hostRail[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.78}._5OaiBG_hostRail[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#c27803));opacity:.85;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}._5OaiBG_selectedHostSubline{width:calc(100% - var(--dsh-thread-icon-size,14px));min-width:0;text-overflow:ellipsis;white-space:nowrap;margin-block-end:3px;margin-inline-start:var(--dsh-thread-icon-size,14px);padding:0 8px;font-size:11px;line-height:16px;display:block;overflow:hidden}._5OaiBG_selectedHostHint{--ch-peer-dot-color:#3b76cc;color:var(--dsw-alias-label-tertiary);font-weight:500}._5OaiBG_selectedHostHint[data-state=connected]{color:var(--ch-peer-dot-color)}._5OaiBG_selectedHostHint[data-state=connecting]{color:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#c27803))}._5OaiBG_hoverHost{color:#cfd3d6;align-items:center;gap:6px;font-size:12px;line-height:16px;display:flex}._5OaiBG_hoverHostDot{--ch-peer-dot-color:#7bb0f8;opacity:.55;background:#94a3b8;border-radius:50%;flex:none;width:6px;height:6px}._5OaiBG_hoverHostDot[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hoverHostDot[data-state=connecting]{opacity:.9;background:#e0ae58}._5OaiBG_projectRow,._5OaiBG_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}._5OaiBG_projectRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen),._5OaiBG_sessionRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}@media (hover:hover){._5OaiBG_projectRow:hover,._5OaiBG_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)}._5OaiBG_sessionRow._5OaiBG_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}}._5OaiBG_sessionRow,._5OaiBG_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] ._5OaiBG_sessionRow,body[data-ds-dark-theme] ._5OaiBG_searchResultRow{--ch-sidebar-text-primary:#fff}._5OaiBG_projectRow:focus-visible,._5OaiBG_sessionRow:focus-visible,._5OaiBG_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._5OaiBG_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}._5OaiBG_searchResultRow:hover,._5OaiBG_searchResultRow._5OaiBG_selected{background:var(--dsw-alias-interactive-bg-hover)}._5OaiBG_searchResultHeading{align-items:center;gap:4px;min-width:0;display:flex}._5OaiBG_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}._5OaiBG_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}._5OaiBG_searchResultWorkspace:only-child{max-width:100%}._5OaiBG_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}._5OaiBG_projectRow{box-sizing:border-box;align-items:center;height:34px}._5OaiBG_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))}._5OaiBG_sessionMain{min-width:0;height:var(--dsh-thread-row-height);flex:none;align-items:center;display:flex;position:relative}._5OaiBG_identityButton{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:4px;padding:0}._5OaiBG_identityButton:after{content:"";position:absolute;inset:-6px -4px -6px -8px}@media (hover:none),(pointer:coarse){._5OaiBG_sessionRow:not(:has(>[data-thread-summary])) ._5OaiBG_identityButton:after{inset:-12px -6px -12px -8px}}._5OaiBG_foldChevron{justify-content:center;align-items:center;display:none;position:absolute;inset:0}._5OaiBG_foldChevron:before{content:"";border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transform:translate(-1px)rotate(-45deg)}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron:before{transform:translateY(-1px)rotate(45deg)}._5OaiBG_identityButton[aria-expanded=true]>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron{color:var(--dsw-alias-label-secondary,currentColor);display:flex}@media (hover:hover) and (pointer:fine){._5OaiBG_identityButton:hover>:not(._5OaiBG_foldChevron),._5OaiBG_identityButton:focus-visible>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton:hover ._5OaiBG_foldChevron,._5OaiBG_identityButton:focus-visible ._5OaiBG_foldChevron{color:var(--dsw-alias-text-secondary,currentColor);display:flex}}._5OaiBG_identityButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}._5OaiBG_sessionRow ._5OaiBG_title{margin:0 6px 0 4px}._5OaiBG_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}._5OaiBG_slot:has([data-harness-id]){width:14px;color:inherit}._5OaiBG_sessionRow:has([data-harness-id]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-harness-id]) ._5OaiBG_searchResultTitle{margin-left:8px}._5OaiBG_statusOverlay{display:contents}._5OaiBG_slot:has([data-harness-id]) ._5OaiBG_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}._5OaiBG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._5OaiBG_projectRow>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:inherit}._5OaiBG_folderExpanded{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}._5OaiBG_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_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}._5OaiBG_sessionRow ._5OaiBG_title{flex:1}._5OaiBG_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}._5OaiBG_trailing{flex:none;place-items:center end;display:grid}._5OaiBG_trailing:empty{display:none}._5OaiBG_trailing>*{grid-area:1/1}._5OaiBG_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}._5OaiBG_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus [data-state=done]{color:var(--dsw-alias-state-business-primary)}._5OaiBG_timeStatus ._5OaiBG_visuallyHidden{visibility:visible}._5OaiBG_sessionRow._5OaiBG_archived ._5OaiBG_title,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultTitle,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultSnippet{color:var(--dsw-alias-label-caption)}._5OaiBG_dot{flex:none}._5OaiBG_quickActions{align-items:center;gap:2px;display:inline-flex}._5OaiBG_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) ._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_searchResultHeading ._5OaiBG_rowActions{margin-left:auto}@media (hover:hover) and (pointer:fine){._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_time,._5OaiBG_hostBadge),._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_hostBadge{visibility:hidden}._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_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%)}._5OaiBG_projectRow>._5OaiBG_rowActions{inset-inline-end:8px}._5OaiBG_projectRow>._5OaiBG_rowActions:before,._5OaiBG_sessionRow ._5OaiBG_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] ._5OaiBG_sessionRow{min-height:44px}[data-phone-drawer] ._5OaiBG_sessionRow>._5OaiBG_hostRail{top:14px}[data-phone-drawer] ._5OaiBG_projectRow>._5OaiBG_hostRailWorkspace{top:13px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>:is([data-thread-summary],[data-selected-host-meta])){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] ._5OaiBG_sessionRow:has(>:is([data-thread-summary],[data-selected-host-meta]))>._5OaiBG_hostRail{top:7px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>:is([data-thread-summary],[data-selected-host-meta])) ._5OaiBG_sessionMain{display:contents;position:static}[data-phone-drawer] ._5OaiBG_sessionRow:has(>:is([data-thread-summary],[data-selected-host-meta])) ._5OaiBG_slot{grid-area:1/1;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>:is([data-thread-summary],[data-selected-host-meta])) ._5OaiBG_title{grid-area:1/2;align-self:center;margin:0}[data-phone-drawer] ._5OaiBG_sessionRow:has(>:is([data-thread-summary],[data-selected-host-meta])) ._5OaiBG_trailing{grid-area:1/3/span 2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow>:is([data-thread-summary],[data-selected-host-meta]){text-overflow:ellipsis;white-space:nowrap;grid-area:2/2;width:100%;margin:0;padding-inline:0;overflow:hidden}._5OaiBG_phoneDetails{padding:8px 8px 16px}._5OaiBG_phoneDetails ._5OaiBG_hoverTitle{display:none}._5OaiBG_phoneDetails :is(._5OaiBG_hoverTitle,._5OaiBG_hoverTime,._5OaiBG_hoverStatus,._5OaiBG_hoverPath){color:inherit}._5OaiBG_sessionRow._5OaiBG_dropBefore,._5OaiBG_sessionRow._5OaiBG_dropAfter{position:relative}._5OaiBG_sessionRow._5OaiBG_dropBefore:before,._5OaiBG_sessionRow._5OaiBG_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}._5OaiBG_sessionRow._5OaiBG_dropBefore:before{top:-7px}._5OaiBG_sessionRow._5OaiBG_dropAfter:after{bottom:-7px}._5OaiBG_hoverContent{flex-direction:column;gap:8px;display:flex}._5OaiBG_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}._5OaiBG_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}._5OaiBG_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}._5OaiBG_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}._5OaiBG_hoverArchived svg{flex-shrink:0;margin:0 -4px}._5OaiBG_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){._5OaiBG_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:active,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] ._5OaiBG_rowActions,[data-phone-drawer] ._5OaiBG_rowActions:before{background:0 0}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}@media (hover:hover){body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_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(._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_rowActions){background:color-mix(in srgb, var(--dsw-specific-sidebar-fill) 82%, transparent)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen)>._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions){backdrop-filter:blur(10px)}body[data-codexhost-wallpaper] :is(){display:none}}[data-phone-drawer] ._5OaiBG_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] ._5OaiBG_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){._5OaiBG_projectRow,._5OaiBG_sessionRow{min-height:44px}._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_sessionRow ._5OaiBG_quickActions{display:none}._5OaiBG_sessionRow ._5OaiBG_trailing{align-items:center;gap:4px;display:flex}._5OaiBG_sessionRow ._5OaiBG_time:not(._5OaiBG_timeStatus){display:none}._5OaiBG_sessionRow ._5OaiBG_timeStatus{visibility:visible;padding-inline-end:0}._5OaiBG_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var F={archived:`_5OaiBG_archived`,dot:`_5OaiBG_dot`,dropAfter:`_5OaiBG_dropAfter`,dropBefore:`_5OaiBG_dropBefore`,foldChevron:`_5OaiBG_foldChevron`,folderExpanded:`_5OaiBG_folderExpanded`,hostBadge:`_5OaiBG_hostBadge`,hostBadgeSession:`_5OaiBG_hostBadgeSession`,hostDot:`_5OaiBG_hostDot`,hostDotPulse:`_5OaiBG_hostDotPulse`,hostLabel:`_5OaiBG_hostLabel`,hostRail:`_5OaiBG_hostRail`,hostRailWorkspace:`_5OaiBG_hostRailWorkspace`,hoverArchived:`_5OaiBG_hoverArchived`,hoverContent:`_5OaiBG_hoverContent`,hoverHost:`_5OaiBG_hoverHost`,hoverHostDot:`_5OaiBG_hoverHostDot`,hoverPath:`_5OaiBG_hoverPath`,hoverStatus:`_5OaiBG_hoverStatus`,hoverTime:`_5OaiBG_hoverTime`,hoverTitle:`_5OaiBG_hoverTitle`,iconButton:`_5OaiBG_iconButton`,identityButton:`_5OaiBG_identityButton`,menuOpen:`_5OaiBG_menuOpen`,meta:`_5OaiBG_meta`,phoneDetails:`_5OaiBG_phoneDetails`,projectRow:`_5OaiBG_projectRow`,projectText:`_5OaiBG_projectText`,quickActions:`_5OaiBG_quickActions`,renameInput:`_5OaiBG_renameInput`,rowActions:`_5OaiBG_rowActions`,searchResultHeading:`_5OaiBG_searchResultHeading`,searchResultMeta:`_5OaiBG_searchResultMeta`,searchResultRow:`_5OaiBG_searchResultRow`,searchResultSnippet:`_5OaiBG_searchResultSnippet`,searchResultTitle:`_5OaiBG_searchResultTitle`,searchResultWorkspace:`_5OaiBG_searchResultWorkspace`,selected:`_5OaiBG_selected`,selectedHostHint:`_5OaiBG_selectedHostHint`,selectedHostSubline:`_5OaiBG_selectedHostSubline`,sessionMain:`_5OaiBG_sessionMain`,sessionRow:`_5OaiBG_sessionRow`,slot:`_5OaiBG_slot`,statusOverlay:`_5OaiBG_statusOverlay`,time:`_5OaiBG_time`,timeStatus:`_5OaiBG_timeStatus`,title:`_5OaiBG_title`,trailing:`_5OaiBG_trailing`,visuallyHidden:`_5OaiBG_visuallyHidden`};function tt(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 nt(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 nt(e){throw Error(`unknown pending interaction: ${String(e)}`)}function rt({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:F.visuallyHidden,children:e.label},e.label))]})}let it=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(it)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=it,e.textContent=`.qXmkFa_trigger,.qXmkFa_shortcuts{display:none}[data-phone] .qXmkFa_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] .qXmkFa_trigger:after{content:"";position:absolute;inset:-12px -10px}[data-phone] .qXmkFa_trigger>svg{transition:transform .18s;display:block}.qXmkFa_trigger[aria-disabled=true]{cursor:wait}.qXmkFa_trigger:focus-visible{outline:none}.qXmkFa_expanded{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){[data-phone] .qXmkFa_trigger>svg{transition:none}}[data-phone] .qXmkFa_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}.qXmkFa_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}.qXmkFa_clear:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.qXmkFa_clear:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.qXmkFa_clear:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.qXmkFa_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var at={clear:`qXmkFa_clear`,expanded:`qXmkFa_expanded`,shortcuts:`qXmkFa_shortcuts`,trigger:`qXmkFa_trigger`};function ot({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:tt(ue(t,o,c),i)}]})}function st(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=ot(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:at.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,o.jsx)($e,{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)(rt,{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:at.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 ct(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=ot(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:at.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?at.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function lt(e){return e==null}function ut(e){return e&&typeof e==`object`&&!Array.isArray(e)}function dt(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function ft(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function pt(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 mt=Symbol.for(`cosmokit.volatile.write`);function ht(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=>ht(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,ht(n,t)])))}finally{t.delete(e)}}function gt(e){let t=ht(e);return Object.freeze({get:()=>t,[mt]:e=>{t=e}})}function _t(e){return typeof e==`object`&&!!e&&mt in e}function vt(e,t){return arguments.length===1?t=>vt(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function yt(e){return vt(`ArrayBuffer`,e)||vt(`SharedArrayBuffer`,e)}function bt(e){return yt(e)||ArrayBuffer.isView(e)}let xt;(function(e){e.is=yt,e.isSource=bt;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})(xt||={}),xt.fromBase64,xt.toBase64,xt.fromHex,xt.toHex;function St(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(vt(`Date`,e))return new Date(e.valueOf());if(vt(`RegExp`,e))return new RegExp(e.source,e.flags);if(yt(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(_t(e)||_t(t))return _t(e)&&_t(t);if(!n&<(e)&<(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(vt(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(vt(`URL`),(e,t)=>e.href===t.href)??a(vt(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(yt,(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 wt;(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})(wt||={});let Tt=Symbol.for(`schemastery`),Et=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var I=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?.[Et]}};Object.defineProperty(I.prototype,Et,{value:!0});let L=function(e){let t=function(e,n={}){return L.resolve(e,t,n)[0]};if(e.refs){let t=ft(e.refs,e=>new L(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&&ft(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,L.prototype),t.meta||={},t.toString=t.toString.bind(t),t};L.prototype=Object.create(Function.prototype),L.prototype[Tt]=!0,Object.defineProperty(L.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:L.resolve(e,this,{})[0]}}catch(e){if(I.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),L.ValidationError=I,L.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},L.prototype.set=function(e,t){return this.dict[e]=t,this},L.prototype.push=function(e){return this.list.push(e),this};function Dt(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 kt(e){return dt(e??{},e=>!e.startsWith(`$`))}L.prototype.i18n=function(e){let t=L(this),n=Dt(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=ft(t.dict,(t,n)=>t.i18n(ft(e,e=>Ot(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(ft(e,(e={})=>Array.isArray(Ot(e))?Ot(e)[n]:Array.isArray(e)?e[n]:kt(e)))),t.inner&&=t.inner.i18n(ft(e,e=>Ot(e)?Ot(e):kt(e))),t.sKey&&=t.sKey.i18n(ft(e,e=>e?.$key)),t},L.prototype.extra=function(e,t){let n=L(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(L.prototype,{[e](t=!0){let n=L(this);return n.meta={...n.meta,[e]:t},n}});L.prototype.deprecated=function(){let e=L(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},L.prototype.experimental=function(){let e=L(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},L.prototype.pattern=function(e){let t=L(this),n=pt(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},L.prototype.simplify=function(e){if(_t(e)&&(e=e.get()),Ct(e,this.meta.default,this.type===`dict`))return null;if(lt(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`||!lt(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 L.resolve(e,t,{}),t.simplify(e)}catch{}return e},L.prototype.toString=function(e){return Rt[this.type]?.(this,e)??`Schema<${this.type}>`},L.prototype.role=function(e,t){let n=L(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(L.prototype,{[e](t){let n=L(this);return n.meta={...n.meta,[e]:t},n}});L.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let At={},jt=Symbol(`checked-volatile-schema`);function Mt(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 I(`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))Mt(i,[...t,n],a,r);if(e.sKey&&Mt(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[Tt])&&Mt(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)Mt(e.list[n],[...t,String(n)],!0,r)}L.extend=function(e,t){At[e]=t},L.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[jt]||(Mt(t,n.path),n={...n,[jt]:!0}),t.meta?.volatile){let i=L(t);i.meta={...t.meta,volatile:!1};let[a,o]=L.resolve(e,i,n,r);try{return[gt(a),o]}catch(e){throw new I(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(lt(e)&&t.type!==`lazy`){if(t.meta.required)throw new I(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&<(i);)r=r.list[0],i=r?.meta.default;if(lt(i))return[e];e=St(i)}let i=At[t.type];if(!i)throw new I(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},L.from=function(e){if(lt(e))return L.any();if([`string`,`number`,`boolean`].includes(typeof e))return L.const(e).required();if(e[Tt])return e;if(typeof e==`function`)switch(e){case String:return L.string().required();case Number:return L.number().required();case Boolean:return L.boolean().required();case Function:return L.function().required();default:return L.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},L.lazy=function(e){let t=new L({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[Tt]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},L.natural=function(){return L.number().step(1).min(0)},L.percent=function(){return L.number().step(.01).min(0).max(1).role(`slider`)},L.date=function(){return L.union([L.is(Date),L.transform(L.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new I(`invalid date "${e}"`,t);return n},!0)])},L.regExp=function(e=``){return L.union([L.is(RegExp),L.transform(L.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new I(e.message,n)}},!0)])},L.arrayBuffer=function(e){return L.union([L.is(ArrayBuffer),L.is(SharedArrayBuffer),L.transform(L.any(),(e,t)=>{if(xt.isSource(e))return xt.fromSource(e);throw new I(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[L.transform(L.string(),(t,n)=>{try{return e===`base64`?xt.fromBase64(t):xt.fromHex(t)}catch(e){throw new I(e.message,n)}},!0)]:[]])},L.extend(`lazy`,(e,t,n,r)=>(t.inner[Tt]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},Mt(t.inner,n.path,!0)),L.resolve(e,t.inner,n,r))),L.extend(`any`,e=>[e]),L.extend(`never`,(e,t,n)=>{throw new I(`expected nullable but got ${e}`,n)}),L.extend(`const`,(e,{value:t},n)=>{if(Ct(e,t))return[t];throw new I(`expected ${t} but got ${e}`,n)});function Nt(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new I(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new I(`expected ${n} >= ${o} but got ${e}`,r)}L.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new I(`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 I(`expect string to match regexp ${r}`,n)}return Nt(e.length,t,`string length`,n),[e]});function Pt(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 Ft(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(Pt(e,i)-Pt(t,i))%Pt(n,i)===0}L.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new I(`expected number but got ${e}`,n);Nt(e,t,`number`,n);let{step:r}=t;if(r&&!Ft(e,t.min??0,r))throw new I(`expected number multiple of ${r} but got ${e}`,n);return[e]}),L.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new I(`expected boolean but got ${e}`,n)}),L.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 I(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new I(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),L.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new I(`expected function but got ${e}`,n)}),L.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new I(`expected ${t.name} but got ${e}`,n)}{if(lt(e))throw new I(`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 I(`expected ${t} but got ${e}`,n)}});function It(e,t,n,r){try{let[i,a]=L.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?gt(n.meta.default):n.meta.default}}L.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new I(`expected array but got ${e}`,r);return Nt(e.length,n,`array length`,r,!lt(t.meta.default)),[e.map((n,i)=>It(e,i,t,r))]}),L.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!ut(e))throw new I(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=L.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=It(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),L.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new I(`expected array but got ${e}`,n);let i=t.map((t,r)=>It(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function Lt(e,t){for(let n in t)n in e||(e[n]=t[n])}L.extend(`object`,(e,{dict:t},n,r)=>{if(!ut(e))throw new I(`expected object but got ${e}`,n);let i={};for(let r in t){let a=It(e,r,t[r],n);(!lt(a)||r in e)&&(i[r]=a)}return r||Lt(i,e),[i]}),L.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return L.resolve(e,n,r,i)}catch(e){a.push(e)}throw new I(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),L.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=L.resolve(e,i,r,!0)[0];if(!lt(t)){if(lt(a))a=t;else if(typeof a!=typeof t)throw new I(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)Lt(a??={},t);else if(a!==t)throw new I(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&ut(e)&&Lt(a,e),[a]}),L.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=L.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let Rt={};function zt(e,t,n){Rt[e]=n,Object.assign(L,{[e](...n){let r=new L({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??L.string();break;case`inner`:r.inner=L.from(n[t]);break;case`list`:r.list=n[t].map(L.from);break;case`dict`:r.dict=ft(n[t],L.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}})}zt(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),zt(`any`,[],()=>`any`),zt(`never`,[],()=>`never`),zt(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),zt(`string`,[],()=>`string`),zt(`number`,[],()=>`number`),zt(`boolean`,[],()=>`boolean`),zt(`bitset`,[`bits`],()=>`bitset`),zt(`function`,[],()=>`function`),zt(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),zt(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),zt(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),zt(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),zt(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),zt(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),zt(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let Bt=[0,15,30,60,120,240,1440],Vt={showRecentVisits:!0,tabIdleTimeoutMinutes:60},Ht={showRecentVisits:L.boolean().default(!0),tabIdleTimeoutMinutes:L.natural().max(1440).default(60)},Ut=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ut)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ut,e.textContent=`._0lPQtW_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}._0lPQtW_text{flex:160px;min-width:0}._0lPQtW_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}._0lPQtW_menu{flex:none;margin-inline-start:auto}._0lPQtW_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}._0lPQtW_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}._0lPQtW_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){._0lPQtW_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}._0lPQtW_error{padding-bottom:12px;font-size:12px;line-height:18px}._0lPQtW_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._0lPQtW_title{font-size:14px;line-height:20px}._0lPQtW_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Wt={description:`_0lPQtW_description`,error:`_0lPQtW_error`,menu:`_0lPQtW_menu`,row:`_0lPQtW_row`,selector:`_0lPQtW_selector`,text:`_0lPQtW_text`,timeoutRow:`_0lPQtW_timeoutRow`,title:`_0lPQtW_title`,titleLine:`_0lPQtW_titleLine`};function Gt({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:Wt.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Wt.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Wt.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Wt.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:Wt.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:`${Wt.row} ${Wt.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Wt.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:Wt.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(a.Menu,{className:Wt.menu,open:u&&c&&!f,onClose:()=>d(!1),items:Bt.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=Bt.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Wt.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:Wt.error,role:`alert`,children:r(`recent.settings.error`)})]})}function Kt(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}})},Xe)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},ct)),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`}}},st)),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})},Gt))}let qt=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(qt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=qt,e.textContent=`.GyPSUW_options{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;align-items:flex-start;gap:8px;padding-block:6px;display:flex}.GyPSUW_settingsText{flex:240px}.GyPSUW_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}.GyPSUW_promptHeading{justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;display:flex}.GyPSUW_promptHeading strong{font-weight:500}.GyPSUW_comparison{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.GyPSUW_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}.GyPSUW_choice+.GyPSUW_choice{border-inline-start:1px solid var(--dsw-alias-border-l2);border-radius:0 5px 5px 0}.GyPSUW_choice[aria-checked=true]{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.GyPSUW_choiceTitle{padding:0 8px 2px;font-size:12px;font-weight:500;display:block}.GyPSUW_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}.GyPSUW_preview{pointer-events:none;user-select:none;grid-auto-rows:44px;min-width:0;display:grid;overflow:hidden}.GyPSUW_preview .GyPSUW_sampleRow{--dsh-thread-row-height:22px;--dsh-workspace-indent:0px;--dsh-thread-indent:0px;min-height:0;padding-inline:6px}.GyPSUW_preview [data-session-title]{margin-inline:7px 0;font-size:11px}.GyPSUW_preview .GyPSUW_sampleSummary{margin-block-end:0;padding:0 0 0 7px;font-size:9px;line-height:11px}.GyPSUW_sampleIcon{flex-shrink:0;width:14px;height:14px;display:inline-flex}.GyPSUW_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 8px;font-size:11px;line-height:1.5}.GyPSUW_later{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;flex-shrink:0;padding:4px}.GyPSUW_choice:focus-visible,.GyPSUW_later:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.GyPSUW_error{color:var(--dsw-alias-state-warn-primary);overflow-wrap:anywhere;flex-basis:100%;margin-top:6px;font-size:12px}@media (width<=639px){.GyPSUW_choiceTitle,.GyPSUW_choiceSubtitle{padding-inline:6px}.GyPSUW_preview [data-session-title]{font-size:10px}}@media (hover:none),(pointer:coarse){.GyPSUW_later{min-height:44px}}`,document.head.appendChild(e)}var Jt={choice:`GyPSUW_choice`,choiceSubtitle:`GyPSUW_choiceSubtitle`,choiceTitle:`GyPSUW_choiceTitle`,comparison:`GyPSUW_comparison`,error:`GyPSUW_error`,hint:`GyPSUW_hint`,later:`GyPSUW_later`,options:`GyPSUW_options`,preview:`GyPSUW_preview`,prompt:`GyPSUW_prompt`,promptHeading:`GyPSUW_promptHeading`,sampleIcon:`GyPSUW_sampleIcon`,sampleRow:`GyPSUW_sampleRow`,sampleSummary:`GyPSUW_sampleSummary`,settingsText:`GyPSUW_settingsText`};let Yt=[`summary`,`ring`];function Xt(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 Zt({style:e,setStyle:t,t:n,settings:r=!1}){let i=(0,s.useId)(),{busy:c,failed:l,save:u}=Xt(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:r?a.preferenceRowStyles.row:Jt.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${a.preferenceRowStyles.rowText} ${r?Jt.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:Yt.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:Jt.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function Qt({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)(Zt,{style:r,setStyle:t,t:n,settings:!0})}let $t={...Vt,threadTreeCollapseStyle:`summary`},en=L.object({...Ht,threadTreeCollapseStyle:L.union([`summary`,`ring`]).default(`summary`)});function tn(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function nn(e){let t=e.configForms.registerBrowser(`ui-workspace`,en.toJSON(),{...$t});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)})},Qt)),t}function rn(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 an(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=an(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function R(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=an(e))&&(r&&(r+=` `),r+=t);return r}function on(e,t){return e===`default-workspace`?t:e}let sn={},cn=(0,s.createContext)({t:e=>e,expansion:sn,rows:e=>ee(e,sn),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function ln(){return(0,s.useContext)(cn)}function un({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:a,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=tn(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??sn),y=r(e=>e.archivedFilter??`default`),b=(0,s.useMemo)(()=>fe(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]),T=(0,s.useCallback)(e=>{S.current=void 0;let t=x.get(e);t!==void 0&&a.setThreadsExpanded(t.ancestors,!0)},[a,x]),E=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,D=(0,s.useRef)(``);(0,s.useEffect)(()=>{E===void 0?D.current=``:x.get(E)!==void 0&&D.current!==E&&(D.current=E,C(E)||T(E))},[E,C,T,x]);let te=(0,s.useMemo)(()=>({t:e.t,expansion:v,rows:e=>ee(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:T,selectSidebarRow:w,isSidebarSelection:C}),[e.t,e.markCompletionsRead,a,v,x,T,w,C,f,d,p,h,l]);return/* @__PURE__ */ (0,o.jsx)(cn.Provider,{value:te,children:t})}function dn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function fn(e,t=`|`){return e.map(e=>zn(e)).join(t)}function pn(e,t){return typeof t==`bigint`?t.toString():t}var mn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function hn(e){return new mn(e)}function gn(e){return e==null}function _n(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function vn(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let yn=/* @__PURE__*/ Symbol(`evaluating`);function bn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==yn)return r===void 0&&(r=yn,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function xn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Sn(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Cn(e){return Sn(e._zod.def)??e._zod.def.shape}function wn(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return xn(this,t,e),e},enumerable:!0,configurable:!0})}function Tn(e,t,n){t in e?xn(e,t,n):e[t]=n}function En(e,t,n,r){let i=Cn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?wn(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Tn(e,a,r?r(n.value,a):n.value))}}function Dn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?wn(e,n,()=>t[n]):Tn(e,n,r.value))}}function On(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function kn(e){return JSON.stringify(e)}function An(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let jn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Mn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let Nn=/* @__PURE__*/ hn(()=>{if(Or.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Pn(e){if(Mn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Mn(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Fn(e){return Pn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let In=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Ln(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Rn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function zn(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Bn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let Vn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Hn={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function Un(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return En(i,e,Wn(e,t)),Rn(e,On(n,{shape:i,checks:[]}))}function Wn(e,t){let n=Cn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Gn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Wn(e,t)),a={};return En(a,e,Reflect.ownKeys(Cn(e)).filter(e=>!i.has(e))),Rn(e,On(n,{shape:a,checks:[]}))}function Kn(e,t){if(!Pn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Cn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Rn(e,On(e._zod.def,{shape:qn(e,t)}))}function qn(e,t){let n={};return En(n,e,Reflect.ownKeys(Cn(e))),Dn(n,t),n}function Jn(e,t){if(!Pn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Rn(e,On(e._zod.def,{shape:qn(e,t)}))}function Yn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return En(n,e,Reflect.ownKeys(Cn(e))),En(n,t,Reflect.ownKeys(Cn(t))),Rn(e,On(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Xn(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Wn(t,n)):void 0,o={};return En(o,t,Reflect.ownKeys(Cn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Rn(t,On(t._zod.def,{shape:o,checks:[]}))}function Zn(e,t,n){let r=n?new Set(Wn(t,n)):void 0,i={};return En(i,t,Reflect.ownKeys(Cn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Rn(t,On(t._zod.def,{shape:i}))}function Qn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function $n(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function er(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function tr(e){return typeof e==`string`?e:e?.message}function nr(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function rr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function ir(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:tr(e.inst?._zod.def?.error?.(e))??tr(a?.(e))??tr(t?.error?.(e))??tr(n.customError?.(e))??tr(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let ar=/[\uD800-\uDBFF]/;function or(e){let t=e.length;if(!ar.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function sr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function cr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function lr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function ur(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):mr(e,n,r.value)}}function dr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function fr(e,t,n){return dr(e,t,n,!1)}function pr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return dr(this,n,r(this))},set(e){dr(this,n,e)}})}return t}function mr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:dr(this,t,n.bind(this))},set(e){dr(this,t,e)}})}function hr(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let gr,_r=!1,vr={configurable:!0,get(){_r=!0}};function B(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&gr!==e._zod?gr=void 0:(gr=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,vr);let e=_r;_r=!1;try{let r=n(this);return _r?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),_r||=e,r}catch(n){throw delete this[t],_r||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function yr(e,t,n,r){let i=hr(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function br(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var xr;let Sr=/*@__PURE__*/ Object.freeze({status:`aborted`}),Cr={value:void 0,enumerable:!1},wr=`captureStackTrace`in Error?Error:null;function Tr(e){let t=wr;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return wr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function V(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Cr.value=new a(r);try{Object.defineProperty(n,"_zod",Cr)}finally{Cr.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),ur(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Tr(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Er=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Dr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(xr=globalThis).__zod_globalConfig??(xr.__zod_globalConfig={});let Or=globalThis.__zod_globalConfig;function kr(e){return e&&Object.assign(Or,e),Or}function Ar(){let e=this._zod;return e.message??=JSON.stringify(e.def,pn,2),e.message}function jr(e){this._zod.message=e}let Mr={get:Ar,set:jr,enumerable:!0,configurable:!0},Nr={value:void 0,enumerable:!1},Pr=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),Fr=(e,t)=>{e.name=`$ZodError`,Nr.value=t,Object.defineProperty(e,"issues",Nr),Nr.value=void 0,Object.defineProperty(e,"message",Mr);let n=Object.getPrototypeOf(e);Pr.has(n)||(Pr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Ir=V(`$ZodError`,Fr);V(`$ZodError`,Fr,void 0,{Parent:Error});function Lr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Rr(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Lr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function zr(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Br(e,t){return{callee:t?.callee??e,Err:t?.Err}}let Vr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Er;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>ir(e,o,kr())));throw jn(n,a?.callee??t),n}return s.value};return t},Hr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>ir(e,o,kr())));throw jn(n,a?.callee??t),n}return s.value};return t},Ur=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Er;return a.issues.length?Wr(e,a.issues,i):{success:!0,data:a.value}};function Wr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>ir(e,n,kr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let Gr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Wr(e,a.issues,i):{success:!0,data:a.value}},Kr=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),qr=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),Jr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Kr)return!0;if(r.definite===!0&&n===void 0)return!1}return Yr(e,t,n)});function Yr(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[qr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Er;return a.issues.length===0}let Xr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Zr=e=>{let t=Vr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Br(n,a))};return n},Qr=e=>{let t=Vr(e),n=(e,r,i,a)=>t(e,r,i,Br(n,a));return n},$r=e=>{let t=Hr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Br(n,a))};return n},ei=e=>{let t=Hr(e),n=async(e,r,i,a)=>await t(e,r,i,Br(n,a));return n},ti=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ur(e)(t,n,i)},ni=e=>(t,n,r)=>Ur(e)(t,n,r),ri=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gr(e)(t,n,i)},ii=e=>async(t,n,r)=>Gr(e)(t,n,r),ai=/^[cC][0-9a-z]{6,}$/,oi=/^[0-9a-z]+$/,si=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ci=/^[0-9a-vA-V]{20}$/,li=/^[A-Za-z0-9]{27}$/,ui=/^[a-zA-Z0-9_-]{21}$/;function di(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let fi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,hi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function gi(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let _i=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,yi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,bi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Si=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ci=/^https?$/,wi=/^\+[1-9]\d{6,14}$/,Ti=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ei(e){return RegExp(`^${e}$`)}let Di=/*@__PURE__*/ Ei(Ti);function Oi(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ki(e){return RegExp(`^${Oi(e)}$`)}function Ai(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Oi({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Oi({precision:e.precision})}`:n;return RegExp(`^${Ti}T(?:${r})$`)}let ji=/^[\s\S]{0,}$/,Mi=/^-?\d+$/,Ni=/^-?\d+(?:\.\d+)?$/,Pi=/^(?:true|false)$/i,Fi=/^null$/i,Ii=/^[^A-Z]*$/,Li=/^[^a-z]*$/,Ri=/*@__PURE__*/ V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zi=e=>{let t=e.value;return!gn(t)&&t.length!==void 0},Bi={number:`number`,bigint:`bigint`,object:`date`},Vi=/*@__PURE__*/ V(`$ZodCheckLessThan`,(e,t)=>{Ri.init(e,t);let n=Bi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Bi[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hi=/*@__PURE__*/ V(`$ZodCheckGreaterThan`,(e,t)=>{Ri.init(e,t);let n=Bi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bi[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ui=/*@__PURE__*/ V(`$ZodCheckMultipleOf`,(e,t)=>{Ri.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):vn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wi=/*@__PURE__*/ V(`$ZodCheckNumberFormat`,(e,t)=>{Ri.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Vn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Gi=/*@__PURE__*/ V(`$ZodCheckMaxLength`,(e,t)=>{var n;Ri.init(e,t),(n=e._zod.def).when??(n.when=zi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?or(r):i)<=t.maximum)return;let a=sr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ki=/*@__PURE__*/ V(`$ZodCheckMinLength`,(e,t)=>{var n;Ri.init(e,t),(n=e._zod.def).when??(n.when=zi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?or(r):i)>=t.minimum)return;let a=sr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qi=/*@__PURE__*/ V(`$ZodCheckLengthEquals`,(e,t)=>{var n;Ri.init(e,t),(n=e._zod.def).when??(n.when=zi),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?or(r):i;if(a===t.length)return;let o=sr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ji=/*@__PURE__*/ V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Ri.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yi=/*@__PURE__*/ V(`$ZodCheckRegex`,(e,t)=>{Ji.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xi=/*@__PURE__*/ V(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ii,Ji.init(e,t)}),Zi=/*@__PURE__*/ V(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Li,Ji.init(e,t)}),Qi=/*@__PURE__*/ V(`$ZodCheckIncludes`,(e,t)=>{Ri.init(e,t);let n=Ln(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),$i=/*@__PURE__*/ V(`$ZodCheckStartsWith`,(e,t)=>{Ri.init(e,t);let n=RegExp(`^${Ln(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ea=/*@__PURE__*/ V(`$ZodCheckEndsWith`,(e,t)=>{Ri.init(e,t);let n=RegExp(`.*${Ln(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ta=/*@__PURE__*/ V(`$ZodCheckOverwrite`,(e,t)=>{Ri.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var na=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
9
|
+
default:return v(n)}}function ae(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 A(e){return e.blank?``:e.title?.trim()??``}function j(e){let t=Date.parse(e);return Number.isFinite(t)&&t>0?t:void 0}function oe(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function se(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&&ie(a,n,r)&&t.push(a)}(r!==`only`||t.length!==0)&&i.push(oe(a.workspaceId,a.workspaceId,a.path,j(a.createdAt),a.title,t,a.remote))}let a=O(e.ids,e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&ie(e,n,r));return a.length>0&&i.push(oe(``,void 0,void 0,void 0,``,a)),i}function ce(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function le(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 ue(e,t,n){let r=n.get(e.id),i=ce(r?.pendingInteraction?.kind);return{running:r?.running??e.running,runningSubagentCount:le(t,e.id,n),completed:r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function M(e,t,n,r,i){return{id:e.id,reference:S(e),remote:e.projectionValues?.remoteHost??void 0,title:A(e),...e.cwd===void 0?{}:{cwd:e.cwd},blank:e.blank,...ue(e,t,n),pinned:!i.has(e.id)&&r.has(e.id),archived:i.has(e.id),updatedAt:e.updatedAt}}function de(e,t){let n=e.projectionValues?.threadTreeParent??null;if(n===null)return null;let r=t?.byId[p(n)];return r===void 0?null:(e.projectionValues?.threadReference?.hostId??e.projectionValues?.remoteHost?.hostId??`local`)===(r.projectionValues?.threadReference?.hostId??r.projectionValues?.remoteHost?.hostId??`local`)?n:null}function fe(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return ne(he(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[M(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:de(r,e)})}function pe(e,t,n,r,i,a){let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=new Set(i.expandedGroups),l=E(e),u=a??new Map(fe(e,n,r).map(e=>[e.id,e])),d=[];for(let r of se(e,t,o,n.archivedFilter)){let e=c.has(r.key),t=r.sessions.flatMap(e=>{let t=u.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));let a={running:0,pendingInteraction:0,completed:0};for(let e of t)e.archived||(a.running+=Number(e.running||e.runningSubagentCount>0)+(e.tree?.activity.running??0),a.pendingInteraction+=Number(e.pendingInteraction!==void 0)+(e.tree?.activity.pendingInteraction??0),a.completed+=Number(e.completed)+(e.tree?.activity.completed??0));d.push({key:r.key,workspaceId:r.workspaceId,cwd:r.cwd,createdAt:r.createdAt,label:r.label,remote:r.remote,sessionCount:t.length,expanded:e,activity:a,containsCurrent:t.some(e=>e.id===l||l!==void 0&&e.tree?.descendantIds.includes(l)),sessions:e?ae(t,s,o):[]})}return d}function me(e,t=[]){return[...he(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function he(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&ie(i,r,n)})}function ge(e,t,n,r,i){if(t.length===0)return[];let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=i??new Map(fe(e,n,r).map(e=>[e.id,e]));return ae(t.flatMap(e=>{let t=s.get(e);return t===void 0?[]:[t]}),o,a)}function _e(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)??D(e.cwd),f=/* @__PURE__ */ new Map;for(let e of o.items)f.has(e.sessionId)||f.set(e.sessionId,e);let m=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&ie(n,l,i)&&(A(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&m.push(n)}let h=new Map(m.map(e=>[e.id,e])),g=O(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&&ie(n,l,i)&&y(n)}return{items:_.slice(0,s).map(t=>{let n=f.get(t.id),r=a.get(t.id),i=ce(r?.pendingInteraction?.kind),o=de(t,e);return{id:t.id,title:A(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[p(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:le(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 ve(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function ye(e,t){let n=ve(e),r,i=-1;for(let e of t){let t=ve(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let be=`__flat_session_order__`,xe=`pinned`,Se=`workspaces`;function Ce(e,t){return e?.[t]??!0}function N(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 we(){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`?N(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,N(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=N({...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=N(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,k(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 Te(e,t,n){let r=n??fe(e,t,/* @__PURE__ */ new Map),i=new Set(he(e,t.archivedSessionIds,t.archivedFilter)),a=/* @__PURE__ */ new Set([...r.map(e=>e.id),...me(e,t.archivedSessionIds).filter(e=>!i.has(e))]),o=/* @__PURE__ */ new Map,s={...e.byId};for(let e of r){for(let t of e.tree?.descendantIds??[])o.set(p(t),e.id);let t=s[e.id];t!==void 0&&(s[e.id]={...t,updatedAt:e.tree?.updatedAt??e.updatedAt})}return{rootIds:a,rootOf:o,summaries:s}}function Ee(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 De(e,t,n,r){let i=r??Te(t,{...n,archivedFilter:n.archivedFilter??`default`}),a=e=>e.filter(e=>t.byId[e]===void 0||i.rootIds.has(e)),o=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,Ee(e.sessionIds,i).memberIds]),[``,a([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!o.has(e))],[be,a(me(t,n.archivedSessionIds))]]),summaries:i.summaries,rowState:n}}function Oe(e,t){return[T(e,t),be]}var ke=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;maxStoppedSessions;maxStoppedBytes;lastVisited;active=!1;reconciling=!1;dirty=!1;constructor(e,t,n={}){this.sessions=e,this.workspaces=t,this.maxStoppedSessions=Math.max(0,n.maxStoppedSessions??4),this.maxStoppedBytes=Math.max(0,n.maxStoppedBytes??33554432)}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(),this.lastVisited=void 0;for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.lastVisited=e.sessionId,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)}isProtectedView(e,t){let n=!1;for(let r of[this.sessions.retainInfo?.(e)?.getSnapshot().retainedBy,t.byId[e]?.retainedBy])if(r!==void 0){for(let[e,t]of Object.entries(r))if(!((t??0)<=0)&&(n=!0,e!==`backgroundWarm`))return!0}return!n&&e===this.lastVisited}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),this.lastVisited===n&&(this.lastVisited=void 0));let a=[...this.recent.keys()].filter(e=>!i.has(e)),o=a.length,s=0,c=/* @__PURE__ */ new Map;for(let e of a){let t=Math.max(0,this.sessions.estimatedBytes?.(e)??0);c.set(e,t),s+=t}for(let t of a){if(o<=this.maxStoppedSessions&&s<=this.maxStoppedBytes)break;this.isProtectedView(t,e)||(this.recent.delete(t),--o,s-=c.get(t)??0)}let l=new Map(this.recent);for(let e of i)l.set(e,e);for(let e of this.failed)l.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!l.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of l){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.then(()=>{this.active&&this.held.get(e)===r&&this.reconcile()},()=>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 Ae=`codexhost.web.session-tabs.v2:local`,je=`codexhost.web.session-tabs.v1:local`,Me=`codexhost.web.recent-visits.v1:local`,Ne=1048576;function Pe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Fe(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?p(e):void 0}function P(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!Pe(e)||Object.keys(e).length!==3)return;let n=Fe(e.parentSessionId),r=Fe(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 Ie(e,t){if(e===null||e.length>Ne)return[];try{let n=JSON.parse(e);if(!Pe(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(!Pe(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=Fe(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=P(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var Le=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>Ne){this.failed();return}localStorage.getItem(Ae)!==i&&localStorage.setItem(Ae,i),localStorage.removeItem(je),localStorage.removeItem(Me)}catch{this.failed()}}latest(){let e=localStorage.getItem(Ae);return e===null?Ie(localStorage.getItem(je)??localStorage.getItem(Me),1):Ie(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},Re=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 Le(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&&r.listErrorPage!==`more`||this.workspaces.list.getSnapshot().phase!==`ready`)return{changed:!1,nextDelayMs:void 0};let i=new Set(r.ids),a=new Set(this.entries.getSnapshot().map(e=>e.sessionId)),o=e=>{let n=r.byId[e.sessionId];if(e.sessionId===this.current?.sessionId||!a.has(e.sessionId)||n===void 0||n.blank||(n.retainedBy.mainView??0)>0||n.running||!Number.isFinite(n.updatedAt))return;let o=t.get(e.sessionId);if(o?.pendingInteraction!==void 0)return;let s=n.projectionValues?.subagentTiming;if(s?.active!==void 0||typeof e.target!=`string`&&!(o?.running!==void 0||i.has(e.sessionId)||s?.lastTurnCompleted!==void 0))return;let c=ue(n,r,t);if(!(c.running||c.runningSubagentCount>0))return Math.max(e.lastVisitedAt,n.updatedAt)},s=/* @__PURE__ */ new Set,c;for(let t of this.records){let r=o(t);if(r===void 0)continue;let i=e-(n-r);i<=0?s.add(t.sessionId):(c===void 0||i<c)&&(c=i)}return s.size===0?{changed:!1,nextDelayMs:c}:(this.records=this.records.filter(e=>!s.has(e.sessionId)),this.cache.update([],t=>{if(!s.has(t.sessionId))return!1;let r=o(t);return r!==void 0&&n-r>=e}),this.publish(),{changed:!0,nextDelayMs:c})}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.sessions.list.getSnapshot(),n=new Set(t.ids),r=this.records.filter(r=>r.sessionId!==e&&(t.byId[r.sessionId]===void 0||typeof r.target!=`string`&&!n.has(r.sessionId)));if(r.length===0)return;this.restoring=!0;let i=0;Promise.all(Array.from({length:Math.min(4,r.length)},async()=>{for(;this.active;){let e=r[i++];if(e===void 0)return;let t=e.sessionId,n=this.sessions.list.getSnapshot();if(!(!this.records.some(e=>e.sessionId===t)||(typeof e.target==`string`?n.byId[t]!==void 0:n.ids.includes(t)))){try{await this.sessions.loadSummary(t)}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)||ze(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 ze(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 Be=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},Ve=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;mainIsRemote=!1;disposeMainSessionWatch;opening=(0,r.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;creating=(0,r.createSnapshotStore)({state:`idle`});retryCreate;creatingLoad;creationToken=0;openedProjectlessBlank;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 ke(r,n);let o=e.get(`remote`);this.recentVisits=new Re(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(),this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0;let e=this.mainReference;this.mainReference=void 0,this.mainIsRemote=!1,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})}reuseOrCreateProjectlessBlank(){let e=this.workspaces.list.getSnapshot(),t=this.sessions.list.getSnapshot(),n=n=>{let r=t.byId[n];return r!==void 0&&r.blank&&r.cwd===void 0&&r.parentId===void 0&&r.origin===void 0&&!this.isRemoteSession(n)&&!e.archivedSessionIds.includes(n)&&!e.items.some(e=>e.sessionIds.includes(n))},r=this.openedProjectlessBlank,i=r!==void 0&&n(r)?r:t.ids.find(n);return i===void 0?this.sessions.create():this.reuseBlank(void 0,i)}openProjectlessBlank(e,t,n,r,i=!1){this.replaceMain(e,t,n,r,i),this.mainReference?.sessionId===e&&(this.openedProjectlessBlank=e)}async reuseBlank(e,t){let n=e===void 0?{}:{workspaceId:e};try{return await this.sessions.create({...n,sessionId:t})}catch(t){let r=He(t)?.rpcError.code;if(r!==`session/writer-held`&&(e!==void 0||r!==`session/busy`))throw t;return this.sessions.create(n)}}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.sessions.syncSummary?.(e)===!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,i){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let a={stop:()=>t.removeEventListener(`abort`,o)},o=()=>{a.stop(),this.openingLoad===a&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,o,{once:!0}),this.openingLoad=a,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==a||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==a))return;if(this.sessions.list.getSnapshot().byId[e]===void 0){if(i!==void 0){o(),i();return}throw Error(`Session not found: ${e}`)}n(),o()}catch(n){if(t.aborted||this.openingLoad!==a)return;let s=Ue(n)===`remote/offline`;if(i!==void 0&&(s||We(n))){o(),i(s?{message:Je(n)}:void 0);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 Ge;r=e===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:Je(e)}),e}n.aborted||(e===null?this.openProjectlessBlank(r,n,`reveal`,t):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`?Ye(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 Ge;let i=e.workspaceId===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e.workspaceId);if(t.aborted||this.creatingLoad!==n)return;let a=t=>{e.beforeOpen?.(t),this.handoffPendingDraft(t,e.draftOptions)};e.workspaceId===null?this.openProjectlessBlank(i,t,`preserve`,a):this.replaceMain(i,t,`preserve`,a),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=Ke(r),a=i===`unknown`?qe(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,Oe(t,e),De(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 Be(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new Be(n.error);return n.value}watchNavigation(){let e=`waiting`,t,n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);n.addEventListener(`abort`,()=>{e=`done`},{once:!0});let r=e=>{this.retryOpen=e.retry,this.opening.set({state:`error`,sessionId:e.sessionId,message:e.message})},i=()=>{if(this.lifetime.signal.aborted)return;let i=this.mainReference?.sessionId;if(i!==void 0&&!this.mainIsRemote&&this.isRemoteSession(i)&&(this.mainIsRemote=!0),this.clearArchivedCurrent()||this.clearRemovedRemoteCurrent()||e!==`waiting`)return;let a=this.workspaces.list.getSnapshot(),o=this.sessions.list.getSnapshot();if(this.mainReference!==void 0){e=`done`;return}if(a.phase!==`ready`||o.phase!==`ready`)return;e=`connecting`;let s=t;this.restoreSelection(a,o,n,s!==void 0).then(t=>{n.aborted||(!t&&s!==void 0&&this.mainReference===void 0&&r(s),e=`done`)},t=>{n.aborted||(s!==void 0&&this.mainReference===void 0?(r(s),e=`done`,console.warn(`initial Session restoration failed:`,t)):(e=`waiting`,console.warn(`initial Session restoration failed:`,t)))})},a=this.workspaces.list.subscribe(i),o=this.sessions.list.subscribe(i),s=this.ctx.get(`remote`)?.$on(`api-session/removed`,e=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent(e)}),c=this.selection.getSnapshot();if(c.sessionId!==void 0||c.subagentAddress!==void 0){if(e=`connecting`,c.subagentAddress!==void 0)this.replaceMain(c.subagentAddress,n,`preserve`),e=`done`;else if(c.sessionId!==void 0){let r=c.sessionId,a=()=>{this.resolveSession(r,n,()=>{t=void 0,this.sessions.list.getSnapshot().byId[r]?.blank===!0?(e=`waiting`,i()):(this.replaceMain(r,n,`preserve`),e=`done`)},a,o=>{n.aborted||(o===void 0&&this.selection.getSnapshot().sessionId===r&&this.selection.set({}),t=o===void 0?void 0:{sessionId:r,message:o.message,retry:a},e=`waiting`,i())})};a()}}return i(),()=>{this.lifetime.abort(),s?.(),o(),a()}}async restoreSelection(e,t,n,r){let i=r?{}:this.selection.getSnapshot(),a=r?e.items.filter(e=>e.remote===void 0):e.items;if(i.subagentAddress!==void 0)return this.replaceMain(i.subagentAddress,n,`preserve`),!0;let o=i.sessionId===void 0?void 0:t.byId[i.sessionId],s=o===void 0?void 0:a.find(e=>e.sessionIds.includes(o.id));if(o!==void 0&&(!o.blank||s===void 0))return o.blank?this.openProjectlessBlank(o.id,n,`preserve`):this.replaceMain(o.id,n,`preserve`),!0;let c;if(o!==void 0&&s!==void 0&&o.cwd===s.path&&!e.archivedSessionIds.includes(o.id)&&(c=await this.reuseBlank(s.workspaceId,o.id)),c===void 0&&e.canStartProjectless&&o===void 0)return c=await this.reuseOrCreateProjectlessBlank(),!n.aborted&&(this.openProjectlessBlank(c,n,`preserve`,void 0,r),!0);let l=s?.workspaceId??Ye(a,t.byId),u=t.ids.some(t=>!e.archivedSessionIds.includes(t)&&!this.isRemoteSession(t));if(l===void 0&&a.length===0&&(r?!u:t.ids.length===0)){let e=await this.initializeDefaultWorkspace(n);if(n.aborted)return!1;l=e?.workspaceId}return c===void 0&&l!==void 0&&(c=await this.connectWorkspace(l)),c!==void 0&&!n.aborted&&(this.replaceMain(c,n,`preserve`,void 0,r),!0)}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)}isDurableSubagent(e){return this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`}isRemoteSession(e){let t=this.sessions.list.getSnapshot(),n=this.workspaces.list.getSnapshot().items,r=/* @__PURE__ */ new Set,i=e;for(;i!==void 0&&!r.has(i);){let e=i;if(r.add(e),e.startsWith(`web-remote:`)||t.byId[e]?.projectionValues?.remoteHost!=null||t.projectionsBySession[e]?.values.remoteHost!=null||n.some(t=>t.remote!==void 0&&t.sessionIds.includes(e)))return!0;i=this.sessions.subagentAddress(e)?.parentSessionId}return!1}clearRemovedRemoteCurrent(e){let t=this.mainReference;if(t===void 0||e!==void 0&&this.isDurableSubagent(e))return!1;let n=/* @__PURE__ */ new Set,r=t.sessionId,i=!1;for(;r!==void 0&&!n.has(r);){let a=r;n.add(a);let o=a===t.sessionId?t.binding:this.sessions.binding(a);if(e!==void 0&&a===e||o?.session.getSnapshot().removed===!0){i=!0;break}r=this.sessions.subagentAddress(a)?.parentSessionId}return!i||!(this.mainIsRemote||this.isRemoteSession(t.sessionId)||e!==void 0&&this.isRemoteSession(e))?!1:(this.clearMain(),!0)}releaseMainSelection(){let e=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=void 0,this.mainIsRemote=!1,this.recentVisits.clearCurrent(),this.selection.set({}),e?.release()}clearMain(){this.releaseMainSelection(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r,i=!1){t.throwIfAborted();let a=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(a.sessionId),t.aborted){a.release();return}if(!i){let t=typeof e==`string`?this.sessions.subagentAddress(a.sessionId):e;this.selection.set({sessionId:a.sessionId,...t===void 0?{}:{subagentAddress:t}})}}catch(e){throw a.release(),e}let o=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=a,this.mainIsRemote=this.isRemoteSession(a.sessionId),this.disposeMainSessionWatch=typeof a.binding.session.subscribe==`function`?a.binding.session.subscribe(()=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent()}):void 0,this.keepalive.visit(a,e),this.recentVisits.visit(a.sessionId,e),o?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function He(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function Ue(e){if(typeof e==`object`&&e&&`isDSHRemoteError`in e&&e.isDSHRemoteError===!0&&`code`in e)return e.code}function We(e){let t=Ue(e);return t===`session/not-found`||t===`remote/not-found`||t===`remote/identity-invalid`}var Ge=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function Ke(e){return He(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof Ge?`workspace-required`:`unknown`}function qe(e){let t=He(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=He(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function Ye(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 Xe=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Xe)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Xe,e.textContent=`.--73Qq_button{display:none}[data-phone] .--73Qq_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] .--73Qq_button:after{content:"";position:absolute;inset:-5px -1px}[data-phone] .--73Qq_icon{width:17px;height:17px}[data-phone] .--73Qq_button:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);transform:scale(.92)}[data-phone] .--73Qq_button:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}@media (prefers-reduced-motion:reduce){[data-phone] .--73Qq_button{transition:none}[data-phone] .--73Qq_button:active{transform:none}}@media (forced-colors:active){[data-phone] .--73Qq_button{color:buttontext}[data-phone] .--73Qq_button:focus-visible{outline-color:highlight}}`,document.head.appendChild(e)}var Ze={button:`--73Qq_button`,icon:`--73Qq_icon`};function Qe({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:Ze.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:Ze.icon})})})}let $e=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($e)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=$e,e.textContent=`.oOF3UG_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}.oOF3UG_select,.oOF3UG_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}.oOF3UG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}.oOF3UG_close{width:28px;color:var(--dsw-alias-label-secondary);flex:0 0 28px;justify-content:center}.oOF3UG_close:active{color:var(--dsw-alias-label-primary)}.oOF3UG_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}.oOF3UG_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))}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){.oOF3UG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}.oOF3UG_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)}.oOF3UG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.oOF3UG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}.oOF3UG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oOF3UG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){.oOF3UG_shortcut:before,.oOF3UG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}.oOF3UG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){.oOF3UG_shortcut{color:buttontext}.oOF3UG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}.oOF3UG_shortcut[data-active],.oOF3UG_shortcut:active{color:highlighttext}.oOF3UG_shortcut[data-active]:before,.oOF3UG_shortcut:active:before{background:highlight;border-color:highlight}.oOF3UG_close,.oOF3UG_close:active{color:inherit}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline-color:highlight}.oOF3UG_shortcut[data-active] .oOF3UG_select:focus-visible,.oOF3UG_shortcut[data-active] .oOF3UG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var et={activity:`oOF3UG_activity`,close:`oOF3UG_close`,identity:`oOF3UG_identity`,select:`oOF3UG_select`,shortcut:`oOF3UG_shortcut`,title:`oOF3UG_title`};function tt({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:et.shortcut,"data-active":c||void 0,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:et.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:et.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:et.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:et.activity,title:r,children:i})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:et.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 nt=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(nt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=nt,e.textContent=`._5OaiBG_hostBadge{--ch-peer-dot-color:#3b82f6;letter-spacing:.01em;min-width:0;max-width:88px;height:18px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 60%, var(--dsw-alias-label-tertiary));background:0 0;border:none;flex-shrink:0;align-items:center;gap:4.5px;margin-left:4px;padding:0;font-size:11px;font-weight:500;line-height:16px;display:inline-flex;overflow:hidden}._5OaiBG_hostBadgeSession{gap:4px;max-width:74px;height:16px;margin-left:2px;font-size:10.5px}._5OaiBG_hostBadge[data-color=blue],._5OaiBG_hoverHostDot[data-color=blue],._5OaiBG_remoteFolderGlobe[data-color=blue]{--ch-peer-dot-color:#3b76cc}._5OaiBG_hostBadge[data-color=purple],._5OaiBG_hoverHostDot[data-color=purple],._5OaiBG_remoteFolderGlobe[data-color=purple]{--ch-peer-dot-color:#7460cc}._5OaiBG_hostBadge[data-color=cyan],._5OaiBG_hoverHostDot[data-color=cyan],._5OaiBG_remoteFolderGlobe[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}._5OaiBG_hostBadge[data-color=green],._5OaiBG_hoverHostDot[data-color=green],._5OaiBG_remoteFolderGlobe[data-color=green]{--ch-peer-dot-color:#2f8c70}._5OaiBG_hostBadge[data-color=amber],._5OaiBG_hoverHostDot[data-color=amber],._5OaiBG_remoteFolderGlobe[data-color=amber]{--ch-peer-dot-color:#c27803}._5OaiBG_hostBadge[data-color=rose],._5OaiBG_hoverHostDot[data-color=rose],._5OaiBG_remoteFolderGlobe[data-color=rose]{--ch-peer-dot-color:#c94a6a}._5OaiBG_hostBadge[data-color=slate],._5OaiBG_hoverHostDot[data-color=slate],._5OaiBG_remoteFolderGlobe[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=slate]{--ch-peer-dot-color:#94a3b8}._5OaiBG_hostBadge[data-state=connecting]{color:color-mix(in srgb, var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706)) 78%, var(--dsw-alias-label-secondary))}._5OaiBG_hostBadge:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){color:var(--dsw-alias-label-tertiary);opacity:.72}._5OaiBG_hostLabel{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}._5OaiBG_hostDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex-shrink:0;width:5px;height:5px}._5OaiBG_hostBadge[data-state=connected] ._5OaiBG_hostDot{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.9;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}@keyframes _5OaiBG_hostDotPulse{0%,to{opacity:.95}50%{opacity:.35}}@media (prefers-reduced-motion:reduce){._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot,._5OaiBG_remoteHostStatusDot[data-state=connecting]{animation:none}}._5OaiBG_remoteFolderGlobe{--ch-peer-dot-color:#3b76cc;background:var(--dsh-row-surface);width:11px;height:11px;color:var(--ch-peer-dot-color);pointer-events:none;border-radius:50%;justify-content:center;align-items:center;display:inline-flex;position:absolute;bottom:0;right:-3px}._5OaiBG_remoteSessionGlobe{z-index:1;width:10px;height:10px;bottom:0;right:-4px}._5OaiBG_remoteSessionGlobe svg{width:9px;height:9px}._5OaiBG_remoteFolderGlobe:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){opacity:.6}._5OaiBG_remoteHostText{flex:1;align-items:baseline;gap:6px;min-width:0;display:flex;overflow:hidden}._5OaiBG_remoteHostText ._5OaiBG_title{flex:0 auto}._5OaiBG_remoteHostMeta{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;max-width:45%;color:var(--dsw-alias-label-tertiary);flex:none;font-size:12px;line-height:16px;overflow:hidden}._5OaiBG_remoteHostStatusDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:7px;height:7px;margin-inline:auto 4px}._5OaiBG_remoteHostStatusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary,#22c55e);opacity:1}._5OaiBG_remoteHostStatusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.95;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}._5OaiBG_hoverHost{color:#cfd3d6;align-items:center;gap:6px;font-size:12px;line-height:16px;display:flex}._5OaiBG_hoverHostDot{--ch-peer-dot-color:#7bb0f8;opacity:.55;background:#94a3b8;border-radius:50%;flex:none;width:6px;height:6px}._5OaiBG_hoverHostDot[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hoverHostDot[data-state=connecting]{opacity:.9;background:#e0ae58}._5OaiBG_projectRow,._5OaiBG_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}._5OaiBG_projectRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen),._5OaiBG_sessionRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}@media (hover:hover){._5OaiBG_projectRow:hover,._5OaiBG_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)}._5OaiBG_sessionRow._5OaiBG_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}}._5OaiBG_sessionRow,._5OaiBG_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] ._5OaiBG_sessionRow,body[data-ds-dark-theme] ._5OaiBG_searchResultRow{--ch-sidebar-text-primary:#fff}._5OaiBG_projectRow:focus-visible,._5OaiBG_sessionRow:focus-visible,._5OaiBG_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._5OaiBG_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}._5OaiBG_searchResultRow:hover,._5OaiBG_searchResultRow._5OaiBG_selected{background:var(--dsw-alias-interactive-bg-hover)}._5OaiBG_searchResultHeading{align-items:center;gap:4px;min-width:0;display:flex}._5OaiBG_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}._5OaiBG_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}._5OaiBG_searchResultWorkspace:only-child{max-width:100%}._5OaiBG_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}._5OaiBG_projectRow{box-sizing:border-box;align-items:center;height:34px}._5OaiBG_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))}._5OaiBG_sessionMain{min-width:0;height:var(--dsh-thread-row-height);flex:none;align-items:center;display:flex;position:relative}._5OaiBG_identityButton{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:4px;padding:0}._5OaiBG_identityButton:after{content:"";position:absolute;inset:-6px -4px -6px -8px}@media (hover:none),(pointer:coarse){._5OaiBG_sessionRow:not(:has(>[data-thread-summary])) ._5OaiBG_identityButton:after{inset:-12px -6px -12px -8px}}._5OaiBG_foldChevron{justify-content:center;align-items:center;display:none;position:absolute;inset:0}._5OaiBG_foldChevron:before{content:"";border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transform:translate(-1px)rotate(-45deg)}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron:before{transform:translateY(-1px)rotate(45deg)}._5OaiBG_identityButton[aria-expanded=true]>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron{color:var(--dsw-alias-label-secondary,currentColor);display:flex}@media (hover:hover) and (pointer:fine){._5OaiBG_identityButton:hover>:not(._5OaiBG_foldChevron),._5OaiBG_identityButton:focus-visible>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton:hover ._5OaiBG_foldChevron,._5OaiBG_identityButton:focus-visible ._5OaiBG_foldChevron{color:var(--dsw-alias-text-secondary,currentColor);display:flex}}._5OaiBG_identityButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}._5OaiBG_sessionRow ._5OaiBG_title{margin:0 6px 0 4px}._5OaiBG_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}._5OaiBG_slot:has([data-harness-id]){width:14px;color:inherit}._5OaiBG_sessionRow:has([data-harness-id]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-harness-id]) ._5OaiBG_searchResultTitle{margin-left:8px}._5OaiBG_statusOverlay{display:contents}._5OaiBG_slot:has([data-harness-id]) ._5OaiBG_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}._5OaiBG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._5OaiBG_projectRow>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:color-mix(in srgb, currentColor 86%, transparent);transition:color .14s}._5OaiBG_projectRow:hover>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:inherit}._5OaiBG_folderExpanded{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}._5OaiBG_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_projectRow ._5OaiBG_projectText>._5OaiBG_title,._5OaiBG_sessionRow ._5OaiBG_title,._5OaiBG_searchResultTitle{--dsh-title-ink-bleed:4px;text-overflow:clip;align-items:center;margin-inline-end:calc(-1 * var(--dsh-title-ink-bleed));padding-inline-end:var(--dsh-title-ink-bleed);display:flex;overflow:clip visible;container-type:inline-size}._5OaiBG_sessionRow ._5OaiBG_title{margin-inline-end:calc(6px - var(--dsh-title-ink-bleed))}._5OaiBG_projectRow ._5OaiBG_projectText>._5OaiBG_title>._5OaiBG_titleText,._5OaiBG_sessionRow ._5OaiBG_title>._5OaiBG_titleText,._5OaiBG_searchResultTitle>._5OaiBG_titleText{box-sizing:content-box;padding:var(--dsh-title-ink-bleed);margin:calc(-1 * var(--dsh-title-ink-bleed));white-space:nowrap;--dsh-title-fade:clamp(0px, ( min(100%, 100cqw + 20px + var(--dsh-title-ink-bleed) * 2) - 100cqw - var(--dsh-title-ink-bleed) * 2 - .5px ) * 48, 20px + var(--dsh-title-ink-bleed));-webkit-mask-image:linear-gradient(to right, #000 calc(100cqw + var(--dsh-title-ink-bleed) * 2 - var(--dsh-title-fade)), transparent calc(100cqw + var(--dsh-title-ink-bleed) * 2 + 20px - var(--dsh-title-fade)));mask-image:linear-gradient(to right, #000 calc(100cqw + var(--dsh-title-ink-bleed) * 2 - var(--dsh-title-fade)), transparent calc(100cqw + var(--dsh-title-ink-bleed) * 2 + 20px - var(--dsh-title-fade)));flex:none}._5OaiBG_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}._5OaiBG_sessionRow ._5OaiBG_title{flex:1}._5OaiBG_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}._5OaiBG_trailing{flex:none;place-items:center end;display:grid}._5OaiBG_trailing:empty{display:none}._5OaiBG_trailing>*{grid-area:1/1}._5OaiBG_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}._5OaiBG_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus [data-state=done],._5OaiBG_projectActivity [data-state=done]{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectActivity{flex:none;justify-content:center;align-items:center;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus ._5OaiBG_visuallyHidden,._5OaiBG_projectActivity ._5OaiBG_visuallyHidden{visibility:visible}._5OaiBG_sessionRow._5OaiBG_archived ._5OaiBG_title,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultTitle,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultSnippet{color:var(--dsw-alias-label-caption)}._5OaiBG_dot{flex:none}._5OaiBG_quickActions{align-items:center;gap:2px;display:inline-flex}._5OaiBG_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) ._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_searchResultHeading ._5OaiBG_rowActions{margin-left:auto}@media (hover:hover) and (pointer:fine){._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_time,._5OaiBG_hostBadge),._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_hostBadge,._5OaiBG_remoteHostStatusDot,._5OaiBG_projectActivity){visibility:hidden}._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_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%)}._5OaiBG_projectRow>._5OaiBG_rowActions{inset-inline-end:8px}._5OaiBG_projectRow>._5OaiBG_rowActions:before,._5OaiBG_sessionRow ._5OaiBG_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] ._5OaiBG_sessionRow{min-height:44px}[data-phone-drawer] ._5OaiBG_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] ._5OaiBG_sessionRow:has(>[data-thread-summary])>._5OaiBG_hostRail{top:7px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_sessionMain{display:contents;position:static}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_slot{grid-area:1/1;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_title{margin:0 calc(-1 * var(--dsh-title-ink-bleed)) 0 0;grid-area:1/2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_trailing{grid-area:1/3/span 2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow>[data-thread-summary]{text-overflow:ellipsis;white-space:nowrap;grid-area:2/2;width:100%;margin:0;padding-inline:0;overflow:hidden}._5OaiBG_phoneDetails{padding:8px 8px 16px}._5OaiBG_phoneDetails ._5OaiBG_hoverTitle{display:none}._5OaiBG_phoneDetails :is(._5OaiBG_hoverTitle,._5OaiBG_hoverTime,._5OaiBG_hoverStatus,._5OaiBG_hoverPath){color:inherit}._5OaiBG_sessionRow._5OaiBG_dropBefore,._5OaiBG_sessionRow._5OaiBG_dropAfter{position:relative}._5OaiBG_sessionRow._5OaiBG_dropBefore:before,._5OaiBG_sessionRow._5OaiBG_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}._5OaiBG_sessionRow._5OaiBG_dropBefore:before{top:-7px}._5OaiBG_sessionRow._5OaiBG_dropAfter:after{bottom:-7px}._5OaiBG_hoverContent{flex-direction:column;gap:8px;display:flex}._5OaiBG_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}._5OaiBG_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}._5OaiBG_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}._5OaiBG_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}._5OaiBG_hoverArchived svg{flex-shrink:0;margin:0 -4px}._5OaiBG_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){._5OaiBG_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:active,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] ._5OaiBG_rowActions,[data-phone-drawer] ._5OaiBG_rowActions:before{background:0 0}[data-phone-drawer] ._5OaiBG_remoteFolderGlobe,body[data-codexhost-wallpaper] ._5OaiBG_remoteFolderGlobe{background:var(--dsw-specific-sidebar-fill)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}@media (hover:hover){body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_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(._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_rowActions){background:color-mix(in srgb, var(--dsw-specific-sidebar-fill) 82%, transparent)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen)>._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions){backdrop-filter:blur(10px)}body[data-codexhost-wallpaper] :is(){display:none}}[data-phone-drawer] ._5OaiBG_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] ._5OaiBG_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){._5OaiBG_projectRow,._5OaiBG_sessionRow{min-height:44px}._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_sessionRow ._5OaiBG_quickActions{display:none}._5OaiBG_sessionRow ._5OaiBG_trailing{align-items:center;gap:4px;display:flex}._5OaiBG_sessionRow ._5OaiBG_time:not(._5OaiBG_timeStatus){display:none}._5OaiBG_sessionRow ._5OaiBG_timeStatus{visibility:visible;padding-inline-end:0}._5OaiBG_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var F={archived:`_5OaiBG_archived`,dot:`_5OaiBG_dot`,dropAfter:`_5OaiBG_dropAfter`,dropBefore:`_5OaiBG_dropBefore`,foldChevron:`_5OaiBG_foldChevron`,folderExpanded:`_5OaiBG_folderExpanded`,hostBadge:`_5OaiBG_hostBadge`,hostBadgeSession:`_5OaiBG_hostBadgeSession`,hostDot:`_5OaiBG_hostDot`,hostDotPulse:`_5OaiBG_hostDotPulse`,hostLabel:`_5OaiBG_hostLabel`,hostRail:`_5OaiBG_hostRail`,hoverArchived:`_5OaiBG_hoverArchived`,hoverContent:`_5OaiBG_hoverContent`,hoverHost:`_5OaiBG_hoverHost`,hoverHostDot:`_5OaiBG_hoverHostDot`,hoverPath:`_5OaiBG_hoverPath`,hoverStatus:`_5OaiBG_hoverStatus`,hoverTime:`_5OaiBG_hoverTime`,hoverTitle:`_5OaiBG_hoverTitle`,iconButton:`_5OaiBG_iconButton`,identityButton:`_5OaiBG_identityButton`,menuOpen:`_5OaiBG_menuOpen`,meta:`_5OaiBG_meta`,phoneDetails:`_5OaiBG_phoneDetails`,projectActivity:`_5OaiBG_projectActivity`,projectRow:`_5OaiBG_projectRow`,projectText:`_5OaiBG_projectText`,quickActions:`_5OaiBG_quickActions`,remoteFolderGlobe:`_5OaiBG_remoteFolderGlobe`,remoteHostMeta:`_5OaiBG_remoteHostMeta`,remoteHostStatusDot:`_5OaiBG_remoteHostStatusDot`,remoteHostText:`_5OaiBG_remoteHostText`,remoteSessionGlobe:`_5OaiBG_remoteSessionGlobe`,renameInput:`_5OaiBG_renameInput`,rowActions:`_5OaiBG_rowActions`,searchResultHeading:`_5OaiBG_searchResultHeading`,searchResultMeta:`_5OaiBG_searchResultMeta`,searchResultRow:`_5OaiBG_searchResultRow`,searchResultSnippet:`_5OaiBG_searchResultSnippet`,searchResultTitle:`_5OaiBG_searchResultTitle`,searchResultWorkspace:`_5OaiBG_searchResultWorkspace`,selected:`_5OaiBG_selected`,sessionMain:`_5OaiBG_sessionMain`,sessionRow:`_5OaiBG_sessionRow`,slot:`_5OaiBG_slot`,statusOverlay:`_5OaiBG_statusOverlay`,time:`_5OaiBG_time`,timeStatus:`_5OaiBG_timeStatus`,title:`_5OaiBG_title`,titleText:`_5OaiBG_titleText`,trailing:`_5OaiBG_trailing`,visuallyHidden:`_5OaiBG_visuallyHidden`};function rt(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 it(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 it(e){throw Error(`unknown pending interaction: ${String(e)}`)}function at({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:F.visuallyHidden,children:e.label},e.label))]})}let ot=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ot)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ot,e.textContent=`.qXmkFa_trigger,.qXmkFa_shortcuts{display:none}[data-phone] .qXmkFa_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] .qXmkFa_trigger:after{content:"";position:absolute;inset:-12px -10px}[data-phone] .qXmkFa_trigger>svg{transition:transform .18s;display:block}.qXmkFa_trigger[aria-disabled=true]{cursor:wait}.qXmkFa_trigger:focus-visible{outline:none}.qXmkFa_expanded{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){[data-phone] .qXmkFa_trigger>svg{transition:none}}[data-phone] .qXmkFa_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}.qXmkFa_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}.qXmkFa_clear:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.qXmkFa_clear:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.qXmkFa_clear:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.qXmkFa_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var st={clear:`qXmkFa_clear`,expanded:`qXmkFa_expanded`,shortcuts:`qXmkFa_shortcuts`,trigger:`qXmkFa_trigger`};function ct({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:rt(ue(t,o,c),i)}]})}function lt(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=ct(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:st.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,o.jsx)(tt,{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)(at,{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:st.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 ut(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=ct(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:st.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?st.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function dt(e){return e==null}function ft(e){return e&&typeof e==`object`&&!Array.isArray(e)}function pt(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function mt(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function ht(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 gt=Symbol.for(`cosmokit.volatile.write`);function _t(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=>_t(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,_t(n,t)])))}finally{t.delete(e)}}function vt(e){let t=_t(e);return Object.freeze({get:()=>t,[gt]:e=>{t=e}})}function yt(e){return typeof e==`object`&&!!e&> in e}function bt(e,t){return arguments.length===1?t=>bt(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function xt(e){return bt(`ArrayBuffer`,e)||bt(`SharedArrayBuffer`,e)}function St(e){return xt(e)||ArrayBuffer.isView(e)}let Ct;(function(e){e.is=xt,e.isSource=St;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})(Ct||={}),Ct.fromBase64,Ct.toBase64,Ct.fromHex,Ct.toHex;function wt(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(bt(`Date`,e))return new Date(e.valueOf());if(bt(`RegExp`,e))return new RegExp(e.source,e.flags);if(xt(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(wt,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(wt,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(yt(e)||yt(t))return yt(e)&&yt(t);if(!n&&dt(e)&&dt(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(bt(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(bt(`URL`),(e,t)=>e.href===t.href)??a(bt(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(xt,(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 Et;(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})(Et||={});let Dt=Symbol.for(`schemastery`),Ot=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var I=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?.[Ot]}};Object.defineProperty(I.prototype,Ot,{value:!0});let L=function(e){let t=function(e,n={}){return L.resolve(e,t,n)[0]};if(e.refs){let t=mt(e.refs,e=>new L(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&&mt(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,L.prototype),t.meta||={},t.toString=t.toString.bind(t),t};L.prototype=Object.create(Function.prototype),L.prototype[Dt]=!0,Object.defineProperty(L.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:L.resolve(e,this,{})[0]}}catch(e){if(I.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),L.ValidationError=I,L.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},L.prototype.set=function(e,t){return this.dict[e]=t,this},L.prototype.push=function(e){return this.list.push(e),this};function kt(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 At(e){return e?.$value??e?.$inner}function jt(e){return pt(e??{},e=>!e.startsWith(`$`))}L.prototype.i18n=function(e){let t=L(this),n=kt(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=mt(t.dict,(t,n)=>t.i18n(mt(e,e=>At(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(mt(e,(e={})=>Array.isArray(At(e))?At(e)[n]:Array.isArray(e)?e[n]:jt(e)))),t.inner&&=t.inner.i18n(mt(e,e=>At(e)?At(e):jt(e))),t.sKey&&=t.sKey.i18n(mt(e,e=>e?.$key)),t},L.prototype.extra=function(e,t){let n=L(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(L.prototype,{[e](t=!0){let n=L(this);return n.meta={...n.meta,[e]:t},n}});L.prototype.deprecated=function(){let e=L(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},L.prototype.experimental=function(){let e=L(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},L.prototype.pattern=function(e){let t=L(this),n=ht(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},L.prototype.simplify=function(e){if(yt(e)&&(e=e.get()),Tt(e,this.meta.default,this.type===`dict`))return null;if(dt(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`||!dt(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 L.resolve(e,t,{}),t.simplify(e)}catch{}return e},L.prototype.toString=function(e){return Bt[this.type]?.(this,e)??`Schema<${this.type}>`},L.prototype.role=function(e,t){let n=L(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(L.prototype,{[e](t){let n=L(this);return n.meta={...n.meta,[e]:t},n}});L.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let Mt={},Nt=Symbol(`checked-volatile-schema`);function Pt(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 I(`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))Pt(i,[...t,n],a,r);if(e.sKey&&Pt(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[Dt])&&Pt(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)Pt(e.list[n],[...t,String(n)],!0,r)}L.extend=function(e,t){Mt[e]=t},L.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[Nt]||(Pt(t,n.path),n={...n,[Nt]:!0}),t.meta?.volatile){let i=L(t);i.meta={...t.meta,volatile:!1};let[a,o]=L.resolve(e,i,n,r);try{return[vt(a),o]}catch(e){throw new I(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(dt(e)&&t.type!==`lazy`){if(t.meta.required)throw new I(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&dt(i);)r=r.list[0],i=r?.meta.default;if(dt(i))return[e];e=wt(i)}let i=Mt[t.type];if(!i)throw new I(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},L.from=function(e){if(dt(e))return L.any();if([`string`,`number`,`boolean`].includes(typeof e))return L.const(e).required();if(e[Dt])return e;if(typeof e==`function`)switch(e){case String:return L.string().required();case Number:return L.number().required();case Boolean:return L.boolean().required();case Function:return L.function().required();default:return L.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},L.lazy=function(e){let t=new L({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[Dt]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},L.natural=function(){return L.number().step(1).min(0)},L.percent=function(){return L.number().step(.01).min(0).max(1).role(`slider`)},L.date=function(){return L.union([L.is(Date),L.transform(L.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new I(`invalid date "${e}"`,t);return n},!0)])},L.regExp=function(e=``){return L.union([L.is(RegExp),L.transform(L.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new I(e.message,n)}},!0)])},L.arrayBuffer=function(e){return L.union([L.is(ArrayBuffer),L.is(SharedArrayBuffer),L.transform(L.any(),(e,t)=>{if(Ct.isSource(e))return Ct.fromSource(e);throw new I(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[L.transform(L.string(),(t,n)=>{try{return e===`base64`?Ct.fromBase64(t):Ct.fromHex(t)}catch(e){throw new I(e.message,n)}},!0)]:[]])},L.extend(`lazy`,(e,t,n,r)=>(t.inner[Dt]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},Pt(t.inner,n.path,!0)),L.resolve(e,t.inner,n,r))),L.extend(`any`,e=>[e]),L.extend(`never`,(e,t,n)=>{throw new I(`expected nullable but got ${e}`,n)}),L.extend(`const`,(e,{value:t},n)=>{if(Tt(e,t))return[t];throw new I(`expected ${t} but got ${e}`,n)});function Ft(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new I(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new I(`expected ${n} >= ${o} but got ${e}`,r)}L.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new I(`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 I(`expect string to match regexp ${r}`,n)}return Ft(e.length,t,`string length`,n),[e]});function It(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 Lt(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(It(e,i)-It(t,i))%It(n,i)===0}L.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new I(`expected number but got ${e}`,n);Ft(e,t,`number`,n);let{step:r}=t;if(r&&!Lt(e,t.min??0,r))throw new I(`expected number multiple of ${r} but got ${e}`,n);return[e]}),L.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new I(`expected boolean but got ${e}`,n)}),L.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 I(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new I(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),L.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new I(`expected function but got ${e}`,n)}),L.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new I(`expected ${t.name} but got ${e}`,n)}{if(dt(e))throw new I(`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 I(`expected ${t} but got ${e}`,n)}});function Rt(e,t,n,r){try{let[i,a]=L.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?vt(n.meta.default):n.meta.default}}L.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new I(`expected array but got ${e}`,r);return Ft(e.length,n,`array length`,r,!dt(t.meta.default)),[e.map((n,i)=>Rt(e,i,t,r))]}),L.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!ft(e))throw new I(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=L.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=Rt(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),L.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new I(`expected array but got ${e}`,n);let i=t.map((t,r)=>Rt(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function zt(e,t){for(let n in t)n in e||(e[n]=t[n])}L.extend(`object`,(e,{dict:t},n,r)=>{if(!ft(e))throw new I(`expected object but got ${e}`,n);let i={};for(let r in t){let a=Rt(e,r,t[r],n);(!dt(a)||r in e)&&(i[r]=a)}return r||zt(i,e),[i]}),L.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return L.resolve(e,n,r,i)}catch(e){a.push(e)}throw new I(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),L.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=L.resolve(e,i,r,!0)[0];if(!dt(t)){if(dt(a))a=t;else if(typeof a!=typeof t)throw new I(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)zt(a??={},t);else if(a!==t)throw new I(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&ft(e)&&zt(a,e),[a]}),L.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=L.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let Bt={};function Vt(e,t,n){Bt[e]=n,Object.assign(L,{[e](...n){let r=new L({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??L.string();break;case`inner`:r.inner=L.from(n[t]);break;case`list`:r.list=n[t].map(L.from);break;case`dict`:r.dict=mt(n[t],L.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}})}Vt(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),Vt(`any`,[],()=>`any`),Vt(`never`,[],()=>`never`),Vt(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),Vt(`string`,[],()=>`string`),Vt(`number`,[],()=>`number`),Vt(`boolean`,[],()=>`boolean`),Vt(`bitset`,[`bits`],()=>`bitset`),Vt(`function`,[],()=>`function`),Vt(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),Vt(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),Vt(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),Vt(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),Vt(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),Vt(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),Vt(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let Ht=[0,15,30,60,120,240,1440],Ut={showRecentVisits:!0,tabIdleTimeoutMinutes:60},Wt={showRecentVisits:L.boolean().default(!0),tabIdleTimeoutMinutes:L.natural().max(1440).default(60)},Gt=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Gt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Gt,e.textContent=`._0lPQtW_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}._0lPQtW_text{flex:160px;min-width:0}._0lPQtW_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}._0lPQtW_menu{flex:none;margin-inline-start:auto}._0lPQtW_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}._0lPQtW_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}._0lPQtW_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){._0lPQtW_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}._0lPQtW_error{padding-bottom:12px;font-size:12px;line-height:18px}._0lPQtW_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._0lPQtW_title{font-size:14px;line-height:20px}._0lPQtW_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Kt={description:`_0lPQtW_description`,error:`_0lPQtW_error`,menu:`_0lPQtW_menu`,row:`_0lPQtW_row`,selector:`_0lPQtW_selector`,text:`_0lPQtW_text`,timeoutRow:`_0lPQtW_timeoutRow`,title:`_0lPQtW_title`,titleLine:`_0lPQtW_titleLine`};function qt({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:Kt.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Kt.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Kt.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Kt.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:Kt.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:`${Kt.row} ${Kt.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Kt.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:Kt.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(a.Menu,{className:Kt.menu,open:u&&c&&!f,onClose:()=>d(!1),items:Ht.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=Ht.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Kt.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:Kt.error,role:`alert`,children:r(`recent.settings.error`)})]})}function Jt(e,t,n){let r=e=>n.set(`showRecentVisits`,e),i=e=>n.set(`tabIdleTimeoutMinutes`,e),a={scrollLeft:0};e.inject([`uiSession`,`connection`,`sessions`,`workspaces`],e=>{e.effect(()=>{let r,i=!1,o=!1,s=!1,c=n.getSnapshot().value?.showRecentVisits,l=n.getSnapshot().value?.tabIdleTimeoutMinutes,u=()=>{r!==void 0&&clearTimeout(r),r=void 0},d=()=>{if(!s){if(i)o=!0;else{i=!0;try{do{o=!1,u();let i=n.getSnapshot().value;if(i===void 0||!i.showRecentVisits||i.tabIdleTimeoutMinutes<=0||document.visibilityState!==`visible`||e.connection.state.getSnapshot()!==`connected`||t.opening.getSnapshot().state===`loading`)continue;let{changed:c,nextDelayMs:l}=t.recentVisits.expireInactive(i.tabIdleTimeoutMinutes*6e4,e.uiSession.sessionStatus.getSnapshot());c&&t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0),!s&&!o&&l!==void 0&&(r=setTimeout(d,Math.max(1,Math.min(l,6e4))))}while(o&&!s)}finally{i=!1}}}},f=[n.subscribe(()=>{let e=n.getSnapshot().value,t=e?.showRecentVisits,r=e?.tabIdleTimeoutMinutes;(t!==c||r!==l)&&(c=t,l=r,d())}),e.connection.state.subscribe(d),t.opening.subscribe(d),t.recentVisits.entries.subscribe(d),e.uiSession.sessionStatus.subscribe(d),e.sessions.list.subscribe(d),e.workspaces.list.subscribe(d)];return document.addEventListener(`visibilitychange`,d),window.addEventListener(`pageshow`,d),d(),()=>{s=!0,u();for(let e of f)e();document.removeEventListener(`visibilitychange`,d),window.removeEventListener(`pageshow`,d)}},`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}})},Qe)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},ut)),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`}}},lt)),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})},qt))}let Yt=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Yt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Yt,e.textContent=`.GyPSUW_options{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;align-items:flex-start;gap:8px;padding-block:6px;display:flex}.GyPSUW_settingsText{flex:240px}.GyPSUW_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}.GyPSUW_promptHeading{justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;display:flex}.GyPSUW_promptHeading strong{font-weight:500}.GyPSUW_comparison{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.GyPSUW_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}.GyPSUW_choice+.GyPSUW_choice{border-inline-start:1px solid var(--dsw-alias-border-l2);border-radius:0 5px 5px 0}.GyPSUW_choice[aria-checked=true]{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.GyPSUW_choiceTitle{padding:0 8px 2px;font-size:12px;font-weight:500;display:block}.GyPSUW_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}.GyPSUW_preview{pointer-events:none;user-select:none;grid-auto-rows:44px;min-width:0;display:grid;overflow:hidden}.GyPSUW_preview .GyPSUW_sampleRow{--dsh-thread-row-height:22px;--dsh-workspace-indent:0px;--dsh-thread-indent:0px;min-height:0;padding-inline:6px}.GyPSUW_preview [data-session-title]{margin-inline:7px 0;font-size:11px}.GyPSUW_preview .GyPSUW_sampleSummary{margin-block-end:0;padding:0 0 0 7px;font-size:9px;line-height:11px}.GyPSUW_sampleIcon{flex-shrink:0;width:14px;height:14px;display:inline-flex}.GyPSUW_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 8px;font-size:11px;line-height:1.5}.GyPSUW_later{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;flex-shrink:0;padding:4px}.GyPSUW_choice:focus-visible,.GyPSUW_later:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.GyPSUW_error{color:var(--dsw-alias-state-warn-primary);overflow-wrap:anywhere;flex-basis:100%;margin-top:6px;font-size:12px}@media (width<=639px){.GyPSUW_choiceTitle,.GyPSUW_choiceSubtitle{padding-inline:6px}.GyPSUW_preview [data-session-title]{font-size:10px}}@media (hover:none),(pointer:coarse){.GyPSUW_later{min-height:44px}}`,document.head.appendChild(e)}var Xt={choice:`GyPSUW_choice`,choiceSubtitle:`GyPSUW_choiceSubtitle`,choiceTitle:`GyPSUW_choiceTitle`,comparison:`GyPSUW_comparison`,error:`GyPSUW_error`,hint:`GyPSUW_hint`,later:`GyPSUW_later`,options:`GyPSUW_options`,preview:`GyPSUW_preview`,prompt:`GyPSUW_prompt`,promptHeading:`GyPSUW_promptHeading`,sampleIcon:`GyPSUW_sampleIcon`,sampleRow:`GyPSUW_sampleRow`,sampleSummary:`GyPSUW_sampleSummary`,settingsText:`GyPSUW_settingsText`};let Zt=[`summary`,`ring`];function Qt(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 $t({style:e,setStyle:t,t:n,settings:r=!1}){let i=(0,s.useId)(),{busy:c,failed:l,save:u}=Qt(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:r?a.preferenceRowStyles.row:Xt.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${a.preferenceRowStyles.rowText} ${r?Xt.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:Zt.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:Xt.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function en({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)($t,{style:r,setStyle:t,t:n,settings:!0})}let tn={...Ut,threadTreeCollapseStyle:`summary`},nn=L.object({...Wt,threadTreeCollapseStyle:L.union([`summary`,`ring`]).default(`summary`)});function rn(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function an(e){let t=e.configForms.registerBrowser(`ui-workspace`,nn.toJSON(),{...tn});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)})},en)),t}function on(e,t){return e!==void 0&&e.has(t)}function sn(e,t,n,r={}){if(n===void 0||t===n)return!1;let i=e.find(e=>e.workspaceId===t),a=e.find(e=>e.workspaceId===n);return!(i===void 0||a===void 0||on(r.sectionOf,t)||on(r.sectionOf,n)||r.parents!==void 0&&r.parents.get(t)!==r.parents.get(n))}function cn(e,t,n,r={}){if(!sn(e,t,n.id,r))return null;let i=r.parents?.get(t),a=e.filter(e=>!on(r.sectionOf,e.workspaceId)&&r.parents?.get(e.workspaceId)===i),o=a.findIndex(e=>e.workspaceId===n.id),s=a.findIndex(e=>e.workspaceId===t);if(o===-1||s===-1)return null;let c=n.half===`before`?n.id:a[o+1]?.workspaceId;if(c===t)return null;let l=c===void 0?a.length:a.findIndex(e=>e.workspaceId===c);return l===s||l===s+1?null:{beforeWorkspaceId:c}}function ln(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=ln(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function R(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ln(e))&&(r&&(r+=` `),r+=t);return r}function un(e,t){return e===`default-workspace`?t:e}let dn={},fn=(0,s.createContext)({t:e=>e,forest:[],expansion:dn,rows:e=>w(e,dn),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function pn(){return(0,s.useContext)(fn)}function mn({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:a,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=rn(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.pinnedSessionIds),v=i(e=>e.archivedSessionIds),y=i(e=>e.threadSections),ee=r(e=>e.threadExpansion??dn),b=r(e=>e.archivedFilter??`default`),x=(0,s.useMemo)(()=>fe(g,{pinnedSessionIds:_,archivedSessionIds:v,archivedFilter:b,...b===`only`||!y?.length?{}:{sectionedSessionIds:new Set(y.flatMap(e=>e.threadIds))}},/* @__PURE__ */ new Map),[g,_,v,b,y]),S=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of x){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},[x]),C=(0,s.useRef)(void 0),te=(0,s.useCallback)(e=>C.current===e,[]),ne=(0,s.useCallback)(e=>{C.current=e,a.setThreadsExpanded(S.get(e)?.ancestors??[],!0)},[a,S]),T=(0,s.useCallback)(e=>{C.current=void 0;let t=S.get(e);t!==void 0&&a.setThreadsExpanded(t.ancestors,!0)},[a,S]),E=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,D=(0,s.useRef)(``);(0,s.useEffect)(()=>{E===void 0?D.current=``:S.get(E)!==void 0&&D.current!==E&&(D.current=E,te(E)||T(E))},[E,te,T,S]);let O=(0,s.useMemo)(()=>({t:e.t,forest:x,expansion:ee,rows:e=>w(e,ee),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=>S.get(e)?.root.id??e,reveal:T,selectSidebarRow:ne,isSidebarSelection:te}),[e.t,e.markCompletionsRead,a,x,ee,S,T,ne,te,f,d,p,h,l]);return/* @__PURE__ */ (0,o.jsx)(fn.Provider,{value:O,children:t})}function hn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function gn(e,t=`|`){return e.map(e=>Un(e)).join(t)}function _n(e,t){return typeof t==`bigint`?t.toString():t}var vn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function yn(e){return new vn(e)}function bn(e){return e==null}function xn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Sn(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let Cn=/* @__PURE__*/ Symbol(`evaluating`);function wn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Cn)return r===void 0&&(r=Cn,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Tn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function En(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Dn(e){return En(e._zod.def)??e._zod.def.shape}function On(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Tn(this,t,e),e},enumerable:!0,configurable:!0})}function kn(e,t,n){t in e?Tn(e,t,n):e[t]=n}function An(e,t,n,r){let i=Dn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?On(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):kn(e,a,r?r(n.value,a):n.value))}}function jn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?On(e,n,()=>t[n]):kn(e,n,r.value))}}function Mn(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Nn(e){return JSON.stringify(e)}function Pn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let Fn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function In(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let Ln=/* @__PURE__*/ yn(()=>{if(Mr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Rn(e){if(In(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return In(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function zn(e){return Rn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let Bn=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Vn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Hn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Un(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Wn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let Gn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Kn={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function qn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return An(i,e,Jn(e,t)),Hn(e,Mn(n,{shape:i,checks:[]}))}function Jn(e,t){let n=Dn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Yn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Jn(e,t)),a={};return An(a,e,Reflect.ownKeys(Dn(e)).filter(e=>!i.has(e))),Hn(e,Mn(n,{shape:a,checks:[]}))}function Xn(e,t){if(!Rn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Dn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Hn(e,Mn(e._zod.def,{shape:Zn(e,t)}))}function Zn(e,t){let n={};return An(n,e,Reflect.ownKeys(Dn(e))),jn(n,t),n}function Qn(e,t){if(!Rn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Hn(e,Mn(e._zod.def,{shape:Zn(e,t)}))}function $n(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return An(n,e,Reflect.ownKeys(Dn(e))),An(n,t,Reflect.ownKeys(Dn(t))),Hn(e,Mn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function er(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Jn(t,n)):void 0,o={};return An(o,t,Reflect.ownKeys(Dn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Hn(t,Mn(t._zod.def,{shape:o,checks:[]}))}function tr(e,t,n){let r=n?new Set(Jn(t,n)):void 0,i={};return An(i,t,Reflect.ownKeys(Dn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Hn(t,Mn(t._zod.def,{shape:i}))}function nr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function rr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ir(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ar(e){return typeof e==`string`?e:e?.message}function or(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function sr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function cr(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ar(e.inst?._zod.def?.error?.(e))??ar(a?.(e))??ar(t?.error?.(e))??ar(n.customError?.(e))??ar(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let lr=/[\uD800-\uDBFF]/;function ur(e){let t=e.length;if(!lr.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function dr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function fr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function pr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function mr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):vr(e,n,r.value)}}function hr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function gr(e,t,n){return hr(e,t,n,!1)}function _r(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return hr(this,n,r(this))},set(e){hr(this,n,e)}})}return t}function vr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:hr(this,t,n.bind(this))},set(e){hr(this,t,e)}})}function yr(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let br,xr=!1,Sr={configurable:!0,get(){xr=!0}};function B(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&br!==e._zod?br=void 0:(br=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Sr);let e=xr;xr=!1;try{let r=n(this);return xr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),xr||=e,r}catch(n){throw delete this[t],xr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Cr(e,t,n,r){let i=yr(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function wr(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Tr;let Er=/*@__PURE__*/ Object.freeze({status:`aborted`}),Dr={value:void 0,enumerable:!1},Or=`captureStackTrace`in Error?Error:null;function kr(e){let t=Or;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Or=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function V(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Dr.value=new a(r);try{Object.defineProperty(n,"_zod",Dr)}finally{Dr.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),mr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?kr(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ar=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},jr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Tr=globalThis).__zod_globalConfig??(Tr.__zod_globalConfig={});let Mr=globalThis.__zod_globalConfig;function Nr(e){return e&&Object.assign(Mr,e),Mr}function Pr(){let e=this._zod;return e.message??=JSON.stringify(e.def,_n,2),e.message}function Fr(e){this._zod.message=e}let Ir={get:Pr,set:Fr,enumerable:!0,configurable:!0},Lr={value:void 0,enumerable:!1},Rr=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),zr=(e,t)=>{e.name=`$ZodError`,Lr.value=t,Object.defineProperty(e,"issues",Lr),Lr.value=void 0,Object.defineProperty(e,"message",Ir);let n=Object.getPrototypeOf(e);Rr.has(n)||(Rr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Br=V(`$ZodError`,zr);V(`$ZodError`,zr,void 0,{Parent:Error});function Vr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Hr(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Vr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ur(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Wr(e,t){return{callee:t?.callee??e,Err:t?.Err}}let Gr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ar;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>cr(e,o,Nr())));throw Fn(n,a?.callee??t),n}return s.value};return t},Kr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>cr(e,o,Nr())));throw Fn(n,a?.callee??t),n}return s.value};return t},qr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ar;return a.issues.length?Jr(e,a.issues,i):{success:!0,data:a.value}};function Jr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>cr(e,n,Nr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let Yr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Jr(e,a.issues,i):{success:!0,data:a.value}},Xr=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),Zr=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),Qr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Xr)return!0;if(r.definite===!0&&n===void 0)return!1}return $r(e,t,n)});function $r(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Zr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Ar;return a.issues.length===0}let ei=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ti=e=>{let t=Gr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Wr(n,a))};return n},ni=e=>{let t=Gr(e),n=(e,r,i,a)=>t(e,r,i,Wr(n,a));return n},ri=e=>{let t=Kr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Wr(n,a))};return n},ii=e=>{let t=Kr(e),n=async(e,r,i,a)=>await t(e,r,i,Wr(n,a));return n},ai=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qr(e)(t,n,i)},oi=e=>(t,n,r)=>qr(e)(t,n,r),si=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Yr(e)(t,n,i)},ci=e=>async(t,n,r)=>Yr(e)(t,n,r),li=/^[cC][0-9a-z]{6,}$/,ui=/^[0-9a-z]+$/,di=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,fi=/^[0-9a-vA-V]{20}$/,pi=/^[A-Za-z0-9]{27}$/,mi=/^[a-zA-Z0-9_-]{21}$/;function hi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let gi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_i=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,yi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function bi(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let xi=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Si=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ci=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,wi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ti=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ei=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Di=/^https?$/,Oi=/^\+[1-9]\d{6,14}$/,ki=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ai(e){return RegExp(`^${e}$`)}let ji=/*@__PURE__*/ Ai(ki);function Mi(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ni(e){return RegExp(`^${Mi(e)}$`)}function Pi(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Mi({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Mi({precision:e.precision})}`:n;return RegExp(`^${ki}T(?:${r})$`)}let Fi=/^[\s\S]{0,}$/,Ii=/^-?\d+$/,Li=/^-?\d+(?:\.\d+)?$/,Ri=/^(?:true|false)$/i,zi=/^null$/i,Bi=/^[^A-Z]*$/,Vi=/^[^a-z]*$/,Hi=/*@__PURE__*/ V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ui=e=>{let t=e.value;return!bn(t)&&t.length!==void 0},Wi={number:`number`,bigint:`bigint`,object:`date`},Gi=/*@__PURE__*/ V(`$ZodCheckLessThan`,(e,t)=>{Hi.init(e,t);let n=Wi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Wi[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ki=/*@__PURE__*/ V(`$ZodCheckGreaterThan`,(e,t)=>{Hi.init(e,t);let n=Wi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Wi[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qi=/*@__PURE__*/ V(`$ZodCheckMultipleOf`,(e,t)=>{Hi.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Sn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ji=/*@__PURE__*/ V(`$ZodCheckNumberFormat`,(e,t)=>{Hi.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Gn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Yi=/*@__PURE__*/ V(`$ZodCheckMaxLength`,(e,t)=>{var n;Hi.init(e,t),(n=e._zod.def).when??(n.when=Ui),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?ur(r):i)<=t.maximum)return;let a=dr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xi=/*@__PURE__*/ V(`$ZodCheckMinLength`,(e,t)=>{var n;Hi.init(e,t),(n=e._zod.def).when??(n.when=Ui),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ur(r):i)>=t.minimum)return;let a=dr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zi=/*@__PURE__*/ V(`$ZodCheckLengthEquals`,(e,t)=>{var n;Hi.init(e,t),(n=e._zod.def).when??(n.when=Ui),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?ur(r):i;if(a===t.length)return;let o=dr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qi=/*@__PURE__*/ V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Hi.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$i=/*@__PURE__*/ V(`$ZodCheckRegex`,(e,t)=>{Qi.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ea=/*@__PURE__*/ V(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Bi,Qi.init(e,t)}),ta=/*@__PURE__*/ V(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Vi,Qi.init(e,t)}),na=/*@__PURE__*/ V(`$ZodCheckIncludes`,(e,t)=>{Hi.init(e,t);let n=Vn(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ra=/*@__PURE__*/ V(`$ZodCheckStartsWith`,(e,t)=>{Hi.init(e,t);let n=RegExp(`^${Vn(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ia=/*@__PURE__*/ V(`$ZodCheckEndsWith`,(e,t)=>{Hi.init(e,t);let n=RegExp(`.*${Vn(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),aa=/*@__PURE__*/ V(`$ZodCheckOverwrite`,(e,t)=>{Hi.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var oa=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
10
10
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
11
|
-
`)}\n};`)(...Object.values(this.closed))}};let ra={major:4,minor:6,patch:7},ia=/*@__PURE__*/ V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ra;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Qn(t),a;for(let o of n){if(o._zod.def.when){if($n(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Er;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(rr(t.issues,n,e),i||=Qn(t,n))});else{if(t.issues.length===n)continue;rr(t.issues,n,e),i||=Qn(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Qn(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Er;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Er;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return fr(this,`~standard`,sa(this))},set"~standard"(e){dr(this,`~standard`,e)}}),aa=(e,t)=>e.issues.length?{issues:e.issues.map(e=>ir(e,t,kr()))}:{value:e.value};async function oa(e,t){let n={async:!0};return aa(await e._zod.run({value:t,issues:[]},n),n)}function sa(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return aa(r,n)}catch{}return oa(e,t)},vendor:`zod`,version:1}}let ca=/*@__PURE__*/ V(`$ZodString`,(e,t)=>{ia.init(e,t),e._zod.pattern=t.pattern??ji,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),la=/*@__PURE__*/ V(`$ZodStringFormat`,(e,t)=>{Ji.init(e,t),ca.init(e,t)}),ua=/*@__PURE__*/ V(`$ZodGUID`,(e,t)=>{t.pattern??=pi,la.init(e,t)}),da=/*@__PURE__*/ V(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=mi(e)}else t.pattern??=mi();la.init(e,t)}),fa=/*@__PURE__*/ V(`$ZodEmail`,(e,t)=>{t.pattern??=hi,la.init(e,t)});function pa(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ma(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?pa(e)||2:ha(e,t)}function ha(e,t){if(!t.normalize&&t.protocol?.source===Ci.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let ga=/[\t\n\r]/g;function _a(e){return e.replace(ga,``)}function va(e,t){return t.lastIndex=0,t.test(e.hostname)}function ya(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let ba=/*@__PURE__*/ V(`$ZodURL`,(e,t)=>{la.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=ma(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=_a(r);return}t.hostname&&!va(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ya(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:_a(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),xa=/*@__PURE__*/ V(`$ZodEmoji`,(e,t)=>{t.pattern??=gi(),la.init(e,t)}),Sa=/*@__PURE__*/ V(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?ui:di(t.length),la.init(e,t)}),Ca=/*@__PURE__*/ V(`$ZodCUID`,(e,t)=>{t.pattern??=ai,la.init(e,t)}),wa=/*@__PURE__*/ V(`$ZodCUID2`,(e,t)=>{t.pattern??=oi,la.init(e,t)}),Ta=/*@__PURE__*/ V(`$ZodULID`,(e,t)=>{t.pattern??=si,la.init(e,t)}),Ea=/*@__PURE__*/ V(`$ZodXID`,(e,t)=>{t.pattern??=ci,la.init(e,t)}),Da=/*@__PURE__*/ V(`$ZodKSUID`,(e,t)=>{t.pattern??=li,la.init(e,t)}),Oa=/*@__PURE__*/ V(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ai(t),la.init(e,t)}),ka=/*@__PURE__*/ V(`$ZodISODate`,(e,t)=>{t.pattern??=Di,la.init(e,t)}),Aa=/*@__PURE__*/ V(`$ZodISOTime`,(e,t)=>{t.pattern??=ki(t),la.init(e,t)}),ja=/*@__PURE__*/ V(`$ZodISODuration`,(e,t)=>{t.pattern??=fi,la.init(e,t)}),Ma=/*@__PURE__*/ V(`$ZodIPv4`,(e,t)=>{t.pattern??=_i,la.init(e,t)}),Na=/^[0-9a-fA-F:.]+$/;function Pa(e){return Na.test(e)?pa(`http://[${e}]`):!1}let Fa=/*@__PURE__*/ V(`$ZodIPv6`,(e,t)=>{t.pattern??=vi,la.init(e,t),e._zod.check=n=>{Pa(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ia=/*@__PURE__*/ V(`$ZodCIDRv4`,(e,t)=>{t.pattern??=yi,la.init(e,t)});function La(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Pa(n)}let Ra=/*@__PURE__*/ V(`$ZodCIDRv6`,(e,t)=>{t.pattern??=bi,la.init(e,t),e._zod.check=n=>{La(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function za(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Ba=/^[0-9a-zA-Z+/]*={0,2}$/,Va=/*@__PURE__*/ V(`$ZodBase64`,(e,t)=>{t.pattern??=Ba,la.init(e,t),e._zod.check=n=>{za(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ha=/^[A-Za-z0-9_-]*$/;function Ua(e){if(!Ha.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return za(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let Wa=/*@__PURE__*/ V(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ha,la.init(e,t),e._zod.check=n=>{Ua(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ga=/*@__PURE__*/ V(`$ZodE164`,(e,t)=>{t.pattern??=wi,la.init(e,t)});function Ka(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let qa=/*@__PURE__*/ V(`$ZodJWT`,(e,t)=>{la.init(e,t),e._zod.check=n=>{Ka(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ja=/*@__PURE__*/ V(`$ZodNumber`,(e,t)=>{ia.init(e,t),e._zod.pattern=Ni,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Ya=/*@__PURE__*/ V(`$ZodNumberFormat`,(e,t)=>{Wi.init(e,t),Ja.init(e,t)}),Xa=/*@__PURE__*/ V(`$ZodBoolean`,(e,t)=>{ia.init(e,t),e._zod.pattern=Pi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Za=/*@__PURE__*/ V(`$ZodNull`,(e,t)=>{ia.init(e,t),e._zod.pattern=Fi,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Qa=/*@__PURE__*/ V(`$ZodUnknown`,(e,t)=>{ia.init(e,t),e._zod.parse=e=>e}),$a=/*@__PURE__*/ V(`$ZodNever`,(e,t)=>{ia.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function eo(e,t){let n=nr(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of nr(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,rr(n.issues,t,e),n}}return i(n,a)}}let to=e=>Array.isArray(e)?e.length:-1;function no(e,t,n){e.issues.length&&t.issues.push(...er(n,e.issues)),t.value[n]=e.value}let ro=/*@__PURE__*/ V(`$ZodArray`,(e,t)=>{ia.init(e,t);let n=Or.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>no(t,r,e)));else if(no(c,r,e),s&&c.issues.length!==0&&Qn(c))break}return o.length?Promise.all(o).then(()=>r):r},eo(e,to)});function io(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...er(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let ao=[];function oo(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ao,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Bn(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function so(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Qn(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>io(e,n,i,t,d,f))):io(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let co=/*@__PURE__*/ V(`$ZodObject`,(e,t)=>{ia.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=hn(()=>oo(t));B(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||xn(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Mn,o=t.catchall,s,c=Or.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Qn(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>io(n,t,e,r,a,o))):io(s,t,e,r,a,o)}return o?so(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),lo=/*@__PURE__*/ V(`$ZodObjectJIT`,(e,t)=>{co.init(e,t);let n=e._zod.parse,r=hn(()=>oo(t)),i=Or.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new na([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
11
|
+
`)}\n};`)(...Object.values(this.closed))}};let sa={major:4,minor:6,patch:7},ca=/*@__PURE__*/ V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sa;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=nr(t),a;for(let o of n){if(o._zod.def.when){if(rr(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Ar;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(sr(t.issues,n,e),i||=nr(t,n))});else{if(t.issues.length===n)continue;sr(t.issues,n,e),i||=nr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(nr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Ar;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Ar;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return gr(this,`~standard`,da(this))},set"~standard"(e){hr(this,`~standard`,e)}}),la=(e,t)=>e.issues.length?{issues:e.issues.map(e=>cr(e,t,Nr()))}:{value:e.value};async function ua(e,t){let n={async:!0};return la(await e._zod.run({value:t,issues:[]},n),n)}function da(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return la(r,n)}catch{}return ua(e,t)},vendor:`zod`,version:1}}let fa=/*@__PURE__*/ V(`$ZodString`,(e,t)=>{ca.init(e,t),e._zod.pattern=t.pattern??Fi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),pa=/*@__PURE__*/ V(`$ZodStringFormat`,(e,t)=>{Qi.init(e,t),fa.init(e,t)}),ma=/*@__PURE__*/ V(`$ZodGUID`,(e,t)=>{t.pattern??=_i,pa.init(e,t)}),ha=/*@__PURE__*/ V(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=vi(e)}else t.pattern??=vi();pa.init(e,t)}),ga=/*@__PURE__*/ V(`$ZodEmail`,(e,t)=>{t.pattern??=yi,pa.init(e,t)});function _a(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function va(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?_a(e)||2:ya(e,t)}function ya(e,t){if(!t.normalize&&t.protocol?.source===Di.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let ba=/[\t\n\r]/g;function xa(e){return e.replace(ba,``)}function Sa(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ca(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let wa=/*@__PURE__*/ V(`$ZodURL`,(e,t)=>{pa.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=va(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=xa(r);return}t.hostname&&!Sa(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Ca(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:xa(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ta=/*@__PURE__*/ V(`$ZodEmoji`,(e,t)=>{t.pattern??=bi(),pa.init(e,t)}),Ea=/*@__PURE__*/ V(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?mi:hi(t.length),pa.init(e,t)}),Da=/*@__PURE__*/ V(`$ZodCUID`,(e,t)=>{t.pattern??=li,pa.init(e,t)}),Oa=/*@__PURE__*/ V(`$ZodCUID2`,(e,t)=>{t.pattern??=ui,pa.init(e,t)}),ka=/*@__PURE__*/ V(`$ZodULID`,(e,t)=>{t.pattern??=di,pa.init(e,t)}),Aa=/*@__PURE__*/ V(`$ZodXID`,(e,t)=>{t.pattern??=fi,pa.init(e,t)}),ja=/*@__PURE__*/ V(`$ZodKSUID`,(e,t)=>{t.pattern??=pi,pa.init(e,t)}),Ma=/*@__PURE__*/ V(`$ZodISODateTime`,(e,t)=>{t.pattern??=Pi(t),pa.init(e,t)}),Na=/*@__PURE__*/ V(`$ZodISODate`,(e,t)=>{t.pattern??=ji,pa.init(e,t)}),Pa=/*@__PURE__*/ V(`$ZodISOTime`,(e,t)=>{t.pattern??=Ni(t),pa.init(e,t)}),Fa=/*@__PURE__*/ V(`$ZodISODuration`,(e,t)=>{t.pattern??=gi,pa.init(e,t)}),Ia=/*@__PURE__*/ V(`$ZodIPv4`,(e,t)=>{t.pattern??=xi,pa.init(e,t)}),La=/^[0-9a-fA-F:.]+$/;function Ra(e){return La.test(e)?_a(`http://[${e}]`):!1}let za=/*@__PURE__*/ V(`$ZodIPv6`,(e,t)=>{t.pattern??=Si,pa.init(e,t),e._zod.check=n=>{Ra(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ba=/*@__PURE__*/ V(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ci,pa.init(e,t)});function Va(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ra(n)}let Ha=/*@__PURE__*/ V(`$ZodCIDRv6`,(e,t)=>{t.pattern??=wi,pa.init(e,t),e._zod.check=n=>{Va(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Ua(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Wa=/^[0-9a-zA-Z+/]*={0,2}$/,Ga=/*@__PURE__*/ V(`$ZodBase64`,(e,t)=>{t.pattern??=Wa,pa.init(e,t),e._zod.check=n=>{Ua(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ka=/^[A-Za-z0-9_-]*$/;function qa(e){if(!Ka.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ua(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let Ja=/*@__PURE__*/ V(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ka,pa.init(e,t),e._zod.check=n=>{qa(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ya=/*@__PURE__*/ V(`$ZodE164`,(e,t)=>{t.pattern??=Oi,pa.init(e,t)});function Xa(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let Za=/*@__PURE__*/ V(`$ZodJWT`,(e,t)=>{pa.init(e,t),e._zod.check=n=>{Xa(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Qa=/*@__PURE__*/ V(`$ZodNumber`,(e,t)=>{ca.init(e,t),e._zod.pattern=Li,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),$a=/*@__PURE__*/ V(`$ZodNumberFormat`,(e,t)=>{Ji.init(e,t),Qa.init(e,t)}),eo=/*@__PURE__*/ V(`$ZodBoolean`,(e,t)=>{ca.init(e,t),e._zod.pattern=Ri,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),to=/*@__PURE__*/ V(`$ZodNull`,(e,t)=>{ca.init(e,t),e._zod.pattern=zi,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),no=/*@__PURE__*/ V(`$ZodUnknown`,(e,t)=>{ca.init(e,t),e._zod.parse=e=>e}),ro=/*@__PURE__*/ V(`$ZodNever`,(e,t)=>{ca.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function io(e,t){let n=or(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of or(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,sr(n.issues,t,e),n}}return i(n,a)}}let ao=e=>Array.isArray(e)?e.length:-1;function oo(e,t,n){e.issues.length&&t.issues.push(...ir(n,e.issues)),t.value[n]=e.value}let so=/*@__PURE__*/ V(`$ZodArray`,(e,t)=>{ca.init(e,t);let n=Mr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>oo(t,r,e)));else if(oo(c,r,e),s&&c.issues.length!==0&&nr(c))break}return o.length?Promise.all(o).then(()=>r):r},io(e,ao)});function co(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ir(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let lo=[];function uo(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:lo,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Wn(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function fo(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(nr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>co(e,n,i,t,d,f))):co(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let po=/*@__PURE__*/ V(`$ZodObject`,(e,t)=>{ca.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=yn(()=>uo(t));B(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Tn(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=In,o=t.catchall,s,c=Mr.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(nr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>co(n,t,e,r,a,o))):co(s,t,e,r,a,o)}return o?fo(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),mo=/*@__PURE__*/ V(`$ZodObjectJIT`,(e,t)=>{po.init(e,t);let n=e._zod.parse,r=yn(()=>uo(t)),i=Mr.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new oa([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
12
12
|
let ${e}_ab = false;
|
|
13
13
|
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
14
14
|
const iss = ${e}.issues[i];
|
|
@@ -19,7 +19,7 @@ default:return v(n)}}function ae(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id
|
|
|
19
19
|
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
20
20
|
payload.value = newResult;
|
|
21
21
|
return payload;
|
|
22
|
-
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:
|
|
22
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Nn(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
23
23
|
const ${n}_present = ${i};
|
|
24
24
|
if (!${n}.issues.length || ${n}_present) {
|
|
25
25
|
if (${n}.issues.length) {${c(n,r)}
|
|
@@ -58,78 +58,78 @@ default:return v(n)}}function ae(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id
|
|
|
58
58
|
newResult[${r}] = ${n}.value;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Mn,c=!Or.jitless,l=c&&Nn.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?so([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function uo(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Qn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ir(e,r,kr())))}),t)}let fo=/*@__PURE__*/ V(`$ZodUnion`,(e,t)=>{ia.init(e,t),B(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),B(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),B(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),B(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>_n(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>uo(t,r,e,i)):uo(o,r,e,i)}});function po(e){let t=/* @__PURE__ */ new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}let mo=/*@__PURE__*/ V(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,fo.init(e,t);let n=e._zod.parse;B(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||xn(t,e,/* @__PURE__ */ new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Sn(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=hn(()=>po(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Mn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),ho=/*@__PURE__*/ V(`$ZodIntersection`,(e,t)=>{ia.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>_o(e,t,n)):_o(e,i,a)}});function go(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Pn(e)&&Pn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=go(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=go(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _o(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=go(t.value,n.value);if(!c.valid){if(Qn(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let vo=/*@__PURE__*/ V(`$ZodTuple`,(e,t)=>{ia.init(e,t);let n=t.items,r=Or.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=yo(n,`optin`),l=yo(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=Qn(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(Qn(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>bo(t,i,e))):bo(r,i,e)}}return s.length?Promise.all(s).then(()=>xo(u,i,n,o,l)):xo(u,i,n,o,l)}});function yo(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function bo(e,t,n){e.issues.length&&t.issues.push(...er(n,e.issues)),t.value[n]=e.value}function xo(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...er(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let So=/*@__PURE__*/ V(`$ZodRecord`,(e,t)=>{ia.init(e,t);let n=Or.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Pn(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>ir(e,i,kr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...er(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...er(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ni.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>ir(e,i,kr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...er(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...er(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Co=/*@__PURE__*/ V(`$ZodEnum`,(e,t)=>{ia.init(e,t);let n=dn(t.entries),r=new Set(n);e._zod.values=r,B(e,`pattern`,e=>{let t=dn(e.def.entries).filter(e=>In.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ln(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),wo=/*@__PURE__*/ V(`$ZodLiteral`,(e,t)=>{ia.init(e,t);let n=new Set(t.values);e._zod.values=n,B(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ln(e):e?Ln(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),To=/*@__PURE__*/ V(`$ZodTransform`,(e,t)=>{ia.init(e,t),e._zod.optin=`optional`,Or.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Dr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Er;return n.value=i,n}});function Eo(e,t){return e.value=t.issues.length?void 0:t.value,e}let Do=/*@__PURE__*/ V(`$ZodOptional`,(e,t)=>{ia.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,B(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),B(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_n(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Eo(e,t)):Eo(e,r)}return t.innerType._zod.run(e,n)}}),Oo=/*@__PURE__*/ V(`$ZodExactOptional`,(e,t)=>{Do.init(e,t),B(e,`values`,e=>e.def.innerType._zod.values),B(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ko=/*@__PURE__*/ V(`$ZodNullable`,(e,t)=>{ia.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin),B(e,`optout`,e=>e.def.innerType._zod.optout),B(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_n(t.source)}|null)$`):void 0}),B(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ao=/*@__PURE__*/ V(`$ZodDefault`,(e,t)=>{ia.init(e,t),e._zod.optin=`defaulted`,B(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jo(e,t)):jo(r,t)}});function jo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Mo=/*@__PURE__*/ V(`$ZodPrefault`,(e,t)=>{ia.init(e,t),e._zod.optin=`defaulted`,B(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),No=/*@__PURE__*/ V(`$ZodNonOptional`,(e,t)=>{ia.init(e,t),B(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Po(t,e)):Po(i,e)}});function Po(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Fo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>ir(e,r,kr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let Io=/*@__PURE__*/ V(`$ZodCatch`,(e,t)=>{ia.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),B(e,`optout`,e=>e.def.innerType._zod.optout),B(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Fo(e,r,t,n)):Fo(e,r,t,n)}}),Lo=/*@__PURE__*/ V(`$ZodPipe`,(e,t)=>{ia.init(e,t),B(e,`values`,e=>e.def.in._zod.values),B(e,`optin`,e=>e.def.in._zod.optin),B(e,`optout`,e=>e.def.out._zod.optout),B(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ro(e,t.in,n)):Ro(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ro(e,t.out,n)):Ro(r,t.out,n)}});function Ro(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let zo=/*@__PURE__*/ V(`$ZodReadonly`,(e,t)=>{ia.init(e,t),B(e,`propValues`,e=>e.def.innerType._zod.propValues),B(e,`values`,e=>e.def.innerType._zod.values),B(e,`optin`,e=>e.def.innerType?._zod?.optin),B(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Bo):Bo(r)}});function Bo(e){return e.memo||(e.value=Object.freeze(e.value)),e}let Vo=/*@__PURE__*/ V(`$ZodLazy`,(e,t)=>{ia.init(e,t),bn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),B(e,`pattern`,e=>e.innerType?._zod?.pattern),B(e,`propValues`,e=>e.innerType?._zod?.propValues),B(e,`optin`,e=>e.innerType?._zod?.optin??void 0),B(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ho=/*@__PURE__*/ V(`$ZodCustom`,(e,t)=>{Ri.init(e,t),ia.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Uo(t,n,r,e));Uo(i,n,r,e)}});function Uo(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(lr(e))}}var Wo=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let Go=`~memo`,Ko=[];function qo(e){return typeof e==`object`&&!!e}function Jo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let Yo=/*@__PURE__*/ new WeakMap;function Xo(e,t,n){let r=Yo.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Xo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Xo(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Sn(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Xo(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Zo(e,i)}function Zo(e,t){return t!==1&&Yo.set(e,t===2),t}function Qo(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let $o,es=[],ts={alloc(e,t,n){let r=$o;if(!r)return n;$o=void 0;let i={value:n,issues:null};return r.set(t.value,i),es.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&rs(n,e.value))throw new Wo;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Xo(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!qo(l))return t(s,c);let u=c[Go];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[Go]=u);let d;i===c?d=a:(d=Qo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Jo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;$o=d;let p=es.length,m=t(s,c);$o=void 0;let h=es.length>p?es.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Jo(e.issues):Ko),e)):(h&&(h.issues=m.issues.length?Jo(m.issues):Ko),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ns(){return ts}function rs(e,t){let n=e[Go]?.backEdges;return n!==void 0&&qo(t)&&n.has(t)}let is=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(cr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${zn(e.values[0])}`:`Invalid option: expected one of ${fn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${fn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function as(){return{localeError:is()}}var os,ss=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function cs(){return new ss}(os=globalThis).__zod_globalRegistry??(os.__zod_globalRegistry=cs());let ls=globalThis.__zod_globalRegistry;function us(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
62
|
-
function
|
|
63
|
-
function
|
|
64
|
-
function
|
|
65
|
-
function
|
|
66
|
-
function
|
|
67
|
-
function
|
|
68
|
-
function
|
|
69
|
-
function
|
|
70
|
-
function
|
|
71
|
-
function
|
|
72
|
-
function
|
|
73
|
-
function
|
|
74
|
-
function
|
|
75
|
-
function
|
|
76
|
-
function
|
|
77
|
-
function
|
|
78
|
-
function
|
|
79
|
-
function
|
|
80
|
-
function
|
|
81
|
-
function
|
|
82
|
-
function
|
|
83
|
-
function
|
|
84
|
-
function
|
|
85
|
-
function
|
|
86
|
-
function
|
|
87
|
-
function
|
|
88
|
-
function
|
|
89
|
-
function
|
|
90
|
-
function
|
|
91
|
-
function
|
|
92
|
-
function
|
|
93
|
-
function
|
|
94
|
-
function
|
|
95
|
-
function
|
|
96
|
-
function
|
|
97
|
-
function
|
|
98
|
-
function
|
|
99
|
-
function
|
|
100
|
-
function
|
|
101
|
-
function
|
|
102
|
-
function
|
|
103
|
-
function
|
|
104
|
-
function
|
|
105
|
-
function
|
|
106
|
-
function
|
|
107
|
-
function
|
|
108
|
-
function
|
|
109
|
-
function
|
|
110
|
-
function
|
|
111
|
-
function
|
|
112
|
-
function
|
|
113
|
-
function
|
|
114
|
-
function
|
|
115
|
-
function
|
|
116
|
-
function
|
|
117
|
-
function
|
|
118
|
-
function
|
|
119
|
-
function
|
|
61
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=In,c=!Mr.jitless,l=c&&Ln.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?fo([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function ho(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!nr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>cr(e,r,Nr())))}),t)}let go=/*@__PURE__*/ V(`$ZodUnion`,(e,t)=>{ca.init(e,t),B(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),B(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),B(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),B(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>xn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ho(t,r,e,i)):ho(o,r,e,i)}});function _o(e){let t=/* @__PURE__ */ new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}let vo=/*@__PURE__*/ V(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,go.init(e,t);let n=e._zod.parse;B(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Tn(t,e,/* @__PURE__ */ new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=En(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=yn(()=>_o(t));e._zod.parse=(i,a)=>{let o=i.value;if(!In(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),yo=/*@__PURE__*/ V(`$ZodIntersection`,(e,t)=>{ca.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xo(e,t,n)):xo(e,i,a)}});function bo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Rn(e)&&Rn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=bo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bo(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xo(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=bo(t.value,n.value);if(!c.valid){if(nr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let So=/*@__PURE__*/ V(`$ZodTuple`,(e,t)=>{ca.init(e,t);let n=t.items,r=Mr.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Co(n,`optin`),l=Co(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=nr(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(nr(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>wo(t,i,e))):wo(r,i,e)}}return s.length?Promise.all(s).then(()=>To(u,i,n,o,l)):To(u,i,n,o,l)}});function Co(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function wo(e,t,n){e.issues.length&&t.issues.push(...ir(n,e.issues)),t.value[n]=e.value}function To(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...ir(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let Eo=/*@__PURE__*/ V(`$ZodRecord`,(e,t)=>{ca.init(e,t);let n=Mr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Rn(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>cr(e,i,Nr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ir(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ir(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Li.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>cr(e,i,Nr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ir(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ir(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Do=/*@__PURE__*/ V(`$ZodEnum`,(e,t)=>{ca.init(e,t);let n=hn(t.entries),r=new Set(n);e._zod.values=r,B(e,`pattern`,e=>{let t=hn(e.def.entries).filter(e=>Bn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Vn(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Oo=/*@__PURE__*/ V(`$ZodLiteral`,(e,t)=>{ca.init(e,t);let n=new Set(t.values);e._zod.values=n,B(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Vn(e):e?Vn(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ko=/*@__PURE__*/ V(`$ZodTransform`,(e,t)=>{ca.init(e,t),e._zod.optin=`optional`,Mr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new jr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ar;return n.value=i,n}});function Ao(e,t){return e.value=t.issues.length?void 0:t.value,e}let jo=/*@__PURE__*/ V(`$ZodOptional`,(e,t)=>{ca.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,B(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),B(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${xn(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ao(e,t)):Ao(e,r)}return t.innerType._zod.run(e,n)}}),Mo=/*@__PURE__*/ V(`$ZodExactOptional`,(e,t)=>{jo.init(e,t),B(e,`values`,e=>e.def.innerType._zod.values),B(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),No=/*@__PURE__*/ V(`$ZodNullable`,(e,t)=>{ca.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin),B(e,`optout`,e=>e.def.innerType._zod.optout),B(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${xn(t.source)}|null)$`):void 0}),B(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Po=/*@__PURE__*/ V(`$ZodDefault`,(e,t)=>{ca.init(e,t),e._zod.optin=`defaulted`,B(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Fo(e,t)):Fo(r,t)}});function Fo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Io=/*@__PURE__*/ V(`$ZodPrefault`,(e,t)=>{ca.init(e,t),e._zod.optin=`defaulted`,B(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Lo=/*@__PURE__*/ V(`$ZodNonOptional`,(e,t)=>{ca.init(e,t),B(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ro(t,e)):Ro(i,e)}});function Ro(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function zo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>cr(e,r,Nr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let Bo=/*@__PURE__*/ V(`$ZodCatch`,(e,t)=>{ca.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),B(e,`optout`,e=>e.def.innerType._zod.optout),B(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>zo(e,r,t,n)):zo(e,r,t,n)}}),Vo=/*@__PURE__*/ V(`$ZodPipe`,(e,t)=>{ca.init(e,t),B(e,`values`,e=>e.def.in._zod.values),B(e,`optin`,e=>e.def.in._zod.optin),B(e,`optout`,e=>e.def.out._zod.optout),B(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ho(e,t.in,n)):Ho(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ho(e,t.out,n)):Ho(r,t.out,n)}});function Ho(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let Uo=/*@__PURE__*/ V(`$ZodReadonly`,(e,t)=>{ca.init(e,t),B(e,`propValues`,e=>e.def.innerType._zod.propValues),B(e,`values`,e=>e.def.innerType._zod.values),B(e,`optin`,e=>e.def.innerType?._zod?.optin),B(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Wo):Wo(r)}});function Wo(e){return e.memo||(e.value=Object.freeze(e.value)),e}let Go=/*@__PURE__*/ V(`$ZodLazy`,(e,t)=>{ca.init(e,t),wn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),B(e,`pattern`,e=>e.innerType?._zod?.pattern),B(e,`propValues`,e=>e.innerType?._zod?.propValues),B(e,`optin`,e=>e.innerType?._zod?.optin??void 0),B(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ko=/*@__PURE__*/ V(`$ZodCustom`,(e,t)=>{Hi.init(e,t),ca.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>qo(t,n,r,e));qo(i,n,r,e)}});function qo(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(pr(e))}}var Jo=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let Yo=`~memo`,Xo=[];function Zo(e){return typeof e==`object`&&!!e}function Qo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let $o=/*@__PURE__*/ new WeakMap;function es(e,t,n){let r=$o.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=es(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?es(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=En(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?es(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ts(e,i)}function ts(e,t){return t!==1&&$o.set(e,t===2),t}function ns(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let rs,is=[],as={alloc(e,t,n){let r=rs;if(!r)return n;rs=void 0;let i={value:n,issues:null};return r.set(t.value,i),is.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ss(n,e.value))throw new Jo;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=es(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!Zo(l))return t(s,c);let u=c[Yo];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[Yo]=u);let d;i===c?d=a:(d=ns(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Qo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;rs=d;let p=is.length,m=t(s,c);rs=void 0;let h=is.length>p?is.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Qo(e.issues):Xo),e)):(h&&(h.issues=m.issues.length?Qo(m.issues):Xo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function os(){return as}function ss(e,t){let n=e[Yo]?.backEdges;return n!==void 0&&Zo(t)&&n.has(t)}let cs=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(fr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Un(e.values[0])}`:`Invalid option: expected one of ${gn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${gn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ls(){return{localeError:cs()}}var us,ds=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function fs(){return new ds}(us=globalThis).__zod_globalRegistry??(us.__zod_globalRegistry=fs());let ps=globalThis.__zod_globalRegistry;function ms(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
62
|
+
function hs(e,t){return new e(ms({type:`string`,...z(t)}))}// @__NO_SIDE_EFFECTS__
|
|
63
|
+
function gs(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
64
|
+
function _s(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
65
|
+
function vs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
66
|
+
function ys(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
67
|
+
function bs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
68
|
+
function xs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
69
|
+
function Ss(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
70
|
+
function Cs(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
71
|
+
function ws(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
72
|
+
function Ts(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
73
|
+
function Es(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
74
|
+
function Ds(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
75
|
+
function Os(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
76
|
+
function ks(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
77
|
+
function As(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
78
|
+
function js(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
79
|
+
function Ms(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
80
|
+
function Ns(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
81
|
+
function Ps(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
82
|
+
function Fs(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
83
|
+
function Is(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
84
|
+
function Ls(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
85
|
+
function Rs(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
86
|
+
function zs(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
87
|
+
function Bs(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
88
|
+
function Vs(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
89
|
+
function Hs(e,t){return new e(ms({type:`number`,checks:[],...z(t)}))}// @__NO_SIDE_EFFECTS__
|
|
90
|
+
function Us(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
91
|
+
function Ws(e,t){return new e({type:`boolean`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
92
|
+
function Gs(e,t){return new e({type:`null`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
93
|
+
function Ks(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
|
|
94
|
+
function qs(e,t){return new e({type:`never`,...z(t)})}// @__NO_SIDE_EFFECTS__
|
|
95
|
+
function Js(e,t){return new Gi({check:`less_than`,...z(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
|
|
96
|
+
function Ys(e,t){return new Gi({check:`less_than`,...z(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
97
|
+
function Xs(e,t){return new Ki({check:`greater_than`,...z(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
|
|
98
|
+
function Zs(e,t){return new Ki({check:`greater_than`,...z(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
99
|
+
function Qs(e,t){return new qi({check:`multiple_of`,...z(t),value:e})}// @__NO_SIDE_EFFECTS__
|
|
100
|
+
function $s(e,t){return new Yi({check:`max_length`,...z(t),maximum:e})}// @__NO_SIDE_EFFECTS__
|
|
101
|
+
function ec(e,t){return new Xi({check:`min_length`,...z(t),minimum:e})}// @__NO_SIDE_EFFECTS__
|
|
102
|
+
function tc(e,t){return new Zi({check:`length_equals`,...z(t),length:e})}// @__NO_SIDE_EFFECTS__
|
|
103
|
+
function nc(e,t){return new $i({check:`string_format`,format:`regex`,...z(t),pattern:e})}// @__NO_SIDE_EFFECTS__
|
|
104
|
+
function rc(e){return new ea({check:`string_format`,format:`lowercase`,...z(e)})}// @__NO_SIDE_EFFECTS__
|
|
105
|
+
function ic(e){return new ta({check:`string_format`,format:`uppercase`,...z(e)})}// @__NO_SIDE_EFFECTS__
|
|
106
|
+
function ac(e,t){return new na({check:`string_format`,format:`includes`,...z(t),includes:e})}// @__NO_SIDE_EFFECTS__
|
|
107
|
+
function oc(e,t){return new ra({check:`string_format`,format:`starts_with`,...z(t),prefix:e})}// @__NO_SIDE_EFFECTS__
|
|
108
|
+
function sc(e,t){return new ia({check:`string_format`,format:`ends_with`,...z(t),suffix:e})}// @__NO_SIDE_EFFECTS__
|
|
109
|
+
function cc(e){return new aa({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
|
|
110
|
+
function lc(e){return/* @__PURE__ */ cc(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
|
|
111
|
+
function uc(){return/* @__PURE__ */ cc(e=>e.trim())}// @__NO_SIDE_EFFECTS__
|
|
112
|
+
function dc(){return/* @__PURE__ */ cc(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
|
|
113
|
+
function fc(){return/* @__PURE__ */ cc(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
|
|
114
|
+
function pc(){return/* @__PURE__ */ cc(e=>Pn(e))}// @__NO_SIDE_EFFECTS__
|
|
115
|
+
function mc(e,t,n){return new e({type:`array`,element:t,...z(n)})}// @__NO_SIDE_EFFECTS__
|
|
116
|
+
function hc(e,t,n){let r=z(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
|
|
117
|
+
function gc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...z(n)})}// @__NO_SIDE_EFFECTS__
|
|
118
|
+
function _c(e,t){let n=/* @__PURE__ */ vc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(pr(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(pr(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
|
|
119
|
+
function vc(e,t){let n=new Hi({check:`custom`,...z(t)});return n._zod.check=e,n}function yc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Tn(e,t,n[t]);return e}function bc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ps,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function xc(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Sc(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Sc(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&yc(o.schema,c),t.io===`input`&&Mc(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Cc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function wc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Cc(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Cc(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
120
120
|
|
|
121
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function xc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;xc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let Sc=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Cc=[`oneOf`,`anyOf`];function wc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Tc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Sc.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??wc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}xn(n,r,e.length===1?e[0]:Tc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=wc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ec(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Sc)if(t in e)return;let n=t.filter(e=>Cc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Tc(t);else{let e=n[0],i=Cc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Tc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,hc(e,r))}function Dc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):hc(i,s),hc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())xc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ec(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}hc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,xn(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ac(t,`input`,e.processors),output:Ac(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Oc(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Oc(r.element,n);if(r.type===`set`)return Oc(r.valueType,n);if(r.type===`lazy`)return Oc(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Oc(r.innerType,n);if(r.type===`intersection`)return Oc(r.left,n)||Oc(r.right,n);if(r.type===`record`||r.type===`map`)return Oc(r.keyType,n)||Oc(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Oc(r.in,n)||Oc(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Oc(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Oc(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Oc(e,n))return!0;return!!(r.rest&&Oc(r.rest,n))}return!1}let kc=(e,t={})=>n=>{let r=gc({...n,processors:t});return vc(e,r),bc(r,e),Dc(r,e)},Ac=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=gc({...i??{},target:a,io:t,processors:n});return vc(e,o),bc(o,e),Dc(o,e)},jc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Mc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Nc=(e,t)=>{jc(e,`minimum`,t),Mc(e,`maximum`,t)},Pc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Fc=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},Ic=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Lc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Rc=(e,t)=>jc(e,`minimum`,t.minimum),zc=(e,t)=>Mc(e,`maximum`,t.maximum),Bc=e=>(t,n)=>{Lc(t,n.format);let[r,i]=e[n.format];jc(t,`minimum`,r),Mc(t,`maximum`,i)},Vc={greater_than:(e,t)=>jc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Mc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Pc(e,t.value),number_format:Bc(Vn),bigint_format:Bc(Hn),min_length:Rc,max_length:zc,length_equals:(e,t)=>Nc(e,t.length),min_size:Rc,max_size:zc,size_equals:(e,t)=>Nc(e,t.size),string_format:(e,t)=>{Lc(e,t.format),t.pattern&&Fc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Ic(e,t.mime)};function Hc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Vc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&jc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&jc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Mc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Mc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Pc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ic(t,i.mime);for(let e of i.patterns??[])Fc(t,e);return t}let Uc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Wc=/* @__PURE__ */ new Map([[Ba,xi],[Ha,Si]]),Gc=e=>Wc.get(e)??e,Kc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Hc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Uc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Gc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},qc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Hc(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):_c(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Jc=(e,t,n,r)=>{n.type=`boolean`},Yc=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Xc=(e,t,n,r)=>{n.not={}},Zc=(e,t,n,r)=>{let i=e._zod.def,a=dn(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Qc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(_c(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(_c(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},$c=(e,t,n,r)=>{_c(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},el=(e,t,n,r)=>{_c(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},tl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Hc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=vc(a.element,t,{...r,path:[...r.path,`items`]})};function nl(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?nl(t.out):t.type===`catch`?nl(t.innerType):e._zod.optin}let rl=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&_c(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)xn(i.properties,e,vc(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?nl(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=vc(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},il=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>vc(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},al=(e,t,n,r)=>{let i=e._zod.def,a=vc(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=vc(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},ol=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>vc(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?vc(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?nl(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Hc(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function sl(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=sl(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>sl(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Ni:Mi).source)),p}let cl=/* @__PURE__ */ new WeakMap;function ll(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of cl.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=sl(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}let ul=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Hc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=vc(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)xn(i.patternProperties,Gc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=vc(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=cl.get(t);n||(n=[],cl.set(t,n),t.deferred.push(()=>ll(t))),n.push(e)}i.additionalProperties=vc(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&nl(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},dl=(e,t,n,r)=>{let i=e._zod.def,a=vc(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},fl=(e,t,n,r)=>{let i=e._zod.def;vc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pl=Symbol();function ml(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(_c(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),pl):JSON.parse(o)}let hl=(e,t,n,r)=>{let i=e._zod.def;vc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ml(i.defaultValue,e,t,n,r);o!==pl&&(n.default=o)},gl=(e,t,n,r)=>{let i=e._zod.def;vc(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ml(i.defaultValue,e,t,n,r);o!==pl&&(n._prefault=o)},_l=(e,t,n,r)=>{let i=e._zod.def;vc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{_c(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},vl=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;vc(o,t,r);let s=t.seen.get(e);s.ref=o},yl=(e,t,n,r)=>{let i=e._zod.def;vc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},bl=(e,t,n,r)=>{let i=e._zod.def;vc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},xl=(e,t,n,r)=>{let i=e._zod.innerType;vc(i,t,r);let a=t.seen.get(e);a.ref=i},Sl=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Cl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let wl=/*@__PURE__*/ V(`ZodError`,(e,t)=>{Ir.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Sl.has(n)||(Sl.add(n),Cl(n,`format`,e=>t=>zr(e,t)),Cl(n,`flatten`,e=>t=>Rr(e,t)),Cl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,pn,2)}),Cl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,pn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Tl=/* @__PURE__ */ Vr(wl),El=/* @__PURE__ */ Hr(wl),Dl=/* @__PURE__ */ Ur(wl),Ol=/* @__PURE__ */ Gr(wl),kl=/* @__PURE__ */ Zr(wl),Al=/* @__PURE__ */ Qr(wl),jl=/* @__PURE__ */ $r(wl),Ml=/* @__PURE__ */ ei(wl),Nl=/* @__PURE__ */ ti(wl),Pl=/* @__PURE__ */ ni(wl),Fl=/* @__PURE__ */ ri(wl),Il=/* @__PURE__ */ ii(wl);function Ll(){Or.localeError||kr(as())}function Rl(){Or.memoizer||kr({memoizer:ns()})}let zl=/*@__PURE__*/ V(`ZodType`,(e,t)=>(Ll(),ia.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(On(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Rn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cd(e,t))},superRefine(e,t){return this.check(ld(e,t))},overwrite(e){return this.check(/* @__PURE__ */ ic(e))},optional(){return Vu(this)},exactOptional(){return Uu(this)},nullable(){return Gu(this)},nullish(){return Vu(Gu(this))},nonoptional(e){return Zu(this,e)},array(){return G(this)},or(e){return Du([this,e])},and(e){return ju(this,e)},transform(e){return td(this,zu(e))},default(e){return qu(this,e)},prefault(e){return Yu(this,e)},catch(e){return $u(this,e)},pipe(e){return td(this,e)},readonly(){return rd(this)},describe(e){let t=this.clone();return ls.add(t,{description:e}),t},meta(...e){if(e.length===0)return ls.get(this);let t=this.clone();return ls.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return fr(this,`~standard`,{...sa(this),jsonSchema:{input:Ac(this,`input`),output:Ac(this,`output`)}})},set"~standard"(e){dr(this,`~standard`,e)},parse:function e(t,n){return Tl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await El(this,t,n,{callee:e})},safeParse(e,t){return Dl(this,e,t)},async safeParseAsync(e,t){return Ol(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){dr(this,`spa`,e)},validate(e,t){return Jr(this,e,t)},validateAsync(e,t){return Xr(this,e,t)},encode:function e(t,n){return kl(this,t,n,{callee:e})},decode:function e(t,n){return Al(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await jl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ml(this,t,n,{callee:e})},safeEncode(e,t){return Nl(this,e,t)},safeDecode(e,t){return Pl(this,e,t)},async safeEncodeAsync(e,t){return Fl(this,e,t)},async safeDecodeAsync(e,t){return Il(this,e,t)},toJSONSchema(e){return kc(this,{})(e)},get description(){return ls.get(this)?.description},get _def(){return this._zod.def}}),Bl=/*@__PURE__*/ V(`_ZodString`,(e,t)=>{ca.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r)},/*@__PURE__*/ pr({format:e=>Hc(e).format??null,minLength:e=>Hc(e).minimum??null,maxLength:e=>Hc(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ Qs(...e))},includes(...e){return this.check(/* @__PURE__ */ tc(...e))},startsWith(...e){return this.check(/* @__PURE__ */ nc(...e))},endsWith(...e){return this.check(/* @__PURE__ */ rc(...e))},min(...e){return this.check(/* @__PURE__ */ Xs(...e))},max(...e){return this.check(/* @__PURE__ */ Ys(...e))},length(...e){return this.check(/* @__PURE__ */ Zs(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Xs(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ $s(e))},uppercase(e){return this.check(/* @__PURE__ */ ec(e))},trim(){return this.check(/* @__PURE__ */ oc())},normalize(...e){return this.check(/* @__PURE__ */ ac(...e))},toLowerCase(){return this.check(/* @__PURE__ */ sc())},toUpperCase(){return this.check(/* @__PURE__ */ cc())},slugify(){return this.check(/* @__PURE__ */ lc())}})),Vl=/*@__PURE__*/ V(`ZodString`,(e,t)=>{ca.init(e,t),Bl.init(e,t)},{email(e){return this.check(/* @__PURE__ */ fs(ql,e))},url(e){return this.check(/* @__PURE__ */ vs(Zl,e))},jwt(e){return this.check(/* @__PURE__ */ Ns(pu,e))},emoji(e){return this.check(/* @__PURE__ */ ys($l,e))},guid(e){return this.check(/* @__PURE__ */ ps(Jl,e))},uuid(e){return this.check(/* @__PURE__ */ ms(Yl,e))},uuidv4(e){return this.check(/* @__PURE__ */ hs(Yl,e))},uuidv6(e){return this.check(/* @__PURE__ */ gs(Yl,e))},uuidv7(e){return this.check(/* @__PURE__ */ _s(Yl,e))},nanoid(e){return this.check(/* @__PURE__ */ bs(eu,e))},cuid(e){return this.check(/* @__PURE__ */ xs(tu,e))},cuid2(e){return this.check(/* @__PURE__ */ Ss(nu,e))},ulid(e){return this.check(/* @__PURE__ */ Cs(ru,e))},base64(e){return this.check(/* @__PURE__ */ As(uu,e))},base64url(e){return this.check(/* @__PURE__ */ js(du,e))},xid(e){return this.check(/* @__PURE__ */ ws(iu,e))},ksuid(e){return this.check(/* @__PURE__ */ Ts(au,e))},ipv4(e){return this.check(/* @__PURE__ */ Es(ou,e))},ipv6(e){return this.check(/* @__PURE__ */ Ds(su,e))},cidrv4(e){return this.check(/* @__PURE__ */ Os(cu,e))},cidrv6(e){return this.check(/* @__PURE__ */ ks(lu,e))},e164(e){return this.check(/* @__PURE__ */ Ms(fu,e))},datetime(e){return this.check(/* @__PURE__ */ Ps(Ul,e))},date(e){return this.check(/* @__PURE__ */ Fs(Wl,e))},time(e){return this.check(/* @__PURE__ */ Is(Gl,e))},duration(e){return this.check(/* @__PURE__ */ Ls(Kl,e))}});function H(e){return/* @__PURE__ */ ds(Vl,e)}let Hl=/*@__PURE__*/ V(`ZodStringFormat`,(e,t)=>{la.init(e,t),Bl.init(e,t)}),Ul=/*@__PURE__*/ V(`ZodISODateTime`,(e,t)=>{Oa.init(e,t),Hl.init(e,t)}),Wl=/*@__PURE__*/ V(`ZodISODate`,(e,t)=>{ka.init(e,t),Hl.init(e,t)}),Gl=/*@__PURE__*/ V(`ZodISOTime`,(e,t)=>{Aa.init(e,t),Hl.init(e,t)}),Kl=/*@__PURE__*/ V(`ZodISODuration`,(e,t)=>{ja.init(e,t),Hl.init(e,t)}),ql=/*@__PURE__*/ V(`ZodEmail`,(e,t)=>{fa.init(e,t),Hl.init(e,t)}),Jl=/*@__PURE__*/ V(`ZodGUID`,(e,t)=>{ua.init(e,t),Hl.init(e,t)}),Yl=/*@__PURE__*/ V(`ZodUUID`,(e,t)=>{da.init(e,t),Hl.init(e,t)});function Xl(e){return/* @__PURE__ */ ms(Yl,e)}let Zl=/*@__PURE__*/ V(`ZodURL`,(e,t)=>{ba.init(e,t),Hl.init(e,t)});function Ql(e){return/* @__PURE__ */ vs(Zl,e)}let $l=/*@__PURE__*/ V(`ZodEmoji`,(e,t)=>{xa.init(e,t),Hl.init(e,t)}),eu=/*@__PURE__*/ V(`ZodNanoID`,(e,t)=>{Sa.init(e,t),Hl.init(e,t)}),tu=/*@__PURE__*/ V(`ZodCUID`,(e,t)=>{Ca.init(e,t),Hl.init(e,t)}),nu=/*@__PURE__*/ V(`ZodCUID2`,(e,t)=>{wa.init(e,t),Hl.init(e,t)}),ru=/*@__PURE__*/ V(`ZodULID`,(e,t)=>{Ta.init(e,t),Hl.init(e,t)}),iu=/*@__PURE__*/ V(`ZodXID`,(e,t)=>{Ea.init(e,t),Hl.init(e,t)}),au=/*@__PURE__*/ V(`ZodKSUID`,(e,t)=>{Da.init(e,t),Hl.init(e,t)}),ou=/*@__PURE__*/ V(`ZodIPv4`,(e,t)=>{Ma.init(e,t),Hl.init(e,t)}),su=/*@__PURE__*/ V(`ZodIPv6`,(e,t)=>{Fa.init(e,t),Hl.init(e,t)}),cu=/*@__PURE__*/ V(`ZodCIDRv4`,(e,t)=>{Ia.init(e,t),Hl.init(e,t)}),lu=/*@__PURE__*/ V(`ZodCIDRv6`,(e,t)=>{Ra.init(e,t),Hl.init(e,t)}),uu=/*@__PURE__*/ V(`ZodBase64`,(e,t)=>{Va.init(e,t),Hl.init(e,t)}),du=/*@__PURE__*/ V(`ZodBase64URL`,(e,t)=>{Wa.init(e,t),Hl.init(e,t)}),fu=/*@__PURE__*/ V(`ZodE164`,(e,t)=>{Ga.init(e,t),Hl.init(e,t)}),pu=/*@__PURE__*/ V(`ZodJWT`,(e,t)=>{qa.init(e,t),Hl.init(e,t)}),mu=/*@__PURE__*/ V(`ZodNumber`,(e,t)=>{Ja.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ pr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Hc(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Hc(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Hc(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Hc(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ Ks(e,t))},gte(e,t){return this.check(/* @__PURE__ */ qs(e,t))},min(e,t){return this.check(/* @__PURE__ */ qs(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Ws(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Gs(e,t))},max(e,t){return this.check(/* @__PURE__ */ Gs(e,t))},int(e){return this.check(gu(e))},safe(e){return this.check(gu(e))},positive(e){return this.check(/* @__PURE__ */ Ks(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ qs(0,e))},negative(e){return this.check(/* @__PURE__ */ Ws(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Gs(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ Js(e,t))},step(e,t){return this.check(/* @__PURE__ */ Js(e,t))},finite(){return this}}));function U(e){return/* @__PURE__ */ Rs(mu,e)}let hu=/*@__PURE__*/ V(`ZodNumberFormat`,(e,t)=>{Ya.init(e,t),mu.init(e,t)});function gu(e){return/* @__PURE__ */ zs(hu,e)}let _u=/*@__PURE__*/ V(`ZodBoolean`,(e,t)=>{Xa.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r)});function W(e){return/* @__PURE__ */ Bs(_u,e)}let vu=/*@__PURE__*/ V(`ZodNull`,(e,t)=>{Za.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yc(e,t,n,r)});function yu(e){return/* @__PURE__ */ Vs(vu,e)}let bu=/*@__PURE__*/ V(`ZodUnknown`,(e,t)=>{Qa.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function xu(){return/* @__PURE__ */ Hs(bu)}let Su=/*@__PURE__*/ V(`ZodNever`,(e,t)=>{$a.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xc(e,t,n,r)});function Cu(e){return/* @__PURE__ */ Us(Su,e)}let wu=/*@__PURE__*/ V(`ZodArray`,(e,t)=>{Rl(),ro.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ Xs(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Xs(1,e))},max(e,t){return this.check(/* @__PURE__ */ Ys(e,t))},length(e,t){return this.check(/* @__PURE__ */ Zs(e,t))},unwrap(){return this.element}});function G(e,t){return/* @__PURE__ */ uc(wu,e,t)}let Tu=/*@__PURE__*/ V(`ZodObject`,(e,t)=>{Rl(),lo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rl(e,t,n,r),yr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return J(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(On(this._zod.def,{catchall:e}))},passthrough(){return this.clone(On(this._zod.def,{catchall:xu()}))},loose(){return this.clone(On(this._zod.def,{catchall:xu()}))},strict(){return this.clone(On(this._zod.def,{catchall:Cu()}))},strip(){return this.clone(On(this._zod.def,{catchall:void 0}))},extend(e){return Kn(this,e)},safeExtend(e){return Jn(this,e)},merge(e){return Yn(this,e)},pick(e){return Un(this,e)},omit(e){return Gn(this,e)},partial(...e){return Xn(Bu,this,e[0])},exactPartial(...e){return Xn(Hu,this,e[0],`exactPartial`)},required(...e){return Zn(Xu,this,e[0])}});function K(e,t){let n={type:`object`,shape:e??{},...z(t)};return new Tu(n)}function q(e,t){return new Tu({type:`object`,shape:e,catchall:Cu(),...z(t)})}let Eu=/*@__PURE__*/ V(`ZodUnion`,(e,t)=>{fo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e.options=t.options});function Du(e,t){return new Eu({type:`union`,options:e,...z(t)})}let Ou=/*@__PURE__*/ V(`ZodDiscriminatedUnion`,(e,t)=>{Eu.init(e,t),mo.init(e,t)});function ku(e,t,n){return new Ou({type:`union`,options:t,discriminator:e,...z(n)})}let Au=/*@__PURE__*/ V(`ZodIntersection`,(e,t)=>{ho.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>al(e,t,n,r)});function ju(e,t){return new Au({type:`intersection`,left:e,right:t})}let Mu=/*@__PURE__*/ V(`ZodTuple`,(e,t)=>{Rl(),vo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ol(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Bu({type:`optional`,innerType:e}))})}});function Nu(e,t,n){let r=t instanceof ia;return new Mu({type:`tuple`,items:e,rest:r?t:null,...z(r?n:t)})}let Pu=/*@__PURE__*/ V(`ZodRecord`,(e,t)=>{Rl(),So.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ul(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Fu(e,t,n){return!t||!t._zod?new Pu({type:`record`,keyType:H(),valueType:e,...z(t)}):new Pu({type:`record`,keyType:e,valueType:t,...z(n)})}let Iu=/*@__PURE__*/ V(`ZodEnum`,(e,t)=>{Co.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Iu({...t,checks:[],...z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Iu({...t,checks:[],...z(r),entries:i})}});function J(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Iu({type:`enum`,entries:n,...z(t)})}let Lu=/*@__PURE__*/ V(`ZodLiteral`,(e,t)=>{wo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Lu({type:`literal`,values:Array.isArray(e)?e:[e],...z(t)})}let Ru=/*@__PURE__*/ V(`ZodTransform`,(e,t)=>{Rl(),To.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Dr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(lr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(lr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function zu(e){return new Ru({type:`transform`,transform:e})}let Bu=/*@__PURE__*/ V(`ZodOptional`,(e,t)=>{Do.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vu(e){return new Bu({type:`optional`,innerType:e})}let Hu=/*@__PURE__*/ V(`ZodExactOptional`,(e,t)=>{Oo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uu(e){return new Hu({type:`optional`,innerType:e})}let Wu=/*@__PURE__*/ V(`ZodNullable`,(e,t)=>{ko.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gu(e){return new Wu({type:`nullable`,innerType:e})}let Ku=/*@__PURE__*/ V(`ZodDefault`,(e,t)=>{Ao.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qu(e,t){return new Ku({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Fn(t)}})}let Ju=/*@__PURE__*/ V(`ZodPrefault`,(e,t)=>{Mo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yu(e,t){return new Ju({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Fn(t)}})}let Xu=/*@__PURE__*/ V(`ZodNonOptional`,(e,t)=>{No.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zu(e,t){return new Xu({type:`nonoptional`,innerType:e,...z(t)})}let Qu=/*@__PURE__*/ V(`ZodCatch`,(e,t)=>{Io.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $u(e,t){return new Qu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:br(t)})}let ed=/*@__PURE__*/ V(`ZodPipe`,(e,t)=>{Lo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(e,t,n,r),e.in=t.in,e.out=t.out});function td(e,t){return new ed({type:`pipe`,in:e,out:t})}let nd=/*@__PURE__*/ V(`ZodReadonly`,(e,t)=>{zo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rd(e){return new nd({type:`readonly`,innerType:e})}let id=/*@__PURE__*/ V(`ZodLazy`,(e,t)=>{Vo.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function ad(e){return new id({type:`lazy`,getter:e})}let od=/*@__PURE__*/ V(`ZodCustom`,(e,t)=>{Ho.init(e,t),zl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r)});function sd(e,t){return/* @__PURE__ */ dc(od,e??(()=>!0),t)}function cd(e,t={}){return/* @__PURE__ */ fc(od,e,t)}function ld(e,t){return/* @__PURE__ */ pc(e,t)}function ud(e){return/* @__PURE__ */ Ps(Ul,e)}function dd(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let fd=Du([H(),U(),W(),yu()]);function pd(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let md=sd(pd,{message:`JSON value must not contain circular references`}),hd=ad(()=>Du([fd,G(hd),Fu(H(),hd)])),gd=md.pipe(hd);md.pipe(G(hd));let _d=md.pipe(Fu(H(),hd)),vd=q({code:H().min(1),message:H().min(1),retryable:W(),diagnostic:H().min(1).optional(),stage:H().min(1).optional(),durationMs:U().int().nonnegative().optional(),stderrTail:H().min(1).optional()}).superRefine(dd([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),yd=H().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),bd=e=>H().min(1).max(e).refine(e=>e.trim().length>0),xd=Fu(yd,K({label:bd(256).optional(),description:bd(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Sd=Fu(yd,bd(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Cd=H().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),wd=Cd.brand(),Td=Cd.brand(),Ed=Cd.brand();Cd.brand(),Cd.brand();let Dd=H().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Od=Dd.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),kd=K({modes:G(K({id:Od,label:Dd.max(256),description:Dd.max(1024).optional(),dangerous:W().optional(),localizations:xd.optional()}).strict()).min(1).max(32),defaultModeId:Od}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});K({threadId:Td,permissionModeId:Od}).strict();let Ad=U().int().safe().nonnegative(),jd=U().finite().nonnegative(),Md=U().finite().min(0).max(100),Nd=K({version:Du([Y(3),Y(4)]).optional(),requestId:H().min(1),turnId:H().min(1).max(1024),outputTokens:Ad,startedAtMs:Ad,completedAtMs:Ad}).strict().refine(e=>e.completedAtMs>e.startedAtMs),Pd=K({version:Du([Y(2),Y(3),Y(4)]).optional(),value:jd,turnId:H().min(1).max(1024),at:Ad}).strict();K({outputTimings:G(Nd).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:Pd.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:Pd.extend({value:Ad}).optional()}).strict();let Fd=e=>Sd.refine(t=>Object.values(t).every(t=>t.length<=e)),Id=K({composerIndicators:G(K({kind:Y(`countdown`),id:H().min(1).max(64),expiresAtUnix:Ad,label:Fd(256).optional(),tooltip:Fd(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:Ad.optional(),cachedInputTokens:Ad.optional(),cacheWriteInputTokens:Ad.optional(),outputTokens:Ad.optional(),outputTokensPerSecond:jd.optional(),sessionOutputTokensPerSecond:jd.optional(),apiOutputTokensPerSecond:jd.optional(),reasoningOutputTokens:Ad.optional(),totalTokens:Ad.optional(),totalCostUsd:jd.optional(),totalCredits:jd.optional(),contextUsagePercent:jd.optional(),cacheHitRatePercent:Md.optional(),contextWindowTokens:Ad.optional(),contextUsedTokens:Ad.optional(),planFiveHourUsedPercent:Md.optional(),planFiveHourResetsAtUnix:Ad.optional(),planSevenDayUsedPercent:Md.optional(),planSevenDayResetsAtUnix:Ad.optional(),sessionCacheHitRatePercent:Md.optional(),timeToFirstOutputMs:Ad.optional(),latestRequestTimeToFirstOutputMs:Ad.optional(),costSource:J([`publicPrice`,`native`]).optional(),unpricedModels:G(H().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),Ld=U().finite().min(0).max(100),Rd=J([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),zd=K({id:H().min(1).max(256),label:H().min(1).max(256),localizations:xd.optional()}).strict(),Bd=K({product:H().min(1),periodType:Rd.optional(),scope:zd.optional(),localizations:xd.optional(),used:U().finite().nonnegative().optional(),limit:U().finite().nonnegative().optional(),unit:H().min(1).max(32).optional(),usagePercent:Ld,resetsAt:H().min(1).optional()}).strict(),Vd=K({availableCount:U().int().safe().positive(),nextExpiresAt:H().min(1).optional(),expiresAt:G(H().min(1)).min(1).max(32).optional()}).strict(),Hd=K({used:U().finite().nonnegative().optional(),limit:U().finite().nonnegative().optional(),unit:H().min(1).max(32).optional(),label:H().min(1).optional(),scope:zd.optional(),localizations:xd.optional(),usedPercent:Ld,resetsAt:H().min(1).optional(),periodType:Rd,productUsage:G(Bd).min(1).optional(),resetCredits:Vd.optional()}).strict(),Ud=K({amount:U().finite().nonnegative(),currency:H().trim().min(1).max(8),label:H().trim().min(1).max(128).optional()}).strict();K({threadId:Td,refresh:Y(`exact`).optional()}).strict(),K({threadId:Td,usage:Id.nullable(),accountCredits:Hd.optional(),accountBalance:Ud.optional(),accountCreditsSupported:W().optional()}).strict();let Wd=H().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Gd=H().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),Kd=J([`priority`,`ultrafast`]),qd=K({id:Gd,serviceTier:Kd.optional()}).strict();function Jd(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let Yd=Wd.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),Xd=Wd.max(256),Zd=K({id:Yd,label:Wd.max(256)}).strict(),Qd=K({ref:qd,label:Wd.max(256),resolvedModelLabel:Xd.optional(),fastModel:qd.optional(),supportedThinkingOptionIds:G(Yd).optional()}).strict().refine(e=>e.fastModel?.serviceTier===void 0||e.fastModel.id===e.ref.id,{path:[`fastModel`,`id`],message:`A tiered Fast Model must share the base Model ID`});function $d(e,t){if(t)return e?.models.find(e=>Jd(e.ref,t)||Jd(e.fastModel,t))}let ef=G(Zd).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),tf=K({models:G(Qd),defaultModel:qd.optional(),thinkingOptions:ef,defaultThinkingOptionId:Yd.optional()}).strict().superRefine((e,t)=>{let n=[],r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.some(e=>Jd(e,a.ref))&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.push(a.ref),a.fastModel&&(n.some(e=>Jd(e,a.fastModel))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.push(a.fastModel));let e=/* @__PURE__ */ new Set;for(let[n,o]of(a.supportedThinkingOptionIds??[]).entries())e.has(o)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,n]}),e.add(o),r.has(o)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,n]})}e.defaultModel&&!$d(e,e.defaultModel)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),nf=K({fork:W(),forkAcrossCwd:W(),rollbackLastTurn:W()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),rf=J([`live`,`atCreate`]),af=K({configuration:K({selectModel:W(),selectThinkingOption:W(),selectPermissionMode:W(),permissionModeScope:rf.default(`live`)}).strict(),history:nf,subagents:K({observe:W(),readTranscript:W()}).strict().optional(),autonomousTurns:K({observe:W()}).strict().optional(),steer:W().optional(),persistentPlan:W().optional()}).strict();K({effectiveModel:qd.optional(),resolvedModelLabel:Xd.optional(),effectiveThinkingOptionId:Yd.optional(),availableThinkingOptions:ef.optional(),effectivePermissionModeId:Od.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let of=K({open:Y(!0)}).strict();Du([K({status:Y(`ready`),catalog:tf,permissionModes:kd.optional(),capabilities:af,webUi:of.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),K({status:J([`notInstalled`,`unavailable`,`error`]),error:vd}).strict()]),K({harnessId:wd,cwd:Wd.max(16384).optional(),refresh:W().optional(),purpose:Y(`availability`).optional(),credentialAccess:J([`allow`,`retry`]).optional()}).strict(),K({harnessId:wd}).strict(),K({}).strict(),K({threadId:Td,model:qd}).strict(),K({threadId:Td,thinkingOptionId:Yd}).strict(),K({threadId:Td,includeReferenceCapability:W().optional()}).strict(),ku(`owner`,[K({owner:Y(`codex`),locked:W(),effectiveModel:qd.optional(),resolvedModelLabel:Xd.optional(),effectiveThinkingOptionId:Yd.optional(),effectivePermissionModeId:Od.optional(),history:nf.optional(),supportsThreadReferences:Y(!0).optional()}).strict(),K({owner:Y(`external`),harnessId:Wd.max(256),transportModelId:Wd.max(8192),effectiveModel:qd.optional(),resolvedModelLabel:Xd.optional(),effectiveThinkingOptionId:Yd.optional(),availableThinkingOptions:ef.optional(),effectivePermissionModeId:Od.optional(),catalog:tf.optional(),history:nf,usage:Id.optional(),locked:Y(!0)}).strict()]),K({threadIds:G(Td).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let sf=ku(`owner`,[K({threadId:Td,owner:Y(`codex`)}).strict(),K({threadId:Td,owner:Y(`external`),harnessId:H().max(256).pipe(wd)}).strict()]);K({threads:G(sf).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),K({threadId:Td,text:H().optional()}).strict(),K({kind:Y(`application`),value:H().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),Sr}}).pipe(K({expectedTurnId:Ed,clientUserMessageId:H().min(1),delivery:J([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),J([`activeTurn`,`newTurn`]),K({delivery:J([`official`,`activeTurn`,`newTurn`])}).strict();let cf=H().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),lf=cf.pipe(wd),uf=lf.refine(e=>e!==`codex`,`The official Codex identity is reserved`),df=H().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),ff=Ql().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),pf=K({en:H().max(4096),"zh-CN":H().max(4096).optional()}).strict(),mf=K({commands:G(K({terminal:H().max(256),command:H().max(4096)}).strict()).max(8),before:pf.optional(),after:pf.optional(),downloads:G(K({label:H().max(128),url:ff}).strict()).max(8).optional()}).strict(),hf={id:lf,name:H().trim().min(1).max(128),version:H().min(1).max(128),kind:Y(`usage`).optional(),iconStyle:K({vector:K({viewBox:H().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:H().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:G(K({d:H().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:J([`evenodd`,`nonzero`]).optional(),fill:H().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:H().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:U().min(0).max(50).optional(),paddingRatio:U().min(0).max(.25).optional()}).strict().optional(),installation:mf.optional(),notice:pf.optional(),launchCommand:Y(!0).optional(),links:K({website:ff.optional(),documentation:ff.optional(),installation:ff.optional()}).strict().optional()};K({manifestVersion:Y(1),...hf,adapterApiVersion:U().int().positive(),entry:df,icon:df.optional()}).strict();let gf=H().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),_f=K({...hf,icon:gf.optional()}).strict();K({}).strict(),K({plugins:G(_f.extend({id:uf})).max(128)}).strict(),K({version:Y(1),enabled:G(lf).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let vf=cf,yf=J([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),bf=J([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),xf=H().trim().min(1).max(128);function Sf(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`webp`:return`image/webp`;default:return}}let Cf=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),wf=df.refine(e=>Sf(e)!==void 0&&Cf(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),Tf=H().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(Ql({protocol:/^https?$/u})).refine(e=>{let{username:t,password:n}=new URL(e);return!t&&!n&&!/[\\\s]/u.test(e)},`URL must not contain credentials, backslashes, or whitespace`);function Ef(e){return q({en:e,"zh-CN":e})}let Df=Ef(H().trim().min(1)),Of=G(bf).max(bf.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),kf=G(yf).max(yf.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),Af={key:H().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:Df,description:Df.optional()},jf={...Af,step:U().positive().optional(),default:U().optional()},Mf=q({value:H(),label:Df}),Nf=ku(`type`,[q({...Af,type:Y(`boolean`),default:W().optional()}),q({...Af,type:Y(`string`),placeholder:Df.optional(),default:H().optional()}),q({...jf,type:Y(`number`),min:U().optional(),max:U().optional()}),q({...jf,type:Y(`range`),min:U(),max:U()}),q({...Af,type:Y(`select`),options:G(Mf).min(1),default:H().optional()})]).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type===`number`||e.type===`range`){let{min:t=-1/0,max:r=1/0,default:i}=e;t>r&&n(`max`,`Must be at least min`),i!==void 0&&(i<t||i>r)&&n(`default`,`Must be within min and max`)}else if(e.type===`select`){let t=new Set(e.options.map(({value:e})=>e));t.size!==e.options.length&&n(`options`,`Duplicate option values`),e.default!==void 0&&!t.has(e.default)&&n(`default`,`Must match an option value`)}}),Pf=K({manifestVersion:gu().positive(),id:vf,name:Du([xf,Ef(xf)]),version:H().min(1).max(128),desktopApi:gu().positive()}).passthrough().extend({manifestVersion:Y(1),desktopApi:Y(1),description:q({en:H().max(4096),"zh-CN":H().max(4096).optional()}).optional(),author:H().trim().min(1).max(128).optional(),repository:Tf.optional(),details:q({en:H().max(16384),"zh-CN":H().max(16384).optional()}).optional(),icon:wf.optional(),screenshots:G(wf).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:q({script:df,style:df.optional()}).optional(),backend:q({script:df.refine(Cf)}).optional(),slots:kf.default(()=>[]),settingsSchema:G(Nf).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Of.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),Ff=H().regex(/^[a-f0-9]{64}$/u),If=q({state:J([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:Ff.optional(),error:H().optional(),conflictWith:vf.optional()});q({controllerPid:gu().positive(),targetId:H().nullable(),updatedAt:ud(),handledReloadToken:Xl().optional(),extensions:Fu(H(),If),surfaces:Fu(H(),If).optional()});let Lf=J([`official`,`community`]);function Rf(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let zf=Tf.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||Rf(t)||t.origin===`https://github.com`&&/^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(t.pathname)||t.origin===`https://codeload.github.com`&&/^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(t.pathname)},`Expected a .zip download URL or a GitHub zipball URL`),Bf=q({id:vf,version:H().trim().min(1).max(128),name:Df.extend({en:xf,"zh-CN":xf}),description:Ef(H().trim().min(1).max(4096)),details:Ef(H().trim().min(1).max(16384)).optional(),author:H().trim().min(1).max(128),repository:Tf,stars:U().int().min(0).optional(),downloads:U().int().min(0).optional(),categories:Of.optional(),trustTier:Lf.default(`community`),icon:Tf.optional(),screenshots:G(Tf).max(4).optional(),downloadUrl:zf,sha256:Ff,slots:kf.optional(),publishedAt:H().optional(),updatedAt:H().optional(),minCodexHostVersion:H().optional()});q({schemaVersion:Y(1),generatedAt:H(),extensions:G(Bf).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let Vf=H().trim().min(1).max(128),Hf=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,Uf=vf.refine(e=>!Hf.test(e),`Reserved extension ID`),Wf=J([`desktop`,`web`]),Gf=Ff,Kf=Xl(),qf=df.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!Hf.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),Jf=Pf.shape,Yf=(e,t=0)=>q({en:H().trim().min(t).max(e),"zh-CN":H().trim().min(t).max(e)}),Xf=e=>qf.refine(t=>t.endsWith(e),`Expected a ${e} file`),Zf=Xf(`.mjs`),Qf=Xf(`.css`).optional(),$f=e=>e.normalize(`NFC`).toLowerCase(),ep=q({manifestVersion:Y(2),id:Uf,name:Yf(128,1),version:H().trim().min(1).max(128),description:Yf(4096),details:Yf(16384).optional(),author:Jf.author,repository:Jf.repository,icon:Jf.icon.refine(e=>e===void 0||qf.safeParse(e).success),screenshots:Jf.screenshots.refine(e=>e===void 0||e.every(e=>qf.safeParse(e).success)),categories:Jf.categories,settingsSchema:Jf.settingsSchema,slots:Jf.slots.removeDefault().optional(),page:q({apiVersion:Y(1),entry:Zf,style:Qf,title:Yf(128,1).optional()}).optional(),widget:q({apiVersion:Y(1),entry:Zf,style:Qf}).optional(),desktop:q({apiVersion:Y(1),script:Xf(`.js`),style:Qf}).optional(),web:q({apiVersion:Y(1),entry:Zf.optional(),style:Qf}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:q({apiVersion:Y(1),entry:Zf}).optional()}).refine(({page:e,widget:t,desktop:n,web:r,backend:i})=>!!(e||t||n||r||i),`Expected at least one page, widget, desktop, web, or backend entry`).refine(({page:e,widget:t,web:n,backend:r})=>!r||[e?.entry,t?.entry,n?.entry].every(e=>e===void 0||$f(e)!==$f(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function tp({hasPage:e,hasWidget:t,hasDesktop:n,hasWeb:r,hasBackend:i}){if(e||t||i&&!n&&!r)return[`desktop`,`web`];let a=[];return n&&a.push(`desktop`),r&&a.push(`web`),a}let np=Vf,rp=gu().nonnegative(),ip=q({revision:rp,enabled:G(Uf).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)}),{downloadUrl:ap,...op}=Bf.shape,sp=K({...op,id:Uf,format:Y(`codexhost`),targets:G(Wf).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:q({page:gu().positive().optional(),widget:gu().positive().optional(),desktop:gu().positive().optional(),web:gu().positive().optional(),backend:gu().positive().optional()}),downloadUrl:ap.refine(e=>e.startsWith(`https://`),`Expected HTTPS`)}).refine(({targets:e,apis:t})=>{let n=tp({hasPage:!!t.page,hasWidget:!!t.widget,hasDesktop:!!t.desktop,hasWeb:!!t.web,hasBackend:!!t.backend});return e.length===n.length&&n.every(t=>e.includes(t))},`Catalog targets must match the declared APIs`);K({schemaVersion:Y(2),generatedAt:H().min(1),extensions:G(sp).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:Tf,fetchedAt:ud(),cached:W()});let cp={id:Uf},lp={...cp,activationId:Kf,digest:Gf},up={...cp,activationId:lp.activationId.optional()},dp=H().min(1).max(4096).refine(e=>/^(?:\/|[a-z]:[/\\])/iu.test(e)&&!e.includes(`\0`)&&!e.split(/[/\\]/u).some(e=>e===`.`||e===`..`),`Expected an absolute local path without dot segments`),fp=H().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function pp(e){return H().max(4*Math.ceil(e/3)).refine(t=>{let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return t.length%4==0&&t.length*3/4-n<=e&&/^[A-Za-z0-9+/]*={0,2}$/u.test(t)},`Expected bounded standard padded base64`)}let mp=q({type:Y(`github`),repository:H().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:fp.optional(),tag:fp.optional(),asset:H().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:qf.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),hp=Du([q({type:Y(`catalog`),...cp}),mp,q({type:Y(`zip`),base64:pp(67108864).min(4)}),q({type:Y(`zip`),localZipPath:dp}),q({type:Y(`localDir`),localDir:dp})]),gp=ku(`type`,[q({type:Y(`catalog`),...cp}),mp,q({type:Y(`zip`)}),q({type:Y(`localDir`)})]),_p=q({...lp,manifest:ep,installedAt:ud(),source:gp.optional()}),vp=e=>H().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),yp={desktopConflictWith:Uf.optional()},bp=J([`none`,`inactive`,`starting`,`running`,`failed`]),xp=ku(`state`,[_p.extend({state:Y(`valid`),enabled:W(),...yp,iconDataUrl:vp(131072).optional(),screenshotDataUrls:G(vp(524288)).max(4).optional(),backendState:bp.optional(),backendError:H().optional()}),q({state:J([`invalid`,`incompatible`]),id:H().min(1),enabled:W(),error:H()})]);q({revision:rp,configuration:ip,diagnostics:G(H()),extensions:G(xp)}),q({revision:rp,extensions:G(_p.extend({...yp,settingsRevision:rp})).max(64)});let Sp={list:`codexhost/extensions/list`,snapshot:`codexhost/extensions/snapshot`,catalog:`codexhost/extensions/catalog`,install:`codexhost/extensions/install`,update:`codexhost/extensions/update`,enable:`codexhost/extensions/enable`,disable:`codexhost/extensions/disable`,uninstall:`codexhost/extensions/uninstall`,recover:`codexhost/extensions/recover`,asset:`codexhost/extensions/asset`,settingsGet:`codexhost/extensions/settings/get`,settingsSet:`codexhost/extensions/settings/set`,backendInvoke:`codexhost/extensions/backend/invoke`},Cp=Object.freeze(Object.values(Sp));new Set(Cp),q({});let wp={expectedRevision:rp};q({...cp,...wp}),_p.extend({replaced:W()}),ku(`state`,[q({state:Y(`saved`),configuration:ip}),q({state:Y(`revision-conflict`),revision:rp})]),q({...up,digest:lp.digest.optional(),path:qf}),q({mimeType:H().min(1),base64:pp(16777216),digest:lp.digest}),q({settingsRevision:rp,values:_d}),Sp.list,Sp.snapshot,Sp.catalog,q({forceRefresh:W().optional()}),Sp.install,q({source:hp}),Sp.update,q({...cp,expectedDigest:lp.digest,expectedActivationId:lp.activationId.optional(),source:hp.optional()}),Sp.enable,Sp.disable,Sp.uninstall,q({...cp,removeData:W().optional(),expectedDigest:lp.digest.optional()}),q({...cp,removed:W()}),Sp.recover,q({expectedRevision:wp.expectedRevision.optional()}),Sp.asset,Sp.settingsGet,q(up),Sp.settingsSet,q({...up,expectedSettingsRevision:rp,values:_d}),Sp.backendInvoke,q({...up,method:np,params:gd.optional()}),q({result:gd}),K({threadId:Td}).strict(),K({confirmed:W()}).strict(),[...Cp],K({sections:G(K({id:H().min(1),name:H().min(1),threads:G(_d)}).strict())}).strict(),K({threadId:H().min(1).max(1024),sectionId:H().min(1).max(1024).nullable()}).strict(),K({threadIds:G(H().min(1))}).strict(),K({threadId:H().min(1).max(1024),pinned:W()}).strict(),K({}).strict(),K({parents:Fu(H().min(1),H().min(1))}).strict(),K({prompt:H().max(16384).optional()}).strict(),K({projects:G(K({id:H(),name:H(),rootPaths:G(H())})),assignments:Fu(H(),H()),projectless:G(H()),pinned:G(H()),sectionProjects:Fu(H(),G(H())).optional()});let Tp=Fu(H(),xu()),Ep=K({epoch:H().uuid(),sequence:U().int().nonnegative()});ku(`type`,[K({type:Y(`skills-changed`),cursor:Ep,cwd:H().optional()}),K({type:Y(`harness-inspection-changed`),cursor:Ep,harnessId:H().min(1)}),K({type:Y(`display-settings-changed`),cursor:Ep}),K({type:Y(`preferences-changed`),cursor:Ep,revision:U().int().nonnegative()}),K({type:Y(`extensions-changed`),cursor:Ep,revision:rp}),K({type:Y(`hello`),version:Y(1),cursor:Ep,reset:W()}),K({type:Y(`changed`),cursor:Ep,threadId:H().min(1),method:H().min(1)})]);let Dp=ku(`type`,[K({type:Y(`text`),id:H(),prompt:H(),secret:W().optional(),optional:W().optional()}),K({type:Y(`choice`),id:H(),prompt:H(),multiple:W(),allowOther:W(),optional:W().optional(),options:G(K({value:H(),label:H(),description:H().optional()}))})]),Op=ku(`type`,[K({type:Y(`approval`),title:H(),description:H().optional(),subject:xu().optional(),actions:G(K({id:H(),label:H(),effect:H()}))}),K({type:Y(`question`),title:H().optional(),questions:G(Dp)})]),kp=K({requestId:Du([H(),U().int()]),threadId:H(),kind:J([`approval`,`question`]),interaction:Op,request:Tp}),Ap=K({id:H().min(1),clientUserMessageId:H().min(1),input:G(Tp),presentationInput:G(Tp).nullable().optional()}).passthrough();K({fields:G(K({path:G(Du([H(),U().int().nonnegative()])),originalLength:U().int().nonnegative()}))});let jp=K({id:H().min(1),status:H().min(1),codexhostTurnOutcome:K({status:Y(`unknown`),reason:H()}).optional(),items:G(K({id:H().min(1),type:H().min(1)}).passthrough()),codexhostFileOperations:G(K({beforeItemId:H().nullable(),item:K({id:H().min(1),type:H().min(1)}).passthrough()})).optional(),error:K({message:H().optional()}).passthrough().nullable().optional(),fingerprint:H().min(1).optional(),unchanged:Y(!0).optional()}).passthrough(),Mp=K({id:H().min(1).max(512),fingerprint:H().min(1).max(128)});K({threadId:H().min(1),knownTurns:G(Mp).max(64).optional(),truncateToolOutput:W().optional()});let Np=K({harnessId:H().min(1),nativeSessionId:H().min(1)});K({cursor:Ep,activeTurnId:H().min(1).nullable().optional(),command:K({name:H().min(1),turn:jp,subsequentTurnId:H().min(1).optional()}).optional(),thread:K({id:H().min(1),cwd:H(),modelProvider:H().min(1),createdAt:U(),updatedAt:U(),status:K({type:H()}).passthrough(),name:H().nullable().optional(),preview:H().optional(),codexhostImportSource:Np.optional(),turns:G(jp).length(0)}).passthrough(),turnsPage:K({data:G(jp).max(5),nextCursor:H().nullable()}),configuration:K({native:K({model:H().min(1).max(1024).optional(),reasoningEffort:H().min(1).max(128).optional()}).optional(),effectiveModel:qd.optional(),effectiveThinkingOptionId:Yd.optional(),effectivePermissionModeId:Od.optional()}),queue:K({items:G(Ap),pausedReason:J([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:G(kp)}),K({version:Y(1),owner:Y(`service`).optional(),pid:U().int().positive(),port:U().int().min(1).max(65535),token:H().regex(/^[0-9a-f]{64}$/u),startedAt:U(),epoch:H().uuid()}),K({epoch:H().uuid(),threadId:H().min(1),requestId:Du([H(),U().int()]),result:Tp}),K({includeArchived:W().optional(),officialCursor:K({live:H().nullable(),archived:H().nullable().optional()}).strict().optional(),scope:K({cwd:H().min(1).max(4096),excludeCwds:G(H().min(1).max(4096)).max(1024)}).strict().optional()}).strict(),K({threads:G(_d),ownership:G(sf),archivedThreadIds:G(Td),officialCursor:K({live:H().nullable(),archived:H().nullable().optional()}).strict().optional()}).strict();let Pp=J([`running`,`waiting`,`idle`,`unknown`]),Fp=q({harnessId:wd,title:H().optional(),status:Pp,archived:W()}),Ip=q({revision:gu().nonnegative(),parents:Fu(Td,Td),nodes:Fu(Td,Fp),truncated:W()}).refine(e=>Object.keys(e.nodes).length<=5e3,`Too many Thread tree nodes`).refine(({parents:e,nodes:t})=>Object.entries(e).every(([e,n])=>Object.hasOwn(t,e)&&Object.hasOwn(t,n)),`Missing Thread tree node`),Lp=H().min(1).max(128);q({});let Rp=q({subscriptionId:Lp});q({}),Rp.extend({snapshot:Ip});let zp=H().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);K({available:W()}).strict(),K({path:H().min(1),mimeType:zp}).strict();let Bp=J([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);ku(`ok`,[K({ok:Y(!0),text:H()}).strict(),K({ok:Y(!1),error:K({code:Bp}).strict()}).strict()]),K({threadId:Td.optional(),cwd:H().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Vp=K({name:H().min(1).regex(/^[^\s[\]]+$/u),description:H().optional(),path:H().min(1),scope:J([`project`,`global`]),source:H().min(1)}).strict();K({revision:U().int().nonnegative(),complete:W(),skills:G(Vp),warnings:G(H()).optional()}).strict(),K({cwd:H().min(1).optional()}).strict();let Hp=K({kind:J([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:H().min(1)}).strict(),Up=ku(`status`,[K({status:Y(`not-installed`)}),K({status:Y(`not-running`)}),K({status:Y(`not-logged-in`)}),K({status:Y(`https-disabled`)}),K({status:Y(`not-serving`),command:H()}),K({status:Y(`occupied`),target:H()}),K({status:Y(`serving`),url:H(),funnel:W()}),K({status:Y(`error`),message:H()})]);K({state:Up,error:H().optional()}).strict();let Wp=ku(`status`,[K({status:Y(`on`)}),K({status:Y(`off`)}),K({status:Y(`invalid`),reason:H()})]),Gp=K({lan:W(),autostart:Wp}).strict(),Kp=K({expiresAt:H().optional(),issuing:W(),failure:K({detail:H().optional(),retryAt:H(),paused:W()}).optional()}),qp=ku(`status`,[K({status:Y(`off`),reason:J([`invite`,`name-taken`,`banned`]).optional()}),K({status:Y(`connecting`),reason:J([`full`,`unreachable`]).optional()}),K({status:Y(`connected`),url:H(),certificate:Kp}),K({status:Y(`missing-certificate`),url:H(),certificate:Kp}),K({status:Y(`stopped`),reason:J([`replaced`,`rejected`,`unsupported-version`])})]);H().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),H().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let Jp=J([`official`,`self-hosted`]);K({secret:H().min(1),lastUsedAt:U().nullable(),networkUrls:G(Hp),directCandidates:G(Hp).optional(),tailscale:Up,background:Gp.optional(),relay:K({state:qp,enabled:W(),kind:Jp,officialHost:H(),customHost:H().optional(),officialHostname:H().optional(),customHostname:H().optional(),quotaUntil:H().optional()}).strict().optional()}).strict();let Yp=q({threadId:H().min(1).max(1024),view:J([`result`,`messages`]),from:U().int().min(1).max(2**53-1).optional(),to:U().int().min(1).max(2**53-1).optional()}),Xp=K({id:H().min(1).max(256),harnessId:H().min(1),label:H().min(1).max(512),provider:J([`openai-codex`,`xai`])}).strict(),Zp=H().regex(/^[a-z][a-z0-9-]{0,47}$/),Qp=K({name:Zp,source:Xp,importedAt:H()}).strict(),$p=ku(`action`,[K({action:Y(`list`)}).strict(),K({action:Y(`import`),sourceId:H().min(1).max(256),name:Zp,confirmed:Y(!0)}).strict(),K({action:Y(`reimport`),sourceId:H().min(1).max(256),name:Zp,confirmed:Y(!0)}).strict(),K({action:Y(`remove`),name:Zp,confirmed:Y(!0)}).strict()]),em=K({provider:H().min(1).max(128),type:J([`oauth`,`api_key`,`unknown`]),label:H().min(1).max(512).optional(),vendor:J([`openai-codex`,`xai`]).optional()}).strict();K({sources:G(Xp),targets:G(K({harnessId:H(),providers:G(J([`openai-codex`,`xai`])),imports:G(Qp),others:G(em).default([])}).strict())}).strict(),K({targetHarnessId:H().min(1).max(128).optional(),request:$p}).strict(),K({events:W()});let tm=G(q({agent:H().min(1).max(128),section:J([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);q({entries:tm.nullable()}),q({}),q({entries:tm,initializeOnly:W().optional()});let nm=q({enabled:W(),timeoutMinutes:U().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let rm=H().regex(/^external$/u),im=wd.transform(e=>String(e)),am=q({model:qd.optional(),thinkingOptionId:Yd.optional(),permissionModeId:Od.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),om=q({lastHarness:wd.optional(),byHarness:Fu(im,am)}),sm=q({model:qd.optional(),thinkingOptionId:Yd.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),cm=q({byHarness:Fu(im,sm)}),lm=H().min(1).max(1024),um=q({idleRelease:nm.optional(),favorites:Fu(im,G(lm).max(2048)).default({}),newThread:om.optional(),delegation:cm.optional()});q({scope:rm,revision:U().int().nonnegative(),values:um}),q({scope:rm.default(`external`)});let dm=ku(`kind`,[q({kind:Y(`idleRelease`),value:nm}),q({kind:Y(`favorite`),harnessId:wd,modelId:lm,enabled:W()}),q({kind:Y(`favorites`),harnessId:wd,modelIds:G(lm).max(2048)}),q({kind:Y(`newThread`),lastHarness:wd.optional(),harnessId:wd.optional(),configuration:am.optional()}),q({kind:Y(`delegation`),harnessId:wd,configuration:sm.nullable()})]);q({scope:rm.default(`external`),operations:G(dm).min(1).max(256),initializeOnly:W().optional(),expectedRevision:U().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),q({version:Y(1),revision:U().int().nonnegative(),scopes:Fu(rm,um)});let fm=U().finite().nonnegative(),pm=q({input:fm,output:fm,cacheRead:fm.optional(),cacheWrite:fm.optional(),cacheWrite1h:fm.optional()}),mm=H().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);q({path:H(),entries:G(q({key:H(),price:pm})),error:H().nullable()}),q({}),q({key:mm,price:pm.nullable(),previousKey:mm.optional()}),q({model:mm});let hm=q({official:W().optional(),canonicalModelId:H().min(1).optional(),provider:H().min(1).max(512),model:H().min(1).max(512),price:pm});q({price:pm.nullable(),suggestions:G(hm).max(6).optional()});let gm=[`today`,`7d`,`30d`,`90d`,`all`],_m=U().int().min(0).max(2**53-1),vm=H().regex(/^\d{4}-\d{2}-\d{2}$/u),ym=H().min(1).max(128),bm=H().min(1).max(512),xm=H().min(1).max(4096);q({range:J(gm),timeZone:H().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:ym.optional(),model:bm.nullable().optional(),project:xm.nullable().optional(),date:vm.optional()});let Sm=q({requests:_m,inputTokens:_m,cachedInputTokens:_m,cacheWriteInputTokens:_m,cacheKnownInputTokens:_m,cacheHitCachedInputTokens:_m,cacheHitInputTokens:_m,outputTokens:_m,reasoningOutputTokens:_m,costUsd:U().finite().min(0),unpricedRequests:_m,unmeteredRequests:_m}),Cm=Sm.shape,wm=q({harness:ym,sessionId:H().min(1).max(512),project:xm.nullable(),title:H().min(1).max(200).optional(),models:G(bm).max(16),firstAtMs:_m,lastAtMs:_m,...Cm});q({range:J(gm),from:vm.nullable(),to:vm,filters:q({harness:ym.nullable(),model:bm.nullable(),unknownModel:W(),project:xm.nullable(),unknownProject:W(),date:vm.nullable()}),reading:q({complete:W(),sources:_m,read:_m}),failures:G(q({harness:ym,message:H().max(2048)})).max(256),options:q({harnesses:G(ym).max(256),models:G(bm.nullable()).max(4096),projects:G(xm.nullable()).max(4096)}),modelLabels:G(q({harness:ym,model:bm,label:bm})).max(4096).optional(),credits:G(q({harness:ym,model:bm.nullable(),credits:U().finite().min(0),reportedRequests:_m,requests:_m})).max(4096).optional(),totals:Sm,daily:G(q({date:vm,harness:ym,...Cm})).max(2e5),hourly:G(q({weekday:U().int().min(0).max(6),hour:U().int().min(0).max(23),...Cm})).max(168),byHarness:G(q({harness:ym,...Cm})).max(256),byModel:G(q({model:bm.nullable(),...Cm,harnessPricedRequests:_m})).max(4096),byProject:G(q({project:xm.nullable(),...Cm})).max(4096),sessions:G(wm).max(100),recentSessions:G(wm).max(100).optional()}),K({threadId:Td}),K({discarded:W()});let Tm=ku(`type`,[K({id:H().min(1),type:Y(`choice`),prompt:H(),options:G(K({value:H().min(1),label:H(),description:H().optional()})).min(1),multiple:W(),allowOther:W(),optional:W()}),K({id:H().min(1),type:Y(`text`),prompt:H(),multiline:W(),secret:Y(!1),optional:W(),placeholder:H().optional(),prefill:H().optional()})]),Em=K({interactionId:H().min(1),turnId:H().min(1),title:H().optional(),questions:G(Tm).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});q({threadId:H().min(1)}),K({questions:G(Em)}),q({threadId:H().min(1),turnId:H().min(1),interactionId:H().min(1),answers:Fu(H(),G(H())),cancelled:W().default(!1)}),K({accepted:Y(!0)});let Dm=K({path:H(),oldText:H().nullable(),newText:H()});K({sessionId:H().min(1),turn:U().int().nonnegative(),path:H().min(1).optional()}),K({diffs:G(Dm)}),q({}),q({}),K({reference:K({sessionId:H().min(1),epoch:H().min(1),turn:U().int().nonnegative(),seq:U().int().nonnegative(),callId:H().min(1),part:U().int().nonnegative(),version:H().min(1)}),length:U().int().nonnegative(),bytes:U().int().nonnegative()}),q({title:H().trim().min(1).max(200),type:J([`info`,`warning`,`danger`]),body:H().trim().min(1).max(16384)}),q({}),q({url:H().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status`.split(`.`));let Om=J([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),km=J([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);q({threadId:H(),title:H(),harnessId:H(),state:Om,reason:km,inactiveMs:U().nonnegative()}),q({threadId:Td,turnId:Ed});let Am=K({email:H().trim().min(1).max(320).optional(),label:H().trim().min(1).max(256).optional(),plan:H().trim().min(1).max(128).optional(),credits:Hd.optional(),balance:Ud.optional()}).strict();function jm(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let Mm=jm(Am),Nm={harnessId:wd,harnessName:H().trim().min(1).max(128)},Pm=K(Nm).strict();K({}).strict(),K({sources:G(Pm).max(128)}).strict(),K({harnessId:wd,refresh:W().optional()}).strict(),K({...Nm,account:Mm.nullable(),accounts:G(Mm).max(8).optional()}).strict(),K({refresh:W().optional()}).strict(),K({accounts:G(jm(Am.extend(Nm))).max(128)}).strict(),K({harnessId:uf,model:qd.optional(),thinkingOptionId:Yd.optional(),permissionModeId:Od.optional(),prewarm:Y(!0).optional()}).strict();let Fm=H().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);K({harnessId:uf}).strict().extend({path:Fm.nullable()}),K({path:Fm.nullable(),restartRequired:W()}).strict(),K({harnessId:wd,action:J([`check`,`update`,`install`]),confirmedVersion:H().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let Im=K({currentVersion:H().min(1).max(128),latestVersion:H().min(1).max(128),updateAvailable:W(),canUpdate:W(),latestVerifiedVersion:H().min(1).max(128).optional(),confirmationRequired:Y(!0).optional(),versionKind:J([`cli`,`application`]).optional(),manualUpdateUrl:Ql().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:H().max(2048).optional(),messageCode:H().min(1).max(128).optional(),notice:Sd.optional(),latestVersionKind:J([`unknown`,`tracking-branch`]).optional()}).strict();K({taskId:H().uuid()}).strict(),ku(`status`,[K({taskId:H().uuid(),status:Y(`running`)}).strict(),K({taskId:H().uuid(),status:Y(`succeeded`),result:Im}).strict(),K({taskId:H().uuid(),status:Y(`failed`),error:K({code:U().int(),message:H().min(1).max(2048)}).strict()}).strict()]);let Lm=H().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Rm=H().trim().min(1),zm=J([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),Bm=K({accountId:Lm,label:Rm.max(256),email:H().email().max(320).optional(),planType:zm.optional()}).strict(),Vm=J([`ready`,`unavailable`]);K({version:Y(2),currentAccountId:Lm.nullable(),phase:Vm,revision:U().int().nonnegative(),instanceId:Rm.max(1024).optional(),accounts:G(Bm).max(1)}).strict(),K({accountId:Lm,refresh:W().optional()}).strict(),K({accountId:Lm,usage:Id.nullable(),accountCredits:Hd.optional(),freshness:J([`live`,`cached`]),observedAt:H().datetime().nullable()}).strict();let Hm=1e3,Um=H().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Wm=Um.max(1024),Gm=K({nativeSessionId:Wm,title:Um.max(4096).nullable(),updatedAt:U().int().nonnegative().max(864e13),cwd:Um.max(16384),running:W().nullable()}).strict();K({}).strict(),K({harnesses:G(K({harnessId:uf,name:Um.max(128)}).strict()).max(128)}).strict(),K({harnessId:uf,query:H().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:U().int().nonnegative().safe().optional(),limit:U().int().min(1).max(Hm).optional()}).strict(),K({candidates:G(Gm).max(Hm),total:U().int().nonnegative().safe()}).strict(),K({harnessId:uf,nativeSessionId:Wm}).strict(),K({threadId:Um.max(1024).pipe(Td)}).strict();let Km=H().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),qm=Wm,Jm=Gm;K({}).strict(),K({candidates:G(Jm).max(1e3)}).strict(),K({nativeSessionId:qm}).strict(),K({threadId:Km.max(1024).pipe(Td)}).strict(),K({threadId:Td,lastTurnId:Ed}).strict(),K({threadId:Td}).strict();let Ym=H().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();K({commands:G(K({id:Ym,invocation:H().min(1).max(128),label:H().trim().min(1).max(128),description:H().trim().min(1).max(512).optional(),localizations:xd.optional(),argumentMode:J([`none`,`text`]),kind:J([`command`,`skill`]).optional()}).strict()),warnings:G(H().min(1)).optional(),source:J([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),K({harnessId:wd,cwd:H().min(1).optional()}).strict(),K({threadId:Td}).strict(),K({threadId:Td,commandId:Ym,turnId:Ed.optional(),arguments:_d.optional()}).strict(),K({accepted:Y(!0),turnId:Ed.optional()}).strict();let Xm=Y(`2.0`).optional(),Zm=Cu().optional(),Qm=H().min(1),$m=Du([H(),U().int()]),eh=K({code:U().int(),message:H(),data:gd.optional()}).catchall(gd).superRefine(dd([`data`]));Du([K({jsonrpc:Xm,id:$m,method:Qm,params:gd.optional(),result:Zm,error:Zm}).catchall(gd).superRefine(dd([`jsonrpc`,`params`,`result`,`error`])),K({jsonrpc:Xm,id:Zm,method:Qm,params:gd.optional(),result:Zm,error:Zm}).catchall(gd).superRefine(dd([`jsonrpc`,`id`,`params`,`result`,`error`])),K({jsonrpc:Xm,id:$m,method:Zm,params:Zm,result:gd,error:Zm}).catchall(gd).superRefine(dd([`jsonrpc`,`method`,`params`,`error`])),K({jsonrpc:Xm,id:$m,method:Zm,params:Zm,result:Zm,error:eh}).catchall(gd).superRefine(dd([`jsonrpc`,`method`,`params`,`result`]))]);let th=H().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});q({harnessId:wd,nativeSessionId:th,locator:gd.optional(),formatVersion:Y(1)}).superRefine(dd([`locator`])),q({harnessId:wd,nativeSessionId:th,nativeTurnKey:th,formatVersion:Y(1)}),q({harnessId:wd,nativeSessionId:th,checkpointId:th,locator:gd.optional(),formatVersion:Y(1)}).superRefine(dd([`locator`]));let nh=H().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),rh=J([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),ih=q({version:nh,installation:rh,phase:J([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),updatedAt:U().int().nonnegative(),downloadedBytes:U().int().nonnegative().optional(),totalBytes:U().int().positive().optional(),error:H().min(1).max(500).nullable(),serviceStopOutput:H().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});q({});let ah=H().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);q({currentVersion:nh,installation:rh.nullable(),latestVersion:nh.nullable(),updateAvailable:W(),installationAvailable:W(),releaseNotes:H().min(1).max(2e4).nullable(),releaseNotesUrl:ah.nullable(),status:ih.nullable(),error:H().min(1).max(500).nullable()}),q({status:ih}),q({status:ih.nullable()});let oh=q({icon:H().min(1).max(16).optional(),title:H().min(1).max(120),body:H().min(1).max(1200),contributors:G(H().min(1).max(39)).max(30)}),sh=q({summary:H().min(1).max(600).optional(),themes:G(oh).min(1).max(12)}),ch=q({version:nh,publishedAt:ud(),url:H().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:sh.nullable(),en:sh.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});q({manual:W().optional()}),q({announcement:ch.nullable(),unread:W()}),q({version:nh}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let lh=J([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);K({runningVersion:H().nullable(),installedVersion:H().nullable(),restartRequired:W(),remote:W(),updateSupported:W(),update:K({phase:lh,targetVersion:H().nullable(),error:H().nullable()})});let uh=K({version:H().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();K({hostname:H().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:U().int().min(1).max(65535).nullable(),identity:H().max(4096).nullable(),action:J([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:W().optional(),version:H().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),K({state:J([`installed`,`not-installed`])}).strict();let X=H().min(1).max(1024),dh={hostId:X.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},fh={...dh,threadId:X},ph=H().min(1).max(8e3),mh={text:ph,requestId:X};ku(`accepted`,[K({accepted:Y(!0),startQueuedItemId:X.optional()}),K({accepted:Y(!1),code:J([`remote/queue-unavailable`,`remote/steer-unavailable`,`remote/turn-changed`,`remote/send-rejected`,`session/queue-item-not-found`,`session/queue-item-starting`]),message:H()})]),ku(`available`,[K({available:Y(!1)}),K({available:Y(!0),items:G(K({id:X,clientUserMessageId:X,preview:H().max(801)})).max(100)})]);let hh=ku(`kind`,[q({kind:Y(`hosts`)}),q({kind:Y(`create`),...dh,cwd:H().min(1).max(8192),epoch:X}),q({kind:Y(`projectHarnesses`),...dh,epoch:X}),q({kind:Y(`inspectHarness`),...dh,epoch:X,cwd:H().min(1).max(8192),harnessId:X}),q({kind:Y(`startSelected`),...dh,epoch:X,cwd:H().min(1).max(8192),harnessId:X,model:H().min(1).max(4096),serviceTier:J([`priority`,`ultrafast`]).optional(),reasoningEffort:X.optional()}),q({kind:Y(`status`),...fh}),q({kind:Y(`list`),...dh,cursor:H().nullable(),archived:W(),includeLoaded:Y(!0).optional()}),q({kind:Y(`read`),...fh,page:q({cursor:H().min(1).max(8192).nullable(),epoch:X.optional(),sortDirection:J([`asc`,`desc`]).optional(),limit:U().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),q({kind:Y(`usage`),...fh,epoch:X}),q({kind:Y(`configure`),...fh,epoch:X,modelId:X.optional(),serviceTier:Kd.optional(),thinkingOptionId:X.optional(),permissionModeId:X.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`).refine(e=>e.serviceTier===void 0||e.modelId!==void 0,{message:`A service tier requires a Model ID`}),q({kind:Y(`prompt`),...fh,epoch:X,text:ph,requestId:X.optional()}),q({kind:Y(`queue`),...fh,epoch:X}),q({kind:Y(`delivery`),...fh,epoch:X,action:ku(`kind`,[q({kind:Y(`enqueue`),...mh}),q({kind:Y(`steer`),...mh,turnId:X}),q({kind:Y(`remove`),itemId:X}),q({kind:Y(`start`),itemId:X,onlyIfHead:Y(!0).optional()})])}),q({kind:Y(`interrupt`),...fh,epoch:X,turnId:X}),q({kind:Y(`rename`),...fh,epoch:X,name:H().min(1).max(512)}),q({kind:Y(`archive`),...fh,epoch:X,archived:W()}),q({kind:Y(`respond`),...fh,epoch:X,requestId:Du([X,U().int()]),result:Fu(H(),xu())})]),gh=H().min(1).max(1024),_h=K({hostId:gh,displayName:H().min(1).max(1024),source:J([`codex-managed`,`discovered`]),sshAlias:H().max(1024).nullable(),sshHost:H().min(1).max(1024),sshPort:U().int().min(1).max(65535).nullable(),identity:H().max(4096).nullable(),autoConnect:W(),connectionAnalyticsId:H().max(1024).optional()}),vh=q({displayName:H().min(1).max(1024),hostname:H().min(1).max(1024),sshPort:U().int().min(1).max(65535).nullable(),identity:H().max(4096).nullable()});ku(`action`,[q({action:Y(`session`),operation:hh}),q({action:Y(`list`)}),q({action:Y(`catalog`)}),q({action:Y(`read-thread`),hostId:gh.refine(e=>e!==`local`),input:Yp}),q({action:Y(`save`),draft:vh,previous:_h.nullable()}),q({action:Y(`remove`),previous:_h}),q({action:Y(`connect`),hostId:gh,enabled:W()}),q({action:Y(`state`),hostId:gh}),q({action:Y(`runtime`),hostId:gh}),q({action:Y(`update`),hostId:gh.refine(e=>e!==`local`),version:uh.shape.version})]),Du([q({result:gd}),q({error:q({code:U().int(),message:H()})})]),q({prompt:H().trim().min(1).max(2e3),cwd:H().max(4096).nullable()}),H().trim().min(1).max(60).nullable();let yh=H().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),bh=Du([H(),K({en:H()}).catchall(H())]),xh=K({title:bh.optional(),description:bh.optional(),icon:H().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:H().optional()});K({extensions:G(K({id:yh,name:H().min(1).max(214),version:H().min(1).max(128),format:Y(`dsh`),supportedTargets:Nu([Y(`web`)]),enabledTargets:G(Y(`web`)).max(1),source:H().min(1).max(4096),projectUrl:H().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:H(),meta:xh.optional(),loadError:H().optional()})),loadedIds:G(yh),safeMode:W(),storeError:H().optional()});let Sh=H().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);K({spec:H().trim().min(1).max(4096),registry:Sh.optional()}).strict(),K({id:yh,enabled:W()}).strict(),K({id:yh}).strict();let Ch=H().regex(/^[a-zA-Z0-9_-]{1,64}$/u),wh=H().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),Th=J([`relay`,`tailscale`,`lan`,`custom`]),Eh=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],Dh=J(Eh),Oh=new Set(Eh);function kh(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return Eh[(t>>>0)%Eh.length]??Eh[0]}function Ah(e,t){return typeof t==`string`&&Oh.has(t)?t:kh(e)}let jh=J([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]);K({peers:G(K({peerId:Ch,hostId:wh,name:H().min(1).max(120),color:Dh.optional(),origin:H().min(1).max(2048),transportKind:Th,encrypted:W(),enabled:W(),state:jh,latencyMs:U().int().nonnegative().optional(),version:H().max(128).optional(),platform:H().max(64).optional(),hostname:H().max(255).optional(),homeDir:H().max(4096).optional(),lastError:H().max(1e3).optional(),projectCount:U().int().nonnegative(),createdAt:H(),updatedAt:H()}))}),K({connectionUrl:H().min(1).max(4096).optional(),origin:H().min(1).max(2048).optional(),token:H().min(1).max(2048).optional(),name:H().trim().min(1).max(120).optional(),color:Dh.optional()}).refine(e=>!!e.connectionUrl||!!e.origin&&!!e.token,`Provide either connectionUrl or both origin and token`),K({peerId:Ch,name:H().trim().min(1).max(120).optional(),color:Dh.nullable().optional(),connectionUrl:H().min(1).max(4096).optional(),origin:H().min(1).max(2048).optional(),token:H().min(1).max(2048).optional(),enabled:W().optional()}),K({peerId:Ch}),K({removed:W()}),K({peerId:Ch.optional(),connectionUrl:H().min(1).max(4096).optional(),origin:H().min(1).max(2048).optional(),token:H().min(1).max(2048).optional()}).refine(e=>!!e.peerId||!!e.connectionUrl||!!e.origin&&!!e.token,`Provide peerId, connectionUrl, or both origin and token`);let Mh=K({id:H().min(1).max(1024),name:H().min(1).max(512),path:H().min(1).max(8192)});K({ok:W(),latencyMs:U().int().nonnegative().optional(),origin:H().max(2048).optional(),transportKind:Th.optional(),encrypted:W().optional(),version:H().max(128).optional(),platform:H().max(64).optional(),hostname:H().max(255).optional(),homeDir:H().max(4096).optional(),projectCount:U().int().nonnegative().optional(),projects:G(Mh).optional(),error:H().max(1e3).optional()});let Nh=K({id:H().min(1).max(1024),name:H().min(1).max(512),path:H().min(1).max(8192),threadIds:G(H().min(1).max(1024))}),Ph=K({attachments:Y(1).optional(),workspaceFiles:Y(1).optional(),officePreview:Y(1).optional()}),Fh=K({version:H().max(128),platform:H().max(64),hostname:H().max(255),homeDir:H().max(4096).optional(),epoch:H().min(1).max(256),projects:G(Nh),capabilities:Ph.optional()});q({threadId:H().min(1).max(1024),scope:H().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u).optional(),requestId:H().min(1).max(256).optional(),mode:J([`queue`,`steer`]).optional(),expectedTurnId:H().min(1).max(1024).nullable().optional(),content:G(ku(`type`,[q({type:Y(`text`),text:H()}),q({type:Y(`file`),receiptId:H().min(1).max(128)})])).min(1).max(64)});let Ih=K({ok:Y(!1),error:K({code:H(),message:H(),details:Fu(H(),xu()).optional()})});Du([K({ok:Y(!0),value:K({receiptId:H().min(1),file:K({attachmentId:H(),name:H(),bytes:U().int().nonnegative()})})}),Ih]),Du([K({ok:Y(!0),value:K({accepted:Y(!0)})}),Ih]);let Lh=K({name:H().min(1).max(512),path:H().min(1).max(8192),kind:Y(`directory`)});K({peerId:Ch,path:H().min(1).max(8192).optional()}),K({path:H().min(1).max(8192),parentPath:H().min(1).max(8192).nullable(),homeDir:H().min(1).max(8192).optional(),entries:G(Lh)}),K({peerId:Ch,parentPath:H().min(1).max(8192),name:H().min(1).max(255).refine(e=>e.trim().length>0,`Directory name cannot be blank`)}),K({path:H().min(1).max(8192),name:H().min(1).max(255)}),K({peerId:Ch,path:H().min(1).max(8192),title:H().trim().min(1).max(255).optional()}),K({peerId:Ch,workspaceId:H().min(1).max(1024),title:H().trim().min(1).max(255)}),K({peerId:Ch,workspaceId:H().min(1).max(1024)}),K({workspaceId:H().min(1).max(1024).optional(),manifest:Fh}),Y(1);function Rh({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:F.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[r?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${F.slot} ${F.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:F.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.slot,children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:F.title,children:n}),c]})}function zh({host:e,variant:t=`workspace`,t:n}){let r=e?.displayName??n(`host.local`),i=e?.state===`connected`?n(`host.connected`):e?.state===`connecting`?n(`host.connecting`):n(`host.disconnected`),a=e?`${r} · ${i}`:r,s=e===void 0?void 0:Ah(e.hostId,e.color);return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:R(F.hostBadge,t===`session`&&F.hostBadgeSession),"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,"data-color":s,role:`img`,"aria-label":a,title:a,children:[e!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hostDot,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hostLabel,children:r})]})}let Bh=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Bh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Bh,e.textContent=`.jGgv6G_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}.jGgv6G_branch:has(>:first-child [data-harness-id]){--dsh-thread-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-harness-id])>.jGgv6G_children{--dsh-thread-parent-icon-size:14px}.jGgv6G_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}.jGgv6G_children .jGgv6G_children{--dsh-thread-guide-parent-gap:10px}.jGgv6G_children[hidden]{display:none}.jGgv6G_children[data-thread-guide]:before,.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:before{content:"";pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--dsh-thread-guide-axis)}.jGgv6G_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}.jGgv6G_children[data-thread-guide]>.jGgv6G_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}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:first-child:before{--dsh-thread-guide-stem-start:max(0px, var(--dsh-thread-guide-start))}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:last-child:before{--dsh-thread-guide-stem-end:8px;bottom:calc(100% - var(--dsh-thread-icon-center-y))}.jGgv6G_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}.jGgv6G_summary [data-thread-tree-activity=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.jGgv6G_summary [data-thread-tree-activity=pending]{color:var(--dsw-alias-state-warn-primary)}.jGgv6G_summary [data-thread-tree-activity=completed]{color:var(--dsw-alias-state-business-primary)}@media (hover:hover) and (pointer:fine){.jGgv6G_summary:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)}}.jGgv6G_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){.jGgv6G_branch{--dsh-thread-row-height:44px}.jGgv6G_summary{min-height:24px;padding-block:3px}}[data-phone-drawer] .jGgv6G_branch{--dsh-thread-row-height:44px}[data-phone-drawer] .jGgv6G_branch:has(>:first-child>[data-thread-summary]){--dsh-thread-icon-center-y:14px}`,document.head.appendChild(e)}var Vh={branch:`jGgv6G_branch`,children:`jGgv6G_children`,summary:`jGgv6G_summary`};function Hh(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function Uh(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function Wh(e,t,n){return[n(`threadTree.children`,{n:e}),...Hh(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function Gh({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),Hh(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 Kh=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Kh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Kh,e.textContent=`.yY-O0a_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%}.yY-O0a_ring svg{width:100%;height:100%;display:block}.yY-O0a_ring circle{stroke:currentColor;stroke-width:1.5px}.yY-O0a_ring[data-thread-ring=pending]{color:var(--dsw-alias-state-warn-primary)}.yY-O0a_ring[data-thread-ring=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.yY-O0a_ring[data-thread-ring=running] svg{animation:1.8s linear infinite yY-O0a_spin}.yY-O0a_ring[data-thread-ring=running] circle{stroke-dasharray:48 16.4}.yY-O0a_ring[data-thread-ring=idle]{color:var(--dsw-alias-label-tertiary);opacity:.55}.yY-O0a_ring[data-thread-ring=idle] circle{stroke-width:1px;stroke-dasharray:1.5 3}@keyframes yY-O0a_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.yY-O0a_ring[data-thread-ring=running] svg{animation:none}}`,document.head.appendChild(e)}var qh={ring:`yY-O0a_ring`,spin:`yY-O0a_spin`};function Jh({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:qh.ring,"data-thread-ring":Uh(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 Yh=[{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 Xh({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:Jt.preview,"aria-hidden":`true`,children:Yh.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:Vh.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${F.sessionRow} ${Jt.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Rh,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:Jt.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(Jh,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${Vh.summary} ${Jt.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(Gh,{count:2,activity:r,t})})]})},n))})}function Zh({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}=Xt(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:Jt.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Jt.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Jt.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:Jt.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Jt.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`?Yt[e.key===`Home`?0:1]:Yt[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:Yt.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:Jt.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:Jt.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Jt.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(Xh,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Jt.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let Qh=(0,s.createContext)(void 0),$h=()=>(0,s.useContext)(Qh);function eg({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(tg,{node:e,renderRow:t},e.id))}function tg({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=ln(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Vh.branch,"data-thread-branch":!0,children:[/* @__PURE__ */ (0,o.jsx)(Qh.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(Zh,{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:Vh.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(eg,{roots:p,children:t})})]})}function ng({node:e,title:t,toggle:n,prefix:r,t:i}){let a=$h(),c=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=c.current;return()=>{e!==null&&document.activeElement===e&&e.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0})}},[]);let l=e.tree;if(!l||l.descendantCount===0)return null;let u=Wh(l.descendantCount,l.activity,i);return/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:c,type:`button`,"data-thread-summary":!0,className:Vh.summary,"aria-label":i(`threadTree.expandSummary`,{title:t,summary:u}),"aria-expanded":!1,"aria-controls":a,onClick:e=>{e.stopPropagation(),e.currentTarget.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0}),n()},children:[r,r!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),/* @__PURE__ */ (0,o.jsx)(Gh,{count:l.descendantCount,activity:l.activity,t:i})]})}function rg(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function ig(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 ag(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 og(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 sg({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTitle,children:e}),t!==void 0&&t!==``&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverPath,children:t}),n!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTime,children:og(n,r)})]})}function cg(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function lg({group:e,onToggle:t,onCreate:n,actions:r,drag:i,showHost:c=!0,home:l,newShortcut:u,t:d}){let f=e,p=e.remote?void 0:r,m=e.remote?void 0:i,h=f.workspaceId===void 0?d(`group.ungrouped`):f.label,g=f.remote===void 0?void 0:Ah(f.remote.hostId,f.remote.color),_=c&&f.workspaceId!==void 0&&f.remote!==void 0,[v,y]=(0,s.useState)(!1),[x,S]=(0,s.useState)(null),C=[{id:`rename`,label:d(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{})},{id:`delete`,label:d(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{}),danger:!0}],w=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(F.projectRow,v&&F.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":f.expanded,tabIndex:-1,onContextMenu:e=>{p&&!e.target.closest(`button`)&&(e.preventDefault(),S(new DOMRect(e.clientX,e.clientY,0,0)),y(!0))},onKeyDown:e=>{e.target===e.currentTarget&&p&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),S(null),y(!0))},onClick:t,draggable:m!==void 0,onDragStart:m===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,f.key),m.start()},onDragEnd:m?.end,children:[_&&f.remote&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(F.hostRail,F.hostRailWorkspace),"data-color":g,"data-state":f.remote.state,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(F.slot,f.expanded&&F.folderExpanded),children:f.expanded?/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.title,children:h})}),_&&f.remote&&/* @__PURE__ */ (0,o.jsx)(zh,{host:f.remote,variant:`workspace`,t:d}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.rowActions,children:[p!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:v,onClose:()=>{y(!1)},items:C,onSelect:e=>{
|
|
121
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Tc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Tc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let Ec=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Dc=[`oneOf`,`anyOf`];function Oc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function kc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ec.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Oc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Tn(n,r,e.length===1?e[0]:kc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Oc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ac(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ec)if(t in e)return;let n=t.filter(e=>Dc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=kc(t);else{let e=n[0],i=Dc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>kc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,yc(e,r))}function jc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):yc(i,s),yc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Tc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ac(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}yc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Tn(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Pc(t,`input`,e.processors),output:Pc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Mc(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Mc(r.element,n);if(r.type===`set`)return Mc(r.valueType,n);if(r.type===`lazy`)return Mc(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Mc(r.innerType,n);if(r.type===`intersection`)return Mc(r.left,n)||Mc(r.right,n);if(r.type===`record`||r.type===`map`)return Mc(r.keyType,n)||Mc(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Mc(r.in,n)||Mc(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Mc(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Mc(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Mc(e,n))return!0;return!!(r.rest&&Mc(r.rest,n))}return!1}let Nc=(e,t={})=>n=>{let r=bc({...n,processors:t});return Sc(e,r),wc(r,e),jc(r,e)},Pc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=bc({...i??{},target:a,io:t,processors:n});return Sc(e,o),wc(o,e),jc(o,e)},Fc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Ic=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Lc=(e,t)=>{Fc(e,`minimum`,t),Ic(e,`maximum`,t)},Rc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},zc=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},Bc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Vc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Hc=(e,t)=>Fc(e,`minimum`,t.minimum),Uc=(e,t)=>Ic(e,`maximum`,t.maximum),Wc=e=>(t,n)=>{Vc(t,n.format);let[r,i]=e[n.format];Fc(t,`minimum`,r),Ic(t,`maximum`,i)},Gc={greater_than:(e,t)=>Fc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Ic(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Rc(e,t.value),number_format:Wc(Gn),bigint_format:Wc(Kn),min_length:Hc,max_length:Uc,length_equals:(e,t)=>Lc(e,t.length),min_size:Hc,max_size:Uc,size_equals:(e,t)=>Lc(e,t.size),string_format:(e,t)=>{Vc(e,t.format),t.pattern&&zc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Bc(e,t.mime)};function Kc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Gc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Fc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Fc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Ic(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Ic(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Rc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Bc(t,i.mime);for(let e of i.patterns??[])zc(t,e);return t}let qc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Jc=/* @__PURE__ */ new Map([[Wa,Ti],[Ka,Ei]]),Yc=e=>Jc.get(e)??e,Xc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Kc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=qc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Yc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Zc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Kc(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):xc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Qc=(e,t,n,r)=>{n.type=`boolean`},$c=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},el=(e,t,n,r)=>{n.not={}},tl=(e,t,n,r)=>{let i=e._zod.def,a=hn(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},nl=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(xc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(xc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},rl=(e,t,n,r)=>{xc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},il=(e,t,n,r)=>{xc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},al=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Kc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Sc(a.element,t,{...r,path:[...r.path,`items`]})};function ol(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ol(t.out):t.type===`catch`?ol(t.innerType):e._zod.optin}let sl=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&xc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Tn(i.properties,e,Sc(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ol(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Sc(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},cl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Sc(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ll=(e,t,n,r)=>{let i=e._zod.def,a=Sc(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Sc(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},ul=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Sc(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Sc(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ol(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=Kc(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function dl(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=dl(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>dl(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Li:Ii).source)),p}let fl=/* @__PURE__ */ new WeakMap;function pl(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of fl.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=dl(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}let ml=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Kc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Sc(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Tn(i.patternProperties,Yc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Sc(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=fl.get(t);n||(n=[],fl.set(t,n),t.deferred.push(()=>pl(t))),n.push(e)}i.additionalProperties=Sc(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ol(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},hl=(e,t,n,r)=>{let i=e._zod.def,a=Sc(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},gl=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},_l=Symbol();function vl(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(xc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),_l):JSON.parse(o)}let yl=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=vl(i.defaultValue,e,t,n,r);o!==_l&&(n.default=o)},bl=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=vl(i.defaultValue,e,t,n,r);o!==_l&&(n._prefault=o)},xl=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{xc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Sl=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Sc(o,t,r);let s=t.seen.get(e);s.ref=o},Cl=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},wl=(e,t,n,r)=>{let i=e._zod.def;Sc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Tl=(e,t,n,r)=>{let i=e._zod.innerType;Sc(i,t,r);let a=t.seen.get(e);a.ref=i},El=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Dl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let Ol=/*@__PURE__*/ V(`ZodError`,(e,t)=>{Br.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);El.has(n)||(El.add(n),Dl(n,`format`,e=>t=>Ur(e,t)),Dl(n,`flatten`,e=>t=>Hr(e,t)),Dl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,_n,2)}),Dl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,_n,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),kl=/* @__PURE__ */ Gr(Ol),Al=/* @__PURE__ */ Kr(Ol),jl=/* @__PURE__ */ qr(Ol),Ml=/* @__PURE__ */ Yr(Ol),Nl=/* @__PURE__ */ ti(Ol),Pl=/* @__PURE__ */ ni(Ol),Fl=/* @__PURE__ */ ri(Ol),Il=/* @__PURE__ */ ii(Ol),Ll=/* @__PURE__ */ ai(Ol),Rl=/* @__PURE__ */ oi(Ol),zl=/* @__PURE__ */ si(Ol),Bl=/* @__PURE__ */ ci(Ol);function Vl(){Mr.localeError||Nr(ls())}function Hl(){Mr.memoizer||Nr({memoizer:os()})}let Ul=/*@__PURE__*/ V(`ZodType`,(e,t)=>(Vl(),ca.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Mn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Hn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(fd(e,t))},superRefine(e,t){return this.check(pd(e,t))},overwrite(e){return this.check(/* @__PURE__ */ cc(e))},optional(){return Gu(this)},exactOptional(){return qu(this)},nullable(){return Yu(this)},nullish(){return Gu(Yu(this))},nonoptional(e){return td(this,e)},array(){return G(this)},or(e){return ju([this,e])},and(e){return Fu(this,e)},transform(e){return ad(this,Uu(e))},default(e){return Zu(this,e)},prefault(e){return $u(this,e)},catch(e){return rd(this,e)},pipe(e){return ad(this,e)},readonly(){return sd(this)},describe(e){let t=this.clone();return ps.add(t,{description:e}),t},meta(...e){if(e.length===0)return ps.get(this);let t=this.clone();return ps.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return gr(this,`~standard`,{...da(this),jsonSchema:{input:Pc(this,`input`),output:Pc(this,`output`)}})},set"~standard"(e){hr(this,`~standard`,e)},parse:function e(t,n){return kl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Al(this,t,n,{callee:e})},safeParse(e,t){return jl(this,e,t)},async safeParseAsync(e,t){return Ml(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){hr(this,`spa`,e)},validate(e,t){return Qr(this,e,t)},validateAsync(e,t){return ei(this,e,t)},encode:function e(t,n){return Nl(this,t,n,{callee:e})},decode:function e(t,n){return Pl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Fl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Il(this,t,n,{callee:e})},safeEncode(e,t){return Ll(this,e,t)},safeDecode(e,t){return Rl(this,e,t)},async safeEncodeAsync(e,t){return zl(this,e,t)},async safeDecodeAsync(e,t){return Bl(this,e,t)},toJSONSchema(e){return Nc(this,{})(e)},get description(){return ps.get(this)?.description},get _def(){return this._zod.def}}),Wl=/*@__PURE__*/ V(`_ZodString`,(e,t)=>{fa.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xc(e,t,n,r)},/*@__PURE__*/ _r({format:e=>Kc(e).format??null,minLength:e=>Kc(e).minimum??null,maxLength:e=>Kc(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ nc(...e))},includes(...e){return this.check(/* @__PURE__ */ ac(...e))},startsWith(...e){return this.check(/* @__PURE__ */ oc(...e))},endsWith(...e){return this.check(/* @__PURE__ */ sc(...e))},min(...e){return this.check(/* @__PURE__ */ ec(...e))},max(...e){return this.check(/* @__PURE__ */ $s(...e))},length(...e){return this.check(/* @__PURE__ */ tc(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ec(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ rc(e))},uppercase(e){return this.check(/* @__PURE__ */ ic(e))},trim(){return this.check(/* @__PURE__ */ uc())},normalize(...e){return this.check(/* @__PURE__ */ lc(...e))},toLowerCase(){return this.check(/* @__PURE__ */ dc())},toUpperCase(){return this.check(/* @__PURE__ */ fc())},slugify(){return this.check(/* @__PURE__ */ pc())}})),Gl=/*@__PURE__*/ V(`ZodString`,(e,t)=>{fa.init(e,t),Wl.init(e,t)},{email(e){return this.check(/* @__PURE__ */ gs(Zl,e))},url(e){return this.check(/* @__PURE__ */ Ss(tu,e))},jwt(e){return this.check(/* @__PURE__ */ Ls(_u,e))},emoji(e){return this.check(/* @__PURE__ */ Cs(ru,e))},guid(e){return this.check(/* @__PURE__ */ _s(Ql,e))},uuid(e){return this.check(/* @__PURE__ */ vs($l,e))},uuidv4(e){return this.check(/* @__PURE__ */ ys($l,e))},uuidv6(e){return this.check(/* @__PURE__ */ bs($l,e))},uuidv7(e){return this.check(/* @__PURE__ */ xs($l,e))},nanoid(e){return this.check(/* @__PURE__ */ ws(iu,e))},cuid(e){return this.check(/* @__PURE__ */ Ts(au,e))},cuid2(e){return this.check(/* @__PURE__ */ Es(ou,e))},ulid(e){return this.check(/* @__PURE__ */ Ds(su,e))},base64(e){return this.check(/* @__PURE__ */ Ps(mu,e))},base64url(e){return this.check(/* @__PURE__ */ Fs(hu,e))},xid(e){return this.check(/* @__PURE__ */ Os(cu,e))},ksuid(e){return this.check(/* @__PURE__ */ ks(lu,e))},ipv4(e){return this.check(/* @__PURE__ */ As(uu,e))},ipv6(e){return this.check(/* @__PURE__ */ js(du,e))},cidrv4(e){return this.check(/* @__PURE__ */ Ms(fu,e))},cidrv6(e){return this.check(/* @__PURE__ */ Ns(pu,e))},e164(e){return this.check(/* @__PURE__ */ Is(gu,e))},datetime(e){return this.check(/* @__PURE__ */ Rs(ql,e))},date(e){return this.check(/* @__PURE__ */ zs(Jl,e))},time(e){return this.check(/* @__PURE__ */ Bs(Yl,e))},duration(e){return this.check(/* @__PURE__ */ Vs(Xl,e))}});function H(e){return/* @__PURE__ */ hs(Gl,e)}let Kl=/*@__PURE__*/ V(`ZodStringFormat`,(e,t)=>{pa.init(e,t),Wl.init(e,t)}),ql=/*@__PURE__*/ V(`ZodISODateTime`,(e,t)=>{Ma.init(e,t),Kl.init(e,t)}),Jl=/*@__PURE__*/ V(`ZodISODate`,(e,t)=>{Na.init(e,t),Kl.init(e,t)}),Yl=/*@__PURE__*/ V(`ZodISOTime`,(e,t)=>{Pa.init(e,t),Kl.init(e,t)}),Xl=/*@__PURE__*/ V(`ZodISODuration`,(e,t)=>{Fa.init(e,t),Kl.init(e,t)}),Zl=/*@__PURE__*/ V(`ZodEmail`,(e,t)=>{ga.init(e,t),Kl.init(e,t)}),Ql=/*@__PURE__*/ V(`ZodGUID`,(e,t)=>{ma.init(e,t),Kl.init(e,t)}),$l=/*@__PURE__*/ V(`ZodUUID`,(e,t)=>{ha.init(e,t),Kl.init(e,t)});function eu(e){return/* @__PURE__ */ vs($l,e)}let tu=/*@__PURE__*/ V(`ZodURL`,(e,t)=>{wa.init(e,t),Kl.init(e,t)});function nu(e){return/* @__PURE__ */ Ss(tu,e)}let ru=/*@__PURE__*/ V(`ZodEmoji`,(e,t)=>{Ta.init(e,t),Kl.init(e,t)}),iu=/*@__PURE__*/ V(`ZodNanoID`,(e,t)=>{Ea.init(e,t),Kl.init(e,t)}),au=/*@__PURE__*/ V(`ZodCUID`,(e,t)=>{Da.init(e,t),Kl.init(e,t)}),ou=/*@__PURE__*/ V(`ZodCUID2`,(e,t)=>{Oa.init(e,t),Kl.init(e,t)}),su=/*@__PURE__*/ V(`ZodULID`,(e,t)=>{ka.init(e,t),Kl.init(e,t)}),cu=/*@__PURE__*/ V(`ZodXID`,(e,t)=>{Aa.init(e,t),Kl.init(e,t)}),lu=/*@__PURE__*/ V(`ZodKSUID`,(e,t)=>{ja.init(e,t),Kl.init(e,t)}),uu=/*@__PURE__*/ V(`ZodIPv4`,(e,t)=>{Ia.init(e,t),Kl.init(e,t)}),du=/*@__PURE__*/ V(`ZodIPv6`,(e,t)=>{za.init(e,t),Kl.init(e,t)}),fu=/*@__PURE__*/ V(`ZodCIDRv4`,(e,t)=>{Ba.init(e,t),Kl.init(e,t)}),pu=/*@__PURE__*/ V(`ZodCIDRv6`,(e,t)=>{Ha.init(e,t),Kl.init(e,t)}),mu=/*@__PURE__*/ V(`ZodBase64`,(e,t)=>{Ga.init(e,t),Kl.init(e,t)}),hu=/*@__PURE__*/ V(`ZodBase64URL`,(e,t)=>{Ja.init(e,t),Kl.init(e,t)}),gu=/*@__PURE__*/ V(`ZodE164`,(e,t)=>{Ya.init(e,t),Kl.init(e,t)}),_u=/*@__PURE__*/ V(`ZodJWT`,(e,t)=>{Za.init(e,t),Kl.init(e,t)}),vu=/*@__PURE__*/ V(`ZodNumber`,(e,t)=>{Qa.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zc(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ _r({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Kc(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Kc(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Kc(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Kc(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ Xs(e,t))},gte(e,t){return this.check(/* @__PURE__ */ Zs(e,t))},min(e,t){return this.check(/* @__PURE__ */ Zs(e,t))},lt(e,t){return this.check(/* @__PURE__ */ Js(e,t))},lte(e,t){return this.check(/* @__PURE__ */ Ys(e,t))},max(e,t){return this.check(/* @__PURE__ */ Ys(e,t))},int(e){return this.check(bu(e))},safe(e){return this.check(bu(e))},positive(e){return this.check(/* @__PURE__ */ Xs(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ Zs(0,e))},negative(e){return this.check(/* @__PURE__ */ Js(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ Ys(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ Qs(e,t))},step(e,t){return this.check(/* @__PURE__ */ Qs(e,t))},finite(){return this}}));function U(e){return/* @__PURE__ */ Hs(vu,e)}let yu=/*@__PURE__*/ V(`ZodNumberFormat`,(e,t)=>{$a.init(e,t),vu.init(e,t)});function bu(e){return/* @__PURE__ */ Us(yu,e)}let xu=/*@__PURE__*/ V(`ZodBoolean`,(e,t)=>{eo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r)});function W(e){return/* @__PURE__ */ Ws(xu,e)}let Su=/*@__PURE__*/ V(`ZodNull`,(e,t)=>{to.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r)});function Cu(e){return/* @__PURE__ */ Gs(Su,e)}let wu=/*@__PURE__*/ V(`ZodUnknown`,(e,t)=>{no.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Tu(){return/* @__PURE__ */ Ks(wu)}let Eu=/*@__PURE__*/ V(`ZodNever`,(e,t)=>{ro.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r)});function Du(e){return/* @__PURE__ */ qs(Eu,e)}let Ou=/*@__PURE__*/ V(`ZodArray`,(e,t)=>{Hl(),so.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>al(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ ec(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ec(1,e))},max(e,t){return this.check(/* @__PURE__ */ $s(e,t))},length(e,t){return this.check(/* @__PURE__ */ tc(e,t))},unwrap(){return this.element}});function G(e,t){return/* @__PURE__ */ mc(Ou,e,t)}let ku=/*@__PURE__*/ V(`ZodObject`,(e,t)=>{Hl(),mo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r),Cr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return J(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Mn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Mn(this._zod.def,{catchall:Tu()}))},loose(){return this.clone(Mn(this._zod.def,{catchall:Tu()}))},strict(){return this.clone(Mn(this._zod.def,{catchall:Du()}))},strip(){return this.clone(Mn(this._zod.def,{catchall:void 0}))},extend(e){return Xn(this,e)},safeExtend(e){return Qn(this,e)},merge(e){return $n(this,e)},pick(e){return qn(this,e)},omit(e){return Yn(this,e)},partial(...e){return er(Wu,this,e[0])},exactPartial(...e){return er(Ku,this,e[0],`exactPartial`)},required(...e){return tr(ed,this,e[0])}});function K(e,t){let n={type:`object`,shape:e??{},...z(t)};return new ku(n)}function q(e,t){return new ku({type:`object`,shape:e,catchall:Du(),...z(t)})}let Au=/*@__PURE__*/ V(`ZodUnion`,(e,t)=>{go.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.options=t.options});function ju(e,t){return new Au({type:`union`,options:e,...z(t)})}let Mu=/*@__PURE__*/ V(`ZodDiscriminatedUnion`,(e,t)=>{Au.init(e,t),vo.init(e,t)});function Nu(e,t,n){return new Mu({type:`union`,options:t,discriminator:e,...z(n)})}let Pu=/*@__PURE__*/ V(`ZodIntersection`,(e,t)=>{yo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r)});function Fu(e,t){return new Pu({type:`intersection`,left:e,right:t})}let Iu=/*@__PURE__*/ V(`ZodTuple`,(e,t)=>{Hl(),So.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ul(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Wu({type:`optional`,innerType:e}))})}});function Lu(e,t,n){let r=t instanceof ca;return new Iu({type:`tuple`,items:e,rest:r?t:null,...z(r?n:t)})}let Ru=/*@__PURE__*/ V(`ZodRecord`,(e,t)=>{Hl(),Eo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ml(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function zu(e,t,n){return!t||!t._zod?new Ru({type:`record`,keyType:H(),valueType:e,...z(t)}):new Ru({type:`record`,keyType:e,valueType:t,...z(n)})}let Bu=/*@__PURE__*/ V(`ZodEnum`,(e,t)=>{Do.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Bu({...t,checks:[],...z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Bu({...t,checks:[],...z(r),entries:i})}});function J(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Bu({type:`enum`,entries:n,...z(t)})}let Vu=/*@__PURE__*/ V(`ZodLiteral`,(e,t)=>{Oo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nl(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new Vu({type:`literal`,values:Array.isArray(e)?e:[e],...z(t)})}let Hu=/*@__PURE__*/ V(`ZodTransform`,(e,t)=>{Hl(),ko.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new jr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(pr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(pr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Uu(e){return new Hu({type:`transform`,transform:e})}let Wu=/*@__PURE__*/ V(`ZodOptional`,(e,t)=>{jo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gu(e){return new Wu({type:`optional`,innerType:e})}let Ku=/*@__PURE__*/ V(`ZodExactOptional`,(e,t)=>{Mo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qu(e){return new Ku({type:`optional`,innerType:e})}let Ju=/*@__PURE__*/ V(`ZodNullable`,(e,t)=>{No.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yu(e){return new Ju({type:`nullable`,innerType:e})}let Xu=/*@__PURE__*/ V(`ZodDefault`,(e,t)=>{Po.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Zu(e,t){return new Xu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():zn(t)}})}let Qu=/*@__PURE__*/ V(`ZodPrefault`,(e,t)=>{Io.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $u(e,t){return new Qu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():zn(t)}})}let ed=/*@__PURE__*/ V(`ZodNonOptional`,(e,t)=>{Lo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function td(e,t){return new ed({type:`nonoptional`,innerType:e,...z(t)})}let nd=/*@__PURE__*/ V(`ZodCatch`,(e,t)=>{Bo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rd(e,t){return new nd({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:wr(t)})}let id=/*@__PURE__*/ V(`ZodPipe`,(e,t)=>{Vo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r),e.in=t.in,e.out=t.out});function ad(e,t){return new id({type:`pipe`,in:e,out:t})}let od=/*@__PURE__*/ V(`ZodReadonly`,(e,t)=>{Uo.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sd(e){return new od({type:`readonly`,innerType:e})}let cd=/*@__PURE__*/ V(`ZodLazy`,(e,t)=>{Go.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function ld(e){return new cd({type:`lazy`,getter:e})}let ud=/*@__PURE__*/ V(`ZodCustom`,(e,t)=>{Ko.init(e,t),Ul.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rl(e,t,n,r)});function dd(e,t){return/* @__PURE__ */ hc(ud,e??(()=>!0),t)}function fd(e,t={}){return/* @__PURE__ */ gc(ud,e,t)}function pd(e,t){return/* @__PURE__ */ _c(e,t)}function md(e){return/* @__PURE__ */ Rs(ql,e)}function hd(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let gd=ju([H(),U(),W(),Cu()]);function _d(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let vd=dd(_d,{message:`JSON value must not contain circular references`}),yd=ld(()=>ju([gd,G(yd),zu(H(),yd)])),bd=vd.pipe(yd);vd.pipe(G(yd));let xd=vd.pipe(zu(H(),yd)),Sd=q({code:H().min(1),message:H().min(1),retryable:W(),diagnostic:H().min(1).optional(),stage:H().min(1).optional(),durationMs:U().int().nonnegative().optional(),stderrTail:H().min(1).optional()}).superRefine(hd([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Cd=H().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),wd=e=>H().min(1).max(e).refine(e=>e.trim().length>0),Td=zu(Cd,K({label:wd(256).optional(),description:wd(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Ed=zu(Cd,wd(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Dd=H().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Od=Dd.brand(),kd=Dd.brand(),Ad=Dd.brand();Dd.brand(),Dd.brand();let jd=H().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Md=jd.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Nd=K({modes:G(K({id:Md,label:jd.max(256),description:jd.max(1024).optional(),dangerous:W().optional(),localizations:Td.optional()}).strict()).min(1).max(32),defaultModeId:Md}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});K({threadId:kd,permissionModeId:Md}).strict();let Pd=H().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});K({sourceThreadId:kd,lastTurnId:Ad.optional(),targetHarnessId:Od,targetModel:Pd.max(1024).optional(),targetThinkingOptionId:Pd.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let Fd=K({sourceThreadId:kd,sourceHarnessId:Od,sourceHarnessLabel:Pd.max(256).optional(),sourceModel:Pd.max(1024).optional(),targetHarnessId:Od,targetHarnessLabel:Pd.max(256).optional(),targetModel:Pd.max(1024).optional(),totalTurns:U().int().min(1),boundaryTurnNumber:U().int().min(1),includedTurnNumbers:G(U().int().min(1)),omittedTurns:U().int().min(0),preview:H().max(32e3),createdAtMs:U().int().nonnegative()}).strict();K({threadId:kd,handoff:Fd}).strict();let Id=U().int().safe().nonnegative(),Ld=U().finite().nonnegative(),Rd=U().finite().min(0).max(100),zd=K({version:ju([Y(3),Y(4)]).optional(),requestId:H().min(1),turnId:H().min(1).max(1024),outputTokens:Id,startedAtMs:Id,completedAtMs:Id}).strict().refine(e=>e.completedAtMs>e.startedAtMs),Bd=K({version:ju([Y(2),Y(3),Y(4)]).optional(),value:Ld,turnId:H().min(1).max(1024),at:Id}).strict();K({outputTimings:G(zd).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:Bd.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:Bd.extend({value:Id}).optional()}).strict();let Vd=e=>Ed.refine(t=>Object.values(t).every(t=>t.length<=e)),Hd=K({composerIndicators:G(K({kind:Y(`countdown`),id:H().min(1).max(64),expiresAtUnix:Id,label:Vd(256).optional(),tooltip:Vd(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:Id.optional(),cachedInputTokens:Id.optional(),cacheWriteInputTokens:Id.optional(),outputTokens:Id.optional(),outputTokensPerSecond:Ld.optional(),sessionOutputTokensPerSecond:Ld.optional(),apiOutputTokensPerSecond:Ld.optional(),reasoningOutputTokens:Id.optional(),totalTokens:Id.optional(),totalCostUsd:Ld.optional(),totalCredits:Ld.optional(),contextUsagePercent:Ld.optional(),cacheHitRatePercent:Rd.optional(),contextWindowTokens:Id.optional(),contextUsedTokens:Id.optional(),planFiveHourUsedPercent:Rd.optional(),planFiveHourResetsAtUnix:Id.optional(),planSevenDayUsedPercent:Rd.optional(),planSevenDayResetsAtUnix:Id.optional(),sessionCacheHitRatePercent:Rd.optional(),timeToFirstOutputMs:Id.optional(),latestRequestTimeToFirstOutputMs:Id.optional(),costSource:J([`publicPrice`,`native`]).optional(),unpricedModels:G(H().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),Ud=U().finite().min(0).max(100),Wd=J([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),Gd=K({id:H().min(1).max(256),label:H().min(1).max(256),localizations:Td.optional()}).strict(),Kd=K({product:H().min(1),periodType:Wd.optional(),scope:Gd.optional(),localizations:Td.optional(),used:U().finite().nonnegative().optional(),limit:U().finite().nonnegative().optional(),unit:H().min(1).max(32).optional(),usagePercent:Ud,resetsAt:H().min(1).optional()}).strict(),qd=K({availableCount:U().int().safe().positive(),nextExpiresAt:H().min(1).optional(),expiresAt:G(H().min(1)).min(1).max(32).optional()}).strict(),Jd=K({used:U().finite().nonnegative().optional(),limit:U().finite().nonnegative().optional(),unit:H().min(1).max(32).optional(),label:H().min(1).optional(),scope:Gd.optional(),localizations:Td.optional(),usedPercent:Ud,resetsAt:H().min(1).optional(),periodType:Wd,productUsage:G(Kd).min(1).optional(),resetCredits:qd.optional()}).strict(),Yd=K({amount:U().finite().nonnegative(),currency:H().trim().min(1).max(8),label:H().trim().min(1).max(128).optional()}).strict();K({threadId:kd,refresh:Y(`exact`).optional()}).strict(),K({threadId:kd,usage:Hd.nullable(),accountCredits:Jd.optional(),accountBalance:Yd.optional(),accountCreditsSupported:W().optional()}).strict();let Xd=H().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Zd=H().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),Qd=J([`priority`,`ultrafast`]),$d=K({id:Zd,serviceTier:Qd.optional()}).strict();function ef(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let tf=Xd.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),nf=Xd.max(256),rf=K({id:tf,label:Xd.max(256)}).strict(),af=K({ref:$d,label:Xd.max(256),resolvedModelLabel:nf.optional(),fastModel:$d.optional(),supportedThinkingOptionIds:G(tf).optional()}).strict().refine(e=>e.fastModel?.serviceTier===void 0||e.fastModel.id===e.ref.id,{path:[`fastModel`,`id`],message:`A tiered Fast Model must share the base Model ID`});function of(e,t){if(t)return e?.models.find(e=>ef(e.ref,t)||ef(e.fastModel,t))}let sf=G(rf).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),cf=J([`catalog`,`activeModel`]),lf=K({models:G(af),defaultModel:$d.optional(),thinkingOptions:sf,defaultThinkingOptionId:tf.optional(),thinkingOptionsScope:cf.optional()}).strict().superRefine((e,t)=>{let n=[],r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.some(e=>ef(e,a.ref))&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.push(a.ref),a.fastModel&&(n.some(e=>ef(e,a.fastModel))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.push(a.fastModel));let e=/* @__PURE__ */ new Set;for(let[n,o]of(a.supportedThinkingOptionIds??[]).entries())e.has(o)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,n]}),e.add(o),r.has(o)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,n]})}e.defaultModel&&!of(e,e.defaultModel)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),uf=K({fork:W(),forkAcrossCwd:W(),rollbackLastTurn:W()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),df=J([`live`,`atCreate`]),ff=K({configuration:K({selectModel:W(),selectThinkingOption:W(),selectPermissionMode:W(),permissionModeScope:df.default(`live`)}).strict(),history:uf,subagents:K({observe:W(),readTranscript:W()}).strict().optional(),autonomousTurns:K({observe:W()}).strict().optional(),steer:W().optional(),persistentPlan:W().optional()}).strict();K({effectiveModel:$d.optional(),resolvedModelLabel:nf.optional(),effectiveThinkingOptionId:tf.optional(),availableThinkingOptions:sf.optional(),effectivePermissionModeId:Md.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let pf=K({open:Y(!0)}).strict();ju([K({status:Y(`ready`),catalog:lf,permissionModes:Nd.optional(),capabilities:ff,webUi:pf.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),K({status:J([`notInstalled`,`unavailable`,`error`]),error:Sd}).strict()]),K({harnessId:Od,cwd:Xd.max(16384).optional(),refresh:W().optional(),purpose:Y(`availability`).optional(),credentialAccess:J([`allow`,`retry`]).optional()}).strict(),K({harnessId:Od}).strict(),K({}).strict(),K({threadId:kd,model:$d}).strict(),K({threadId:kd,thinkingOptionId:tf}).strict(),K({threadId:kd,includeReferenceCapability:W().optional()}).strict(),Nu(`owner`,[K({owner:Y(`codex`),locked:W(),effectiveModel:$d.optional(),resolvedModelLabel:nf.optional(),effectiveThinkingOptionId:tf.optional(),effectivePermissionModeId:Md.optional(),history:uf.optional(),supportsThreadReferences:Y(!0).optional(),handoff:Fd.optional()}).strict(),K({owner:Y(`external`),harnessId:Xd.max(256),transportModelId:Xd.max(8192),effectiveModel:$d.optional(),resolvedModelLabel:nf.optional(),effectiveThinkingOptionId:tf.optional(),availableThinkingOptions:sf.optional(),effectivePermissionModeId:Md.optional(),catalog:lf.optional(),history:uf,usage:Hd.optional(),handoff:Fd.optional(),locked:Y(!0)}).strict()]),K({threadIds:G(kd).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let mf=Nu(`owner`,[K({threadId:kd,owner:Y(`codex`)}).strict(),K({threadId:kd,owner:Y(`external`),harnessId:H().max(256).pipe(Od)}).strict()]);K({threads:G(mf).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),K({threadId:kd,text:H().optional()}).strict(),K({kind:Y(`application`),value:H().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),Er}}).pipe(K({expectedTurnId:Ad,clientUserMessageId:H().min(1),delivery:J([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),J([`activeTurn`,`newTurn`]),K({delivery:J([`official`,`activeTurn`,`newTurn`])}).strict();let hf=H().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),gf=hf.pipe(Od),_f=gf.refine(e=>e!==`codex`,`The official Codex identity is reserved`),vf=H().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),yf=nu().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),bf=K({en:H().max(4096),"zh-CN":H().max(4096).optional()}).strict(),xf=K({commands:G(K({terminal:H().max(256),command:H().max(4096)}).strict()).max(8),before:bf.optional(),after:bf.optional(),downloads:G(K({label:H().max(128),url:yf}).strict()).max(8).optional()}).strict(),Sf={id:gf,name:H().trim().min(1).max(128),version:H().min(1).max(128),kind:Y(`usage`).optional(),iconStyle:K({vector:K({viewBox:H().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:H().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:G(K({d:H().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:J([`evenodd`,`nonzero`]).optional(),fill:H().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:H().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:U().min(0).max(50).optional(),paddingRatio:U().min(0).max(.25).optional()}).strict().optional(),installation:xf.optional(),notice:bf.optional(),launchCommand:Y(!0).optional(),links:K({website:yf.optional(),documentation:yf.optional(),installation:yf.optional()}).strict().optional()};K({manifestVersion:Y(1),...Sf,adapterApiVersion:U().int().positive(),entry:vf,icon:vf.optional()}).strict();let Cf=H().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),wf=K({...Sf,icon:Cf.optional()}).strict();K({}).strict(),K({plugins:G(wf.extend({id:_f})).max(128)}).strict(),K({version:Y(1),enabled:G(gf).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let Tf=hf,Ef=J([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),Df=J([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),Of=H().trim().min(1).max(128);function kf(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`webp`:return`image/webp`;default:return}}let Af=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),jf=vf.refine(e=>kf(e)!==void 0&&Af(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),Mf=H().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(nu({protocol:/^https?$/u})).refine(e=>{let{username:t,password:n}=new URL(e);return!t&&!n&&!/[\\\s]/u.test(e)},`URL must not contain credentials, backslashes, or whitespace`);function Nf(e){return q({en:e,"zh-CN":e})}let Pf=Nf(H().trim().min(1)),Ff=G(Df).max(Df.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),If=G(Ef).max(Ef.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),Lf={key:H().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:Pf,description:Pf.optional()},Rf={...Lf,step:U().positive().optional(),default:U().optional()},zf=q({value:H(),label:Pf}),Bf=Nu(`type`,[q({...Lf,type:Y(`boolean`),default:W().optional()}),q({...Lf,type:Y(`string`),placeholder:Pf.optional(),default:H().optional()}),q({...Rf,type:Y(`number`),min:U().optional(),max:U().optional()}),q({...Rf,type:Y(`range`),min:U(),max:U()}),q({...Lf,type:Y(`select`),options:G(zf).min(1),default:H().optional()})]).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type===`number`||e.type===`range`){let{min:t=-1/0,max:r=1/0,default:i}=e;t>r&&n(`max`,`Must be at least min`),i!==void 0&&(i<t||i>r)&&n(`default`,`Must be within min and max`)}else if(e.type===`select`){let t=new Set(e.options.map(({value:e})=>e));t.size!==e.options.length&&n(`options`,`Duplicate option values`),e.default!==void 0&&!t.has(e.default)&&n(`default`,`Must match an option value`)}}),Vf=K({manifestVersion:bu().positive(),id:Tf,name:ju([Of,Nf(Of)]),version:H().min(1).max(128),desktopApi:bu().positive()}).passthrough().extend({manifestVersion:Y(1),desktopApi:Y(1),description:q({en:H().max(4096),"zh-CN":H().max(4096).optional()}).optional(),author:H().trim().min(1).max(128).optional(),repository:Mf.optional(),details:q({en:H().max(16384),"zh-CN":H().max(16384).optional()}).optional(),icon:jf.optional(),screenshots:G(jf).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:q({script:vf,style:vf.optional()}).optional(),backend:q({script:vf.refine(Af)}).optional(),slots:If.default(()=>[]),settingsSchema:G(Bf).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Ff.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),Hf=H().regex(/^[a-f0-9]{64}$/u),Uf=q({state:J([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:Hf.optional(),error:H().optional(),conflictWith:Tf.optional()});q({controllerPid:bu().positive(),targetId:H().nullable(),updatedAt:md(),handledReloadToken:eu().optional(),extensions:zu(H(),Uf),surfaces:zu(H(),Uf).optional()});let Wf=J([`official`,`community`]);function Gf(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let Kf=Mf.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||Gf(t)||t.origin===`https://github.com`&&/^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(t.pathname)||t.origin===`https://codeload.github.com`&&/^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(t.pathname)},`Expected a .zip download URL or a GitHub zipball URL`),qf=q({id:Tf,version:H().trim().min(1).max(128),name:Pf.extend({en:Of,"zh-CN":Of}),description:Nf(H().trim().min(1).max(4096)),details:Nf(H().trim().min(1).max(16384)).optional(),author:H().trim().min(1).max(128),repository:Mf,stars:U().int().min(0).optional(),downloads:U().int().min(0).optional(),categories:Ff.optional(),trustTier:Wf.default(`community`),icon:Mf.optional(),screenshots:G(Mf).max(4).optional(),downloadUrl:Kf,sha256:Hf,slots:If.optional(),publishedAt:H().optional(),updatedAt:H().optional(),minCodexHostVersion:H().optional()});q({schemaVersion:Y(1),generatedAt:H(),extensions:G(qf).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let Jf=H().trim().min(1).max(128),Yf=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,Xf=Tf.refine(e=>!Yf.test(e),`Reserved extension ID`),Zf=J([`desktop`,`web`]),Qf=Hf,$f=eu(),ep=vf.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!Yf.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),tp=Vf.shape,np=(e,t=0)=>q({en:H().trim().min(t).max(e),"zh-CN":H().trim().min(t).max(e)}),rp=e=>ep.refine(t=>t.endsWith(e),`Expected a ${e} file`),ip=rp(`.mjs`),ap=rp(`.css`).optional(),op=e=>e.normalize(`NFC`).toLowerCase(),sp=q({manifestVersion:Y(2),id:Xf,name:np(128,1),version:H().trim().min(1).max(128),description:np(4096),details:np(16384).optional(),author:tp.author,repository:tp.repository,icon:tp.icon.refine(e=>e===void 0||ep.safeParse(e).success),screenshots:tp.screenshots.refine(e=>e===void 0||e.every(e=>ep.safeParse(e).success)),categories:tp.categories,settingsSchema:tp.settingsSchema,slots:tp.slots.removeDefault().optional(),page:q({apiVersion:Y(1),entry:ip,style:ap,title:np(128,1).optional()}).optional(),widget:q({apiVersion:Y(1),entry:ip,style:ap}).optional(),desktop:q({apiVersion:Y(1),script:rp(`.js`),style:ap}).optional(),web:q({apiVersion:Y(1),entry:ip.optional(),style:ap}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:q({apiVersion:Y(1),entry:ip}).optional()}).refine(({page:e,widget:t,desktop:n,web:r,backend:i})=>!!(e||t||n||r||i),`Expected at least one page, widget, desktop, web, or backend entry`).refine(({page:e,widget:t,web:n,backend:r})=>!r||[e?.entry,t?.entry,n?.entry].every(e=>e===void 0||op(e)!==op(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function cp({hasPage:e,hasWidget:t,hasDesktop:n,hasWeb:r,hasBackend:i}){if(e||t||i&&!n&&!r)return[`desktop`,`web`];let a=[];return n&&a.push(`desktop`),r&&a.push(`web`),a}let lp=Jf,up=bu().nonnegative(),dp=q({revision:up,enabled:G(Xf).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)}),{downloadUrl:fp,...pp}=qf.shape,mp=K({...pp,id:Xf,format:Y(`codexhost`),targets:G(Zf).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:q({page:bu().positive().optional(),widget:bu().positive().optional(),desktop:bu().positive().optional(),web:bu().positive().optional(),backend:bu().positive().optional()}),downloadUrl:fp.refine(e=>e.startsWith(`https://`),`Expected HTTPS`)}).refine(({targets:e,apis:t})=>{let n=cp({hasPage:!!t.page,hasWidget:!!t.widget,hasDesktop:!!t.desktop,hasWeb:!!t.web,hasBackend:!!t.backend});return e.length===n.length&&n.every(t=>e.includes(t))},`Catalog targets must match the declared APIs`);K({schemaVersion:Y(2),generatedAt:H().min(1),extensions:G(mp).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:Mf,fetchedAt:md(),cached:W()});let hp={id:Xf},gp={...hp,activationId:$f,digest:Qf},_p={...hp,activationId:gp.activationId.optional()},vp=H().min(1).max(4096).refine(e=>/^(?:\/|[a-z]:[/\\])/iu.test(e)&&!e.includes(`\0`)&&!e.split(/[/\\]/u).some(e=>e===`.`||e===`..`),`Expected an absolute local path without dot segments`),yp=H().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function bp(e){return H().max(4*Math.ceil(e/3)).refine(t=>{let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return t.length%4==0&&t.length*3/4-n<=e&&/^[A-Za-z0-9+/]*={0,2}$/u.test(t)},`Expected bounded standard padded base64`)}let xp=q({type:Y(`github`),repository:H().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:yp.optional(),tag:yp.optional(),asset:H().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:ep.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),Sp=ju([q({type:Y(`catalog`),...hp}),xp,q({type:Y(`zip`),base64:bp(67108864).min(4)}),q({type:Y(`zip`),localZipPath:vp}),q({type:Y(`localDir`),localDir:vp})]),Cp=Nu(`type`,[q({type:Y(`catalog`),...hp}),xp,q({type:Y(`zip`)}),q({type:Y(`localDir`)})]),wp=q({...gp,manifest:sp,installedAt:md(),source:Cp.optional()}),Tp=e=>H().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),Ep={desktopConflictWith:Xf.optional()},Dp=J([`none`,`inactive`,`starting`,`running`,`failed`]),Op=Nu(`state`,[wp.extend({state:Y(`valid`),enabled:W(),...Ep,iconDataUrl:Tp(131072).optional(),screenshotDataUrls:G(Tp(524288)).max(4).optional(),backendState:Dp.optional(),backendError:H().optional()}),q({state:J([`invalid`,`incompatible`]),id:H().min(1),enabled:W(),error:H()})]);q({revision:up,configuration:dp,diagnostics:G(H()),extensions:G(Op)}),q({revision:up,extensions:G(wp.extend({...Ep,settingsRevision:up})).max(64)});let kp={list:`codexhost/extensions/list`,snapshot:`codexhost/extensions/snapshot`,catalog:`codexhost/extensions/catalog`,install:`codexhost/extensions/install`,update:`codexhost/extensions/update`,enable:`codexhost/extensions/enable`,disable:`codexhost/extensions/disable`,uninstall:`codexhost/extensions/uninstall`,recover:`codexhost/extensions/recover`,asset:`codexhost/extensions/asset`,settingsGet:`codexhost/extensions/settings/get`,settingsSet:`codexhost/extensions/settings/set`,backendInvoke:`codexhost/extensions/backend/invoke`},Ap=Object.freeze(Object.values(kp));new Set(Ap),q({});let jp={expectedRevision:up};q({...hp,...jp}),wp.extend({replaced:W()}),Nu(`state`,[q({state:Y(`saved`),configuration:dp}),q({state:Y(`revision-conflict`),revision:up})]),q({..._p,digest:gp.digest.optional(),path:ep}),q({mimeType:H().min(1),base64:bp(16777216),digest:gp.digest}),q({settingsRevision:up,values:xd}),kp.list,kp.snapshot,kp.catalog,q({forceRefresh:W().optional()}),kp.install,q({source:Sp}),kp.update,q({...hp,expectedDigest:gp.digest,expectedActivationId:gp.activationId.optional(),source:Sp.optional()}),kp.enable,kp.disable,kp.uninstall,q({...hp,removeData:W().optional(),expectedDigest:gp.digest.optional()}),q({...hp,removed:W()}),kp.recover,q({expectedRevision:jp.expectedRevision.optional()}),kp.asset,kp.settingsGet,q(_p),kp.settingsSet,q({..._p,expectedSettingsRevision:up,values:xd}),kp.backendInvoke,q({..._p,method:lp,params:bd.optional()}),q({result:bd}),K({threadId:kd}).strict(),K({confirmed:W()}).strict(),[...Ap],K({sections:G(K({id:H().min(1),name:H().min(1),threads:G(xd)}).strict())}).strict(),K({threadId:H().min(1).max(1024),sectionId:H().min(1).max(1024).nullable()}).strict(),K({threadIds:G(H().min(1))}).strict(),K({threadId:H().min(1).max(1024),pinned:W()}).strict(),K({}).strict(),K({parents:zu(H().min(1),H().min(1))}).strict(),K({prompt:H().max(16384).optional()}).strict(),K({projects:G(K({id:H(),name:H(),rootPaths:G(H()),createdAt:U().int().optional()})),nativeProjects:Y(!0).optional(),assignments:zu(H(),H()),projectless:G(H()),pinned:G(H()),sectionProjects:zu(H(),G(H())).optional()});let Mp=zu(H(),Tu()),Np=K({epoch:H().uuid(),sequence:U().int().nonnegative()});Nu(`type`,[K({type:Y(`projects-changed`),cursor:Np}),K({type:Y(`skills-changed`),cursor:Np,cwd:H().optional()}),K({type:Y(`harness-inspection-changed`),cursor:Np,harnessId:H().min(1)}),K({type:Y(`display-settings-changed`),cursor:Np}),K({type:Y(`preferences-changed`),cursor:Np,revision:U().int().nonnegative()}),K({type:Y(`extensions-changed`),cursor:Np,revision:up}),K({type:Y(`hello`),version:Y(1),cursor:Np,reset:W()}),K({type:Y(`changed`),cursor:Np,threadId:H().min(1),method:H().min(1)})]);let Pp=Nu(`type`,[K({type:Y(`text`),id:H(),prompt:H(),secret:W().optional(),optional:W().optional()}),K({type:Y(`choice`),id:H(),prompt:H(),multiple:W(),allowOther:W(),optional:W().optional(),options:G(K({value:H(),label:H(),description:H().optional()}))})]),Fp=Nu(`type`,[K({type:Y(`approval`),title:H(),description:H().optional(),subject:Tu().optional(),actions:G(K({id:H(),label:H(),effect:H()}))}),K({type:Y(`question`),title:H().optional(),questions:G(Pp)})]),Ip=K({requestId:ju([H(),U().int()]),threadId:H(),kind:J([`approval`,`question`]),interaction:Fp,request:Mp}),Lp=K({id:H().min(1),clientUserMessageId:H().min(1),input:G(Mp),presentationInput:G(Mp).nullable().optional()}).passthrough();K({fields:G(K({path:G(ju([H(),U().int().nonnegative()])),originalLength:U().int().nonnegative()}))});let Rp=K({id:H().min(1),status:H().min(1),codexhostTurnOutcome:K({status:Y(`unknown`),reason:H()}).optional(),items:G(K({id:H().min(1),type:H().min(1)}).passthrough()),codexhostFileOperations:G(K({beforeItemId:H().nullable(),item:K({id:H().min(1),type:H().min(1)}).passthrough()})).optional(),error:K({message:H().optional()}).passthrough().nullable().optional(),fingerprint:H().min(1).optional(),unchanged:Y(!0).optional()}).passthrough(),zp=K({id:H().min(1).max(512),fingerprint:H().min(1).max(128)});K({threadId:H().min(1),knownTurns:G(zp).max(64).optional(),truncateToolOutput:W().optional()});let Bp=K({harnessId:H().min(1),nativeSessionId:H().min(1)});K({cursor:Np,activeTurnId:H().min(1).nullable().optional(),command:K({name:H().min(1),turn:Rp,subsequentTurnId:H().min(1).optional()}).optional(),thread:K({id:H().min(1),cwd:H(),modelProvider:H().min(1),createdAt:U(),updatedAt:U(),status:K({type:H()}).passthrough(),name:H().nullable().optional(),preview:H().optional(),codexhostImportSource:Bp.optional(),turns:G(Rp).length(0)}).passthrough(),turnsPage:K({data:G(Rp).max(5),nextCursor:H().nullable()}),configuration:K({native:K({model:H().min(1).max(1024).optional(),reasoningEffort:H().min(1).max(128).optional()}).optional(),effectiveModel:$d.optional(),effectiveThinkingOptionId:tf.optional(),effectivePermissionModeId:Md.optional()}),queue:K({items:G(Lp),pausedReason:J([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:G(Ip),handoff:Fd.optional()}),K({version:Y(1),owner:Y(`service`).optional(),pid:U().int().positive(),port:U().int().min(1).max(65535),token:H().regex(/^[0-9a-f]{64}$/u),startedAt:U(),epoch:H().uuid(),capabilities:K({peerDelegation:Y(1).optional()}).optional()}),K({epoch:H().uuid(),threadId:H().min(1),requestId:ju([H(),U().int()]),result:Mp}),K({includeArchived:W().optional(),officialCursor:K({live:H().nullable(),archived:H().nullable().optional()}).strict().optional(),scope:ju([K({cwd:H().min(1).max(4096),excludeCwds:G(H().min(1).max(4096)).max(1024)}).strict(),K({projectId:H().min(1).max(1024),legacyThreadIds:G(H().min(1).max(1024)).max(1024),rootPaths:G(H().min(1).max(4096)).max(1024).optional()}).strict()]).optional()}).strict(),K({threads:G(xd),ownership:G(mf),archivedThreadIds:G(kd),officialCursor:K({live:H().nullable(),archived:H().nullable().optional()}).strict().optional()}).strict();let Vp=J([`running`,`waiting`,`idle`,`unknown`]),Hp=q({harnessId:Od,title:H().optional(),status:Vp,archived:W()}),Up=q({revision:bu().nonnegative(),parents:zu(kd,kd),nodes:zu(kd,Hp),truncated:W()}).refine(e=>Object.keys(e.nodes).length<=5e3,`Too many Thread tree nodes`).refine(({parents:e,nodes:t})=>Object.entries(e).every(([e,n])=>Object.hasOwn(t,e)&&Object.hasOwn(t,n)),`Missing Thread tree node`),Wp=H().min(1).max(128);q({});let Gp=q({subscriptionId:Wp});q({}),Gp.extend({snapshot:Up});let Kp=H().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);K({available:W()}).strict(),K({path:H().min(1),mimeType:Kp}).strict();let qp=J([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);Nu(`ok`,[K({ok:Y(!0),text:H()}).strict(),K({ok:Y(!1),error:K({code:qp}).strict()}).strict()]),K({threadId:kd.optional(),cwd:H().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Jp=K({name:H().min(1).regex(/^[^\s[\]]+$/u),description:H().optional(),path:H().min(1),scope:J([`project`,`global`]),source:H().min(1)}).strict();K({revision:U().int().nonnegative(),complete:W(),skills:G(Jp),warnings:G(H()).optional()}).strict(),K({cwd:H().min(1).optional()}).strict();let Yp=K({kind:J([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:H().min(1)}).strict(),Xp=Nu(`status`,[K({status:Y(`not-installed`)}),K({status:Y(`not-running`)}),K({status:Y(`not-logged-in`)}),K({status:Y(`https-disabled`)}),K({status:Y(`not-serving`),command:H()}),K({status:Y(`occupied`),target:H()}),K({status:Y(`serving`),url:H(),funnel:W()}),K({status:Y(`error`),message:H()})]);K({state:Xp,error:H().optional()}).strict();let Zp=Nu(`status`,[K({status:Y(`on`)}),K({status:Y(`off`)}),K({status:Y(`invalid`),reason:H()})]),Qp=K({lan:W(),autostart:Zp}).strict(),$p=K({expiresAt:H().optional(),issuing:W(),failure:K({detail:H().optional(),retryAt:H(),paused:W()}).optional()}),em=Nu(`status`,[K({status:Y(`off`),reason:J([`invite`,`name-taken`,`banned`]).optional()}),K({status:Y(`connecting`),reason:J([`full`,`unreachable`]).optional()}),K({status:Y(`connected`),url:H(),certificate:$p}),K({status:Y(`missing-certificate`),url:H(),certificate:$p}),K({status:Y(`stopped`),reason:J([`replaced`,`rejected`,`unsupported-version`])})]);H().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),H().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let tm=J([`official`,`self-hosted`]);K({secret:H().min(1),lastUsedAt:U().nullable(),networkUrls:G(Yp),directCandidates:G(Yp).optional(),tailscale:Xp,background:Qp.optional(),relay:K({state:em,enabled:W(),kind:tm,officialHost:H(),customHost:H().optional(),officialHostname:H().optional(),customHostname:H().optional(),quotaUntil:H().optional()}).strict().optional()}).strict();let nm=q({threadId:H().min(1).max(1024),view:J([`result`,`messages`]),from:U().int().min(1).max(2**53-1).optional(),to:U().int().min(1).max(2**53-1).optional()}),rm=/^[a-zA-Z0-9_-]{1,64}$/u,im=H().regex(rm),am=H().regex(rm),om=H().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),sm=J([`relay`,`tailscale`,`lan`,`custom`]),cm=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],lm=J(cm),um=new Set(cm);function dm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return cm[(t>>>0)%cm.length]??cm[0]}function fm(e,t){return typeof t==`string`&&um.has(t)?t:dm(e)}let pm=J([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]);K({peers:G(K({peerId:im,hostId:om,nodeId:am.optional(),name:H().min(1).max(120),color:lm.optional(),origin:H().min(1).max(2048),transportKind:sm,encrypted:W(),enabled:W(),state:pm,supportsPeerPairing:W().optional(),pairedBack:W().optional(),linkedPeerIds:G(im).max(128).optional(),latencyMs:U().int().nonnegative().optional(),version:H().max(128).optional(),platform:H().max(64).optional(),hostname:H().max(255).optional(),homeDir:H().max(4096).optional(),lastError:H().max(1e3).optional(),projectCount:U().int().nonnegative(),createdAt:H(),updatedAt:H()}))}),K({connectionUrl:H().min(1).max(4096).optional(),origin:H().min(1).max(2048).optional(),token:H().min(1).max(2048).optional(),name:H().trim().min(1).max(120).optional(),color:lm.optional(),pairBack:W().optional(),meshPeerIds:G(im).max(64).optional(),selfOrigin:H().min(1).max(2048).optional()}).refine(e=>!!e.connectionUrl||!!e.origin&&!!e.token,`Provide either connectionUrl or both origin and token`),q({origin:H().min(1).max(2048),token:H().min(1).max(2048),name:H().trim().min(1).max(120).optional(),color:lm.optional(),expectedNodeId:am.optional()}),K({status:J([`added`,`updated`,`existing`]),peerId:im,hostId:om,nodeId:am.optional()});let mm=J([`added`,`updated`,`existing`,`failed`,`skipped`]);K({results:G(K({targetPeerId:im,targetName:H().min(1).max(120),introducedHost:ju([Y(`local`),im]),introducedName:H().min(1).max(120),status:mm,error:H().max(1e3).optional()}))}),K({peerIds:G(im).max(64).optional(),includeSelf:W().optional(),includeMesh:W().optional(),selfOrigin:H().min(1).max(2048).optional()}),K({peerId:im,name:H().trim().min(1).max(120).optional(),color:lm.nullable().optional(),connectionUrl:H().min(1).max(4096).optional(),origin:H().min(1).max(2048).optional(),token:H().min(1).max(2048).optional(),enabled:W().optional()}),K({peerId:im}),K({removed:W()}),K({peerId:im.optional(),connectionUrl:H().min(1).max(4096).optional(),origin:H().min(1).max(2048).optional(),token:H().min(1).max(2048).optional()}).refine(e=>!!e.peerId||!!e.connectionUrl||!!e.origin&&!!e.token,`Provide peerId, connectionUrl, or both origin and token`);let hm=K({id:H().min(1).max(1024),name:H().min(1).max(512),path:H().min(1).max(8192)});K({ok:W(),nodeId:am.optional(),supportsPeerPairing:W().optional(),pairedBack:W().optional(),latencyMs:U().int().nonnegative().optional(),origin:H().max(2048).optional(),transportKind:sm.optional(),encrypted:W().optional(),version:H().max(128).optional(),platform:H().max(64).optional(),hostname:H().max(255).optional(),homeDir:H().max(4096).optional(),projectCount:U().int().nonnegative().optional(),projects:G(hm).optional(),error:H().max(1e3).optional()});let gm=K({id:H().min(1).max(1024),name:H().min(1).max(512),path:H().min(1).max(8192),threadIds:G(H().min(1).max(1024))}),_m=K({attachments:Y(1).optional(),workspaceFiles:Y(1).optional(),officePreview:Y(1).optional(),delegation:Y(1).optional(),peerPairing:Y(1).optional()}),vm=K({version:H().max(128),platform:H().max(64),hostname:H().max(255),homeDir:H().max(4096).optional(),epoch:H().min(1).max(256),nodeId:am.optional(),peerNodes:zu(om,am).refine(e=>Object.keys(e).length<=128).optional(),projects:G(gm),capabilities:_m.optional()});q({threadId:H().min(1).max(1024),scope:H().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u).optional(),requestId:H().min(1).max(256).optional(),mode:J([`queue`,`steer`]).optional(),expectedTurnId:H().min(1).max(1024).nullable().optional(),content:G(Nu(`type`,[q({type:Y(`text`),text:H()}),q({type:Y(`file`),receiptId:H().min(1).max(128)})])).min(1).max(64)});let ym=K({ok:Y(!1),error:K({code:H(),message:H(),details:zu(H(),Tu()).optional()})});ju([K({ok:Y(!0),value:K({receiptId:H().min(1),file:K({attachmentId:H(),name:H(),bytes:U().int().nonnegative()})})}),ym]),ju([K({ok:Y(!0),value:K({accepted:Y(!0)})}),ym]);let bm=K({name:H().min(1).max(512),path:H().min(1).max(8192),kind:Y(`directory`)});K({peerId:im,path:H().min(1).max(8192).optional()}),K({path:H().min(1).max(8192),parentPath:H().min(1).max(8192).nullable(),homeDir:H().min(1).max(8192).optional(),entries:G(bm)}),K({peerId:im,parentPath:H().min(1).max(8192),name:H().min(1).max(255).refine(e=>e.trim().length>0,`Directory name cannot be blank`)}),K({path:H().min(1).max(8192),name:H().min(1).max(255)}),K({peerId:im,path:H().min(1).max(8192),title:H().trim().min(1).max(255).optional()}),K({peerId:im,workspaceId:H().min(1).max(1024),title:H().trim().min(1).max(255)}),K({peerId:im,workspaceId:H().min(1).max(1024)}),K({workspaceId:H().min(1).max(1024).optional(),manifest:vm}),K({sessionHostId:H().min(1).max(128).optional()}),K({hosts:G(K({hostId:ju([Y(`local`),om]),name:H().min(1).max(120),isLocal:W().optional(),color:lm.optional(),hostname:H().max(255).optional()}))}),K({hostId:ju([Y(`local`),om])}),K({harnesses:G(K({id:H().regex(/^[a-z0-9][a-z0-9-]*$/u),name:H().min(1).max(120)}))});let xm=J([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);q({operation:xm,hopCount:U().int().min(0).max(16),sourceId:im.optional(),input:xd});let Sm=q({code:H().min(1).max(128),message:H().max(4096),details:xd.optional()});ju([q({ok:Y(!0),value:bd}),q({ok:Y(!1),error:Sm})]);let Cm=q({id:H().min(1).max(1024),name:H().min(1).max(512),path:H().min(1).max(8192)});q({hosts:G(q({hostId:om,nodeId:am.optional(),displayName:H().min(1).max(120),online:W(),state:pm,delegation:W(),projects:G(Cm),platform:H().max(64).optional(),hostname:H().max(255).optional(),homeDir:H().max(4096).optional()}))}),q({version:Y(1),instanceId:H().min(1).max(128),pid:U().int().positive(),endpoint:H().min(1).max(256),token:H().regex(/^[0-9a-f]{64}$/u),startedAt:U().int().nonnegative()}),ju([q({operation:Y(`hosts`)}),q({operation:xm,hostId:om,hopCount:U().int().min(0).max(16),timeoutMs:U().int().min(1).max(12e4).optional(),input:xd})]);let wm=K({id:H().min(1).max(256),harnessId:H().min(1),label:H().min(1).max(512),provider:J([`openai-codex`,`xai`])}).strict(),Tm=H().regex(/^[a-z][a-z0-9-]{0,47}$/),Em=K({name:Tm,source:wm,importedAt:H()}).strict(),Dm=Nu(`action`,[K({action:Y(`list`)}).strict(),K({action:Y(`import`),sourceId:H().min(1).max(256),name:Tm,confirmed:Y(!0)}).strict(),K({action:Y(`reimport`),sourceId:H().min(1).max(256),name:Tm,confirmed:Y(!0)}).strict(),K({action:Y(`remove`),name:Tm,confirmed:Y(!0)}).strict()]),Om=K({provider:H().min(1).max(128),type:J([`oauth`,`api_key`,`unknown`]),label:H().min(1).max(512).optional(),vendor:J([`openai-codex`,`xai`]).optional()}).strict();K({sources:G(wm),targets:G(K({harnessId:H(),providers:G(J([`openai-codex`,`xai`])),imports:G(Em),others:G(Om).default([])}).strict())}).strict(),K({targetHarnessId:H().min(1).max(128).optional(),request:Dm}).strict(),K({events:W()});let km=G(q({agent:H().min(1).max(128),section:J([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);q({entries:km.nullable()}),q({}),q({entries:km,initializeOnly:W().optional()});let Am=q({enabled:W(),timeoutMinutes:U().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let jm=H().regex(/^external$/u),Mm=Od.transform(e=>String(e)),Nm=q({model:$d.optional(),thinkingOptionId:tf.optional(),permissionModeId:Md.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),Pm=q({lastHarness:Od.optional(),byHarness:zu(Mm,Nm)}),Fm=q({model:$d.optional(),thinkingOptionId:tf.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),Im=q({byHarness:zu(Mm,Fm)}),Lm=H().min(1).max(1024),Rm=q({idleRelease:Am.optional(),favorites:zu(Mm,G(Lm).max(2048)).default({}),newThread:Pm.optional(),delegation:Im.optional()});q({scope:jm,revision:U().int().nonnegative(),values:Rm}),q({scope:jm.default(`external`)});let zm=Nu(`kind`,[q({kind:Y(`idleRelease`),value:Am}),q({kind:Y(`favorite`),harnessId:Od,modelId:Lm,enabled:W()}),q({kind:Y(`favorites`),harnessId:Od,modelIds:G(Lm).max(2048)}),q({kind:Y(`newThread`),lastHarness:Od.optional(),harnessId:Od.optional(),configuration:Nm.optional()}),q({kind:Y(`delegation`),harnessId:Od,configuration:Fm.nullable()})]);q({scope:jm.default(`external`),operations:G(zm).min(1).max(256),initializeOnly:W().optional(),expectedRevision:U().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),q({version:Y(1),revision:U().int().nonnegative(),scopes:zu(jm,Rm)});let Bm=U().finite().nonnegative(),Vm=q({input:Bm,output:Bm,cacheRead:Bm.optional(),cacheWrite:Bm.optional(),cacheWrite1h:Bm.optional()}),Hm=H().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);q({path:H(),entries:G(q({key:H(),price:Vm})),error:H().nullable()}),q({}),q({key:Hm,price:Vm.nullable(),previousKey:Hm.optional()}),q({model:Hm});let Um=q({official:W().optional(),canonicalModelId:H().min(1).optional(),provider:H().min(1).max(512),model:H().min(1).max(512),price:Vm});q({price:Vm.nullable(),suggestions:G(Um).max(6).optional()});let Wm=[`today`,`7d`,`30d`,`90d`,`all`],Gm=U().int().min(0).max(2**53-1),Km=H().regex(/^\d{4}-\d{2}-\d{2}$/u),qm=H().min(1).max(128),Jm=H().min(1).max(512),Ym=H().min(1).max(4096);q({range:J(Wm),timeZone:H().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:qm.optional(),model:Jm.nullable().optional(),project:Ym.nullable().optional(),date:Km.optional()});let Xm=q({requests:Gm,inputTokens:Gm,cachedInputTokens:Gm,cacheWriteInputTokens:Gm,cacheKnownInputTokens:Gm,cacheHitCachedInputTokens:Gm,cacheHitInputTokens:Gm,outputTokens:Gm,reasoningOutputTokens:Gm,costUsd:U().finite().min(0),unpricedRequests:Gm,unmeteredRequests:Gm}),Zm=Xm.shape,Qm=q({harness:qm,sessionId:H().min(1).max(512),project:Ym.nullable(),title:H().min(1).max(200).optional(),models:G(Jm).max(16),firstAtMs:Gm,lastAtMs:Gm,...Zm});q({range:J(Wm),from:Km.nullable(),to:Km,filters:q({harness:qm.nullable(),model:Jm.nullable(),unknownModel:W(),project:Ym.nullable(),unknownProject:W(),date:Km.nullable()}),reading:q({complete:W(),sources:Gm,read:Gm}),failures:G(q({harness:qm,message:H().max(2048)})).max(256),options:q({harnesses:G(qm).max(256),models:G(Jm.nullable()).max(4096),projects:G(Ym.nullable()).max(4096)}),modelLabels:G(q({harness:qm,model:Jm,label:Jm})).max(4096).optional(),credits:G(q({harness:qm,model:Jm.nullable(),credits:U().finite().min(0),reportedRequests:Gm,requests:Gm})).max(4096).optional(),totals:Xm,daily:G(q({date:Km,harness:qm,...Zm})).max(2e5),hourly:G(q({weekday:U().int().min(0).max(6),hour:U().int().min(0).max(23),...Zm})).max(168),byHarness:G(q({harness:qm,...Zm})).max(256),byModel:G(q({model:Jm.nullable(),...Zm,harnessPricedRequests:Gm})).max(4096),byProject:G(q({project:Ym.nullable(),...Zm})).max(4096),sessions:G(Qm).max(100),recentSessions:G(Qm).max(100).optional()}),K({threadId:kd}),K({discarded:W()});let $m=Nu(`type`,[K({id:H().min(1),type:Y(`choice`),prompt:H(),options:G(K({value:H().min(1),label:H(),description:H().optional()})).min(1),multiple:W(),allowOther:W(),optional:W()}),K({id:H().min(1),type:Y(`text`),prompt:H(),multiline:W(),secret:Y(!1),optional:W(),placeholder:H().optional(),prefill:H().optional()})]),eh=K({interactionId:H().min(1),turnId:H().min(1),title:H().optional(),questions:G($m).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});q({threadId:H().min(1)}),K({questions:G(eh)}),q({threadId:H().min(1),turnId:H().min(1),interactionId:H().min(1),answers:zu(H(),G(H())),cancelled:W().default(!1)}),K({accepted:Y(!0)});let th=K({path:H(),oldText:H().nullable(),newText:H()});K({sessionId:H().min(1),turn:U().int().nonnegative(),path:H().min(1).optional()}),K({diffs:G(th)}),q({}),q({}),K({reference:K({sessionId:H().min(1),epoch:H().min(1),turn:U().int().nonnegative(),seq:U().int().nonnegative(),callId:H().min(1),part:U().int().nonnegative(),version:H().min(1)}),length:U().int().nonnegative(),bytes:U().int().nonnegative()}),q({title:H().trim().min(1).max(200),type:J([`info`,`warning`,`danger`]),body:H().trim().min(1).max(16384)}),q({}),q({url:H().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status`.split(`.`));let nh=J([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),rh=J([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);q({threadId:H(),title:H(),harnessId:H(),state:nh,reason:rh,inactiveMs:U().nonnegative()}),q({threadId:kd,turnId:Ad});let ih=K({email:H().trim().min(1).max(320).optional(),label:H().trim().min(1).max(256).optional(),plan:H().trim().min(1).max(128).optional(),credits:Jd.optional(),balance:Yd.optional()}).strict();function ah(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let oh=ah(ih),sh={harnessId:Od,harnessName:H().trim().min(1).max(128)},ch=K(sh).strict();K({}).strict(),K({sources:G(ch).max(128)}).strict(),K({harnessId:Od,refresh:W().optional()}).strict(),K({...sh,account:oh.nullable(),accounts:G(oh).max(8).optional()}).strict(),K({refresh:W().optional()}).strict(),K({accounts:G(ah(ih.extend(sh))).max(128)}).strict(),K({harnessId:_f,model:$d.optional(),thinkingOptionId:tf.optional(),permissionModeId:Md.optional(),prewarm:Y(!0).optional()}).strict();let lh=H().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);K({harnessId:_f}).strict().extend({path:lh.nullable()}),K({path:lh.nullable(),restartRequired:W()}).strict(),K({harnessId:Od,action:J([`check`,`update`,`install`]),confirmedVersion:H().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let uh=K({currentVersion:H().min(1).max(128),latestVersion:H().min(1).max(128),updateAvailable:W(),canUpdate:W(),latestVerifiedVersion:H().min(1).max(128).optional(),confirmationRequired:Y(!0).optional(),versionKind:J([`cli`,`application`]).optional(),manualUpdateUrl:nu().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:H().max(2048).optional(),messageCode:H().min(1).max(128).optional(),notice:Ed.optional(),latestVersionKind:J([`unknown`,`tracking-branch`]).optional()}).strict();K({taskId:H().uuid()}).strict(),Nu(`status`,[K({taskId:H().uuid(),status:Y(`running`)}).strict(),K({taskId:H().uuid(),status:Y(`succeeded`),result:uh}).strict(),K({taskId:H().uuid(),status:Y(`failed`),error:K({code:U().int(),message:H().min(1).max(2048)}).strict()}).strict()]);let dh=H().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),fh=H().trim().min(1),ph=J([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),mh=K({accountId:dh,label:fh.max(256),email:H().email().max(320).optional(),planType:ph.optional()}).strict(),hh=J([`ready`,`unavailable`]);K({version:Y(2),currentAccountId:dh.nullable(),phase:hh,revision:U().int().nonnegative(),instanceId:fh.max(1024).optional(),accounts:G(mh).max(1)}).strict(),K({accountId:dh,refresh:W().optional()}).strict(),K({accountId:dh,usage:Hd.nullable(),accountCredits:Jd.optional(),freshness:J([`live`,`cached`]),observedAt:H().datetime().nullable()}).strict();let gh=1e3,_h=H().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),vh=_h.max(1024),yh=K({nativeSessionId:vh,title:_h.max(4096).nullable(),updatedAt:U().int().nonnegative().max(864e13),cwd:_h.max(16384),running:W().nullable()}).strict();K({}).strict(),K({harnesses:G(K({harnessId:_f,name:_h.max(128)}).strict()).max(128)}).strict(),K({harnessId:_f,query:H().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:U().int().nonnegative().safe().optional(),limit:U().int().min(1).max(gh).optional()}).strict(),K({candidates:G(yh).max(gh),total:U().int().nonnegative().safe()}).strict(),K({harnessId:_f,nativeSessionId:vh}).strict(),K({threadId:_h.max(1024).pipe(kd)}).strict();let bh=H().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),xh=vh,Sh=yh;K({}).strict(),K({candidates:G(Sh).max(1e3)}).strict(),K({nativeSessionId:xh}).strict(),K({threadId:bh.max(1024).pipe(kd)}).strict(),K({threadId:kd,lastTurnId:Ad}).strict(),K({threadId:kd}).strict();let Ch=H().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();K({commands:G(K({id:Ch,invocation:H().min(1).max(128),label:H().trim().min(1).max(128),description:H().trim().min(1).max(512).optional(),localizations:Td.optional(),argumentMode:J([`none`,`text`]),kind:J([`command`,`skill`]).optional()}).strict()),warnings:G(H().min(1)).optional(),source:J([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),K({harnessId:Od,cwd:H().min(1).optional()}).strict(),K({threadId:kd}).strict(),K({threadId:kd,commandId:Ch,turnId:Ad.optional(),arguments:xd.optional()}).strict(),K({accepted:Y(!0),turnId:Ad.optional()}).strict();let wh=Y(`2.0`).optional(),Th=Du().optional(),Eh=H().min(1),Dh=ju([H(),U().int()]),Oh=K({code:U().int(),message:H(),data:bd.optional()}).catchall(bd).superRefine(hd([`data`]));ju([K({jsonrpc:wh,id:Dh,method:Eh,params:bd.optional(),result:Th,error:Th}).catchall(bd).superRefine(hd([`jsonrpc`,`params`,`result`,`error`])),K({jsonrpc:wh,id:Th,method:Eh,params:bd.optional(),result:Th,error:Th}).catchall(bd).superRefine(hd([`jsonrpc`,`id`,`params`,`result`,`error`])),K({jsonrpc:wh,id:Dh,method:Th,params:Th,result:bd,error:Th}).catchall(bd).superRefine(hd([`jsonrpc`,`method`,`params`,`error`])),K({jsonrpc:wh,id:Dh,method:Th,params:Th,result:Th,error:Oh}).catchall(bd).superRefine(hd([`jsonrpc`,`method`,`params`,`result`]))]);let kh=H().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});q({harnessId:Od,nativeSessionId:kh,locator:bd.optional(),formatVersion:Y(1)}).superRefine(hd([`locator`])),q({harnessId:Od,nativeSessionId:kh,nativeTurnKey:kh,formatVersion:Y(1)}),q({harnessId:Od,nativeSessionId:kh,checkpointId:kh,locator:bd.optional(),formatVersion:Y(1)}).superRefine(hd([`locator`]));let Ah=H().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),jh=J([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),Mh=J([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),Nh=q({completed:U().int().nonnegative(),total:U().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),Ph=q({version:Ah,installation:jh,phase:Mh,updatedAt:U().int().nonnegative(),downloadedBytes:U().int().nonnegative().optional(),totalBytes:U().int().positive().optional(),npmDownload:Nh.optional(),error:H().min(1).max(500).nullable(),serviceStopOutput:H().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});q({});let Fh=H().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`);q({currentVersion:Ah,installation:jh.nullable(),latestVersion:Ah.nullable(),updateAvailable:W(),installationAvailable:W(),releaseNotes:H().min(1).max(2e4).nullable(),releaseNotesUrl:Fh.nullable(),status:Ph.nullable(),error:H().min(1).max(500).nullable()}),q({status:Ph}),q({status:Ph.nullable()});let Ih=q({icon:H().min(1).max(16).optional(),title:H().min(1).max(120),body:H().min(1).max(1200),contributors:G(H().min(1).max(39)).max(30)}),Lh=q({summary:H().min(1).max(600).optional(),themes:G(Ih).min(1).max(12)}),Rh=q({version:Ah,publishedAt:md(),url:H().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:Lh.nullable(),en:Lh.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});q({manual:W().optional()}),q({announcement:Rh.nullable(),unread:W()}),q({version:Ah}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let zh=J([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);K({runningVersion:H().nullable(),installedVersion:H().nullable(),restartRequired:W(),remote:W(),updateSupported:W(),update:K({phase:zh,targetVersion:H().nullable(),error:H().nullable()})});let Bh=K({version:H().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();K({hostname:H().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:U().int().min(1).max(65535).nullable(),identity:H().max(4096).nullable(),action:J([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:W().optional(),version:H().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),K({state:J([`installed`,`not-installed`])}).strict();let X=H().min(1).max(1024),Vh={hostId:X.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},Hh={...Vh,threadId:X},Uh=H().min(1).max(8e3),Wh={text:Uh,requestId:X};Nu(`accepted`,[K({accepted:Y(!0),startQueuedItemId:X.optional()}),K({accepted:Y(!1),code:J([`remote/queue-unavailable`,`remote/steer-unavailable`,`remote/turn-changed`,`remote/send-rejected`,`session/queue-item-not-found`,`session/queue-item-starting`]),message:H()})]),Nu(`available`,[K({available:Y(!1)}),K({available:Y(!0),items:G(K({id:X,clientUserMessageId:X,preview:H().max(801)})).max(100)})]);let Gh=Nu(`kind`,[q({kind:Y(`hosts`)}),q({kind:Y(`create`),...Vh,cwd:H().min(1).max(8192),epoch:X}),q({kind:Y(`projectHarnesses`),...Vh,epoch:X}),q({kind:Y(`inspectHarness`),...Vh,epoch:X,cwd:H().min(1).max(8192),harnessId:X}),q({kind:Y(`startSelected`),...Vh,epoch:X,cwd:H().min(1).max(8192),harnessId:X,model:H().min(1).max(4096),serviceTier:J([`priority`,`ultrafast`]).optional(),reasoningEffort:X.optional()}),q({kind:Y(`status`),...Hh}),q({kind:Y(`list`),...Vh,cursor:H().nullable(),archived:W(),includeLoaded:Y(!0).optional()}),q({kind:Y(`read`),...Hh,page:q({cursor:H().min(1).max(8192).nullable(),epoch:X.optional(),sortDirection:J([`asc`,`desc`]).optional(),limit:U().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),q({kind:Y(`usage`),...Hh,epoch:X}),q({kind:Y(`configure`),...Hh,epoch:X,modelId:X.optional(),serviceTier:Qd.optional(),thinkingOptionId:X.optional(),permissionModeId:X.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`).refine(e=>e.serviceTier===void 0||e.modelId!==void 0,{message:`A service tier requires a Model ID`}),q({kind:Y(`prompt`),...Hh,epoch:X,text:Uh,requestId:X.optional()}),q({kind:Y(`queue`),...Hh,epoch:X}),q({kind:Y(`delivery`),...Hh,epoch:X,action:Nu(`kind`,[q({kind:Y(`enqueue`),...Wh}),q({kind:Y(`steer`),...Wh,turnId:X}),q({kind:Y(`remove`),itemId:X}),q({kind:Y(`start`),itemId:X,onlyIfHead:Y(!0).optional()}),q({kind:Y(`sendNow`),itemId:X})])}),q({kind:Y(`interrupt`),...Hh,epoch:X,turnId:X}),q({kind:Y(`rename`),...Hh,epoch:X,name:H().min(1).max(512)}),q({kind:Y(`archive`),...Hh,epoch:X,archived:W()}),q({kind:Y(`respond`),...Hh,epoch:X,requestId:ju([X,U().int()]),result:zu(H(),Tu())})]),Kh=H().min(1).max(1024),qh=K({hostId:Kh,displayName:H().min(1).max(1024),source:J([`codex-managed`,`discovered`]),sshAlias:H().max(1024).nullable(),sshHost:H().min(1).max(1024),sshPort:U().int().min(1).max(65535).nullable(),identity:H().max(4096).nullable(),autoConnect:W(),connectionAnalyticsId:H().max(1024).optional()}),Jh=q({displayName:H().min(1).max(1024),hostname:H().min(1).max(1024),sshPort:U().int().min(1).max(65535).nullable(),identity:H().max(4096).nullable()});Nu(`action`,[q({action:Y(`session`),operation:Gh}),q({action:Y(`list`)}),q({action:Y(`catalog`)}),q({action:Y(`read-thread`),hostId:Kh.refine(e=>e!==`local`),input:nm}),q({action:Y(`save`),draft:Jh,previous:qh.nullable()}),q({action:Y(`remove`),previous:qh}),q({action:Y(`connect`),hostId:Kh,enabled:W()}),q({action:Y(`state`),hostId:Kh}),q({action:Y(`runtime`),hostId:Kh}),q({action:Y(`update`),hostId:Kh.refine(e=>e!==`local`),version:Bh.shape.version})]),ju([q({result:bd}),q({error:q({code:U().int(),message:H()})})]),q({prompt:H().trim().min(1).max(2e3),cwd:H().max(4096).nullable()}),H().trim().min(1).max(60).nullable();let Yh=H().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Xh=ju([H(),K({en:H()}).catchall(H())]),Zh=K({title:Xh.optional(),description:Xh.optional(),icon:H().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:H().optional()});K({extensions:G(K({id:Yh,name:H().min(1).max(214),version:H().min(1).max(128),format:Y(`dsh`),supportedTargets:Lu([Y(`web`)]),enabledTargets:G(Y(`web`)).max(1),source:H().min(1).max(4096),projectUrl:H().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:H(),meta:Zh.optional(),loadError:H().optional()})),loadedIds:G(Yh),safeMode:W(),storeError:H().optional()});let Qh=H().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);K({spec:H().trim().min(1).max(4096),registry:Qh.optional()}).strict(),K({id:Yh,enabled:W()}).strict(),K({id:Yh}).strict(),Y(1);function $h({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:F.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[r?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${F.slot} ${F.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:F.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.slot,children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:F.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.titleText,children:n})}),c]})}function eg({host:e,variant:t=`workspace`,t:n}){let r=e?.displayName??n(`host.local`),i=e?.state===`connected`?n(`host.connected`):e?.state===`connecting`?n(`host.connecting`):n(`host.disconnected`),a=e?`${r} · ${i}`:r,s=e===void 0?void 0:fm(e.hostId,e.color);return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:R(F.hostBadge,t===`session`&&F.hostBadgeSession),"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,"data-color":s,role:`img`,"aria-label":a,title:a,children:[e!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hostDot,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hostLabel,children:r})]})}let tg=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=tg,e.textContent=`.jGgv6G_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}.jGgv6G_branch:has(>:first-child [data-harness-id]){--dsh-thread-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-harness-id])>.jGgv6G_children{--dsh-thread-parent-icon-size:14px}.jGgv6G_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}.jGgv6G_children .jGgv6G_children{--dsh-thread-guide-parent-gap:10px}.jGgv6G_children[hidden]{display:none}.jGgv6G_children[data-thread-guide]:before,.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:before{content:"";pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--dsh-thread-guide-axis)}.jGgv6G_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}.jGgv6G_children[data-thread-guide]>.jGgv6G_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}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:first-child:before{--dsh-thread-guide-stem-start:max(0px, var(--dsh-thread-guide-start))}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:last-child:before{--dsh-thread-guide-stem-end:8px;bottom:calc(100% - var(--dsh-thread-icon-center-y))}.jGgv6G_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}.jGgv6G_summary [data-thread-tree-activity=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.jGgv6G_summary [data-thread-tree-activity=pending]{color:var(--dsw-alias-state-warn-primary)}.jGgv6G_summary [data-thread-tree-activity=completed]{color:var(--dsw-alias-state-business-primary)}@media (hover:hover) and (pointer:fine){.jGgv6G_summary:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)}}.jGgv6G_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){.jGgv6G_branch{--dsh-thread-row-height:44px}.jGgv6G_summary{min-height:24px;padding-block:3px}}[data-phone-drawer] .jGgv6G_branch{--dsh-thread-row-height:44px}[data-phone-drawer] .jGgv6G_branch:has(>:first-child>[data-thread-summary]){--dsh-thread-icon-center-y:14px}`,document.head.appendChild(e)}var ng={branch:`jGgv6G_branch`,children:`jGgv6G_children`,summary:`jGgv6G_summary`};function rg(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function ig(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function ag(e,t,n){return[n(`threadTree.children`,{n:e}),...rg(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function og({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),rg(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 sg=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(sg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=sg,e.textContent=`.yY-O0a_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%}.yY-O0a_ring svg{width:100%;height:100%;display:block}.yY-O0a_ring circle{stroke:currentColor;stroke-width:1.5px}.yY-O0a_ring[data-thread-ring=pending]{color:var(--dsw-alias-state-warn-primary)}.yY-O0a_ring[data-thread-ring=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.yY-O0a_ring[data-thread-ring=running] svg{will-change:transform;contain:layout style paint;animation:1.8s linear infinite yY-O0a_spin}.yY-O0a_ring[data-thread-ring=running] circle{stroke-dasharray:48 16.4}.yY-O0a_ring[data-thread-ring=idle]{color:var(--dsw-alias-label-tertiary);opacity:.55}.yY-O0a_ring[data-thread-ring=idle] circle{stroke-width:1px;stroke-dasharray:1.5 3}@keyframes yY-O0a_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.yY-O0a_ring[data-thread-ring=running] svg{animation:none}}`,document.head.appendChild(e)}var cg={ring:`yY-O0a_ring`,spin:`yY-O0a_spin`};function lg({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:cg.ring,"data-thread-ring":ig(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 ug=[{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 dg({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:Xt.preview,"aria-hidden":`true`,children:ug.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:ng.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${F.sessionRow} ${Xt.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.sessionMain,children:/* @__PURE__ */ (0,o.jsx)($h,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:Xt.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(lg,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${ng.summary} ${Xt.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(og,{count:2,activity:r,t})})]})},n))})}function fg({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}=Qt(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:Xt.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Xt.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Xt.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:Xt.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Xt.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`?Zt[e.key===`Home`?0:1]:Zt[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:Zt.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:Xt.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:Xt.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Xt.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(dg,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Xt.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let pg=(0,s.createContext)(void 0),mg=()=>(0,s.useContext)(pg);function hg({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(gg,{node:e,renderRow:t},e.id))}function gg({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=pn(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:ng.branch,"data-thread-branch":!0,children:[/* @__PURE__ */ (0,o.jsx)(pg.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(fg,{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:ng.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(hg,{roots:p,children:t})})]})}function _g({node:e,title:t,toggle:n,t:r}){let i=mg(),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=ag(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,o.jsx)(`button`,{ref:a,type:`button`,"data-thread-summary":!0,className:ng.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)(og,{count:c.descendantCount,activity:c.activity,t:r})})}function vg(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function yg(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 bg(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 xg(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 Sg({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTitle,children:e}),t!==void 0&&t!==``&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverPath,children:t}),n!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTime,children:xg(n,r)})]})}function Cg(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function wg({color:e,state:t,className:n}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(F.remoteFolderGlobe,n),"data-color":e,"data-state":t,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsxs)(`svg`,{viewBox:`0 0 12 12`,width:`10`,height:`10`,fill:`none`,children:[/* @__PURE__ */ (0,o.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.6`,stroke:`currentColor`,strokeWidth:`1.2`}),/* @__PURE__ */ (0,o.jsx)(`ellipse`,{cx:`6`,cy:`6`,rx:`2.1`,ry:`4.6`,stroke:`currentColor`,strokeWidth:`1.05`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.6 6h8.8`,stroke:`currentColor`,strokeWidth:`1.05`})]})})}function Tg({group:e,foldedActivity:t,onToggle:n,onCreate:r,actions:i,drag:c,showHost:l=!0,home:u,newShortcut:d,t:f}){let p=e,m=t===void 0?void 0:{pending:`warning`,running:`ongoing`,completed:`done`,idle:void 0}[ig(t)],h=e.remote?void 0:i,g=c,_=p.workspaceId===void 0?f(`group.ungrouped`):p.label,v=p.remote===void 0?void 0:fm(p.remote.hostId,p.remote.color),y=l&&p.workspaceId!==void 0&&p.remote!==void 0,[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(null),te=[{id:`rename`,label:f(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{})},{id:`delete`,label:f(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{}),danger:!0}],ne=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(F.projectRow,b&&F.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":p.expanded,tabIndex:-1,onContextMenu:e=>{h&&!e.target.closest(`button`)&&(e.preventDefault(),C(new DOMRect(e.clientX,e.clientY,0,0)),x(!0))},onKeyDown:e=>{e.target===e.currentTarget&&h&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),C(null),x(!0))},onClick:n,draggable:g!==void 0,onDragStart:g===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,p.key),g.start()},onDragEnd:g?.end,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:R(F.slot,p.expanded&&F.folderExpanded),children:[p.expanded?/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),y&&p.remote&&v!==void 0&&/* @__PURE__ */ (0,o.jsx)(wg,{color:v,state:p.remote.state})]}),y&&p.remote?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.remoteHostText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.title,children:_}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.remoteHostMeta,children:p.remote.displayName})]}),m===void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.remoteHostStatusDot,"data-state":p.remote.state,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.titleText,children:_})})}),m!==void 0&&t!==void 0&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.projectActivity,"data-project-activity":m,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:m,size:m===`ongoing`?16:void 0}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.visuallyHidden,children:rg(t).filter(e=>e.count>0).map(e=>f(`threadTree.${e.state}`,{n:e.count})).join(` · `)})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.rowActions,children:[h!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:b,onClose:()=>{x(!1)},items:te,onSelect:e=>{
|
|
122
122
|
/* v8 ignore next -- Menu can emit only the rename and delete rows supplied above. */
|
|
123
|
-
y(!1),(e===`rename`||e===`delete`)&&(e===`rename`?p.rename():p.delete())},portal:!0,autoFocus:!0,getAnchorRect:x===null?void 0:()=>x,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:F.iconButton,"aria-label":d(`actions.workspace.aria`,{name:h}),"aria-haspopup":`menu`,"aria-expanded":v,onClick:e=>{e.stopPropagation(),S(null),y(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})})}),(!f.remote||f.remote.state===`connected`&&!!e.cwd)&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:d(`actions.newSession`),shortcutKeys:u?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:F.iconButton,"aria-keyshortcuts":u?.aria,"aria-label":d(`actions.newSession.aria`,{name:h}),onClick:e=>{e.stopPropagation(),n()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{})})})]})]}),T=f.cwd!==void 0&&f.cwd!==``?f.cwd:void 0;return f.workspaceId===void 0||T===void 0&&f.createdAt===void 0?w:/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:w,content:/* @__PURE__ */ (0,o.jsx)(sg,{label:f.label,cwd:T===void 0?void 0:b(T,l),createdAt:f.createdAt,t:d}),openDelayMs:800,disabled:v,copyText:T,copyLabel:d(`copy`),copiedLabel:d(`hover.copied`)})}function ug({node:e,now:t,renderSlot:n,t:r}){let i=tt(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`),s=e.remote===void 0?void 0:Ah(e.remote.hostId,e.remote.color),c=e.remote?.state===`connected`?r(`host.connected`):e.remote?.state===`connecting`?r(`host.connecting`):r(`host.disconnected`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTitle,children:rg(e,r)}),e.remote&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.hoverHost,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hoverHostDot,"data-color":s,"data-state":e.remote.state,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:`${e.remote.displayName} · ${c}`})]}),e.cwd&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTime,children:ag(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.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:R(F.hoverStatus,F.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`row.archived`)})]})]})}function dg({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let s=e.id===t,c=tt(e,i),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(F.searchResultRow,s&&F.selected,e.archived&&F.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:F.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.searchResultTitle,children:e.title||i(`session.untitled`)}),e.remote&&/* @__PURE__ */ (0,o.jsx)(zh,{host:e.remote,variant:`session`,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(rt,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.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:F.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:F.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.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:F.searchResultSnippet,children:e.snippet})]})]})}function fg({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}=ln(),y=$h(),b=e.tree?.depth??0,x=h[e.id]===!0,S=b===0?d:void 0,C=rg(e,p),T=e.id===n,ee=tt(e,p),E=ee[0],D=!m.archived&&E.state!==`idle`,te=m.remote===void 0?void 0:Ah(m.remote.hostId,m.remote.color),O=f&&m.remote!==void 0,ne=T&&O,re=!x&&v===`summary`&&(e.tree?.descendantCount??0)>0,ie=ne&&m.remote?/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.selectedHostHint,"data-color":te,"data-state":m.remote.state,children:m.remote.displayName}):void 0,ae=S!==void 0&&!m.blank&&!m.archived,k=m.blank?void 0:m.reference,oe=ae||k!==void 0,A=(0,s.useRef)(!1),[se,ce]=(0,s.useState)(!1),[le,ue]=(0,s.useState)(null),de=(0,s.useMemo)(()=>[se,ce],[se]),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(j.current?.scrollIntoView({block:`nearest`}),u())},[u]);let fe=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:j,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":b,"data-thread-sortable":String(ae),"data-thread-pinned":String(e.pinned),style:{"--dsh-thread-indent":`${Math.min(b,3)*24}px`},className:R(F.sessionRow,T&&F.selected,se&&F.menuOpen,m.archived&&F.archived,S?.marker===`before`&&F.dropBefore,S?.marker===`after`&&F.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(),ue(new DOMRect(e.clientX,e.clientY,0,0)),ce(!0))},onKeyDown:t=>{t.target!==t.currentTarget||m.blank||(A.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),ue(null),ce(!0)):t.key===`F2`&&!m.archived&&(t.preventDefault(),c(e.id,m.title)))},"aria-description":m.archived?p(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{A.current=!1},onClick:()=>{A.current||(T&&!m.archived&&e.tree?.descendantCount?(x&&_(e.tree.descendantIds),g(e.id,!x,y)):i(e.id))},draggable:oe,onDragStart:oe?t=>{A.current=!0,t.dataTransfer.effectAllowed=k===void 0?`move`:ae?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,k===void 0?e.id:w(k).clipboardText),k!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(k)),ae&&S?.start()}:void 0,onDragEnd:oe?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(cg(e)))},onDrop:S===void 0?void 0:e=>{S.active&&(e.preventDefault(),S.drop(cg(e)))},children:[O&&m.remote&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hostRail,"data-color":te,"data-state":m.remote.state,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Rh,{identityLabel:e.tree?.descendantCount?!x&&v===`ring`?p(`threadTree.expandSummary`,{title:C,summary:Wh(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)(Jh,{activity:e.tree.activity})]}),ambient:!m.archived&&!m.blank&&!D&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:C,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),g(e.id,!x,y)}:void 0,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.trailing,children:[!m.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(F.time,D&&F.timeStatus),"data-session-status":D?E.state:void 0,children:D?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(rt,{statuses:ee}),E.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:E.trailingLabel})]}):ig(m.updatedAt,r,p)}),!m.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:se,onClose:()=>{ce(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:C,phoneSidebarFooterBackLabel:p(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(ug,{node:e,now:r,renderSlot:l,t:p})}),getAnchorRect:le===null?void 0:()=>le,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:F.iconButton,"aria-label":p(`actions.session.aria`,{name:C}),"aria-haspopup":`menu`,"aria-expanded":se,onClick:()=>{ue(null),ce(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:de})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:b>0})})]})]})})}),re&&/* @__PURE__ */ (0,o.jsx)(ng,{node:e,title:C,prefix:ie,toggle:()=>g(e.id,!0,y),t:p}),!re&&ie!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{"data-selected-host-meta":!0,className:F.selectedHostSubline,children:ie})]});return/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:fe,content:/* @__PURE__ */ (0,o.jsx)(ug,{node:e,now:r,renderSlot:l,t:p}),openDelayMs:800,disabled:se||S?.active===!0,copyText:m.blank||m.title===``?void 0:m.title,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}let pg=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(pg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=pg,e.textContent=`.Jek-Ha_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var mg={exits:`Jek-Ha_exits`};function hg(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function gg(e){if(!e)return;let t=hg(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){let t=e===r?0:-1;(!e.hasAttribute(`tabindex`)||e.tabIndex!==t)&&(e.tabIndex=t)}}function _g(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=hg(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`}),gg(t))}function vg(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function yg(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var bg=class extends s.Component{armed=!1;list=(0,s.createRef)();overlay=(0,s.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;componentDidMount(){gg(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||vg(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)||!yg(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(gg(this.list.current),n===null){(!vg(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(!yg(t.rect,a)&&(r===void 0||!yg(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:_g,onFocusCapture:()=>gg(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:mg.exits,"aria-hidden":`true`})]})}};let xg=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(xg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=xg,e.textContent=`.Z54rEq_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}.Z54rEq_heading[data-row-key]{cursor:pointer}.Z54rEq_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.Z54rEq_heading[data-row-key]:focus-visible,.Z54rEq_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.Z54rEq_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.Z54rEq_chevron,.Z54rEq_collapsed{flex-shrink:0}.Z54rEq_collapsed{transform:rotate(-90deg)}.Z54rEq_trailing{align-items:center;min-width:0;margin-inline-start:auto;display:inline-flex}.Z54rEq_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}.Z54rEq_actionAfterTrailing{margin-inline-start:0}.Z54rEq_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (pointer:coarse){.Z54rEq_heading{min-height:44px}.Z54rEq_action{width:44px;height:44px}}`,document.head.appendChild(e)}var Sg={action:`Z54rEq_action`,actionAfterTrailing:`Z54rEq_actionAfterTrailing`,chevron:`Z54rEq_chevron`,collapsed:`Z54rEq_collapsed`,heading:`Z54rEq_heading`,title:`Z54rEq_title`,trailing:`Z54rEq_trailing`};function Cg({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,trailing:s,action:c}){let l=n!==void 0&&r!==void 0&&i!==void 0,u=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:Sg.title,children:e}),l&&/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{className:n?Sg.chevron:Sg.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Sg.trailing,onClick:e=>{e.stopPropagation()},children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:c.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:R(Sg.action,s!==void 0&&Sg.actionAfterTrailing),"aria-label":c.label,onClick:e=>{e.stopPropagation(),c.onActivate()},children:c.icon})})]});return l?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Sg.heading,role:`treeitem`,tabIndex:-1,"data-row-key":i,"aria-label":e,"aria-expanded":n,onClick:r,children:u}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Sg.heading,children:u})}let wg=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(wg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=wg,e.textContent=`.t4p6JG_section{margin-bottom:8px}.t4p6JG_section>*+[data-thread-branch]{margin-top:2px}`,document.head.appendChild(e)}var Tg={section:`t4p6JG_section`};function Eg({rows:e,customSection:t,currentId:n,onOpen:r,onRenameRequest:i,renderSlot:s,t:c,revealSessionId:l,onSessionRevealed:u,showHost:d=!0,expanded:f,onToggle:p,children:m}){if(e.length===0&&!t)return null;let h=t?.name??c(`section.pinned`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":h,className:Tg.section,"data-sidebar-pinned":!t||void 0,children:[/* @__PURE__ */ (0,o.jsx)(Cg,{label:h,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:14}),expanded:f,onToggle:p,rowKey:`section:${t?.key??`pinned`}`}),f&&/* @__PURE__ */ (0,o.jsx)(eg,{roots:e,children:e=>/* @__PURE__ */ (0,o.jsx)(fg,{node:e,showHost:d,currentId:n,now:Date.now(),onOpen:r,onRenameRequest:i,renderSlot:s,onReveal:e.id===l?()=>u(e.id):void 0,t:c},e.id)}),f&&m]})}let Dg=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Dg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Dg,e.textContent=`._14DcuW_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] ._14DcuW_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] ._14DcuW_list{scrollbar-gutter:auto}._14DcuW_root._14DcuW_rail{padding-right:0}._14DcuW_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}._14DcuW_iconButton:focus-visible,._14DcuW_searchButton:focus-visible,._14DcuW_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._14DcuW_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_viewOptionsMenu{min-width:200px}._14DcuW_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}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{margin-top:2px;margin-right:-4px}._14DcuW_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}._14DcuW_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}._14DcuW_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}._14DcuW_searchSlotExpanded{max-width:100%;padding-left:0}._14DcuW_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}._14DcuW_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}._14DcuW_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}._14DcuW_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}._14DcuW_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}._14DcuW_searchExpanded ._14DcuW_searchButton{width:28px;height:30px}._14DcuW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_searchExpanded ._14DcuW_searchButton:hover{background:0 0}._14DcuW_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}._14DcuW_searchExpanded ._14DcuW_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}._14DcuW_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}._14DcuW_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}._14DcuW_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_rail ._14DcuW_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}._14DcuW_rail ._14DcuW_headerActions{max-width:none}._14DcuW_rail ._14DcuW_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_rail ._14DcuW_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}._14DcuW_rail ._14DcuW_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_rail ._14DcuW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_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}._14DcuW_rail ._14DcuW_listArea{margin-left:0;margin-right:0;padding-left:0}._14DcuW_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}._14DcuW_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]:not([data-tauri-shell]) ._14DcuW_fade,[data-phone-drawer] ._14DcuW_fade,body[data-codexhost-wallpaper] ._14DcuW_fade{display:none}._14DcuW_wide{animation:_14DcuW_wide-in .2s var(--ds-ease-in-out)}@keyframes _14DcuW_wide-in{0%{opacity:0}}._14DcuW_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}._14DcuW_flatList>*+*,._14DcuW_searchTree>[role=treeitem]+[role=treeitem],._14DcuW_groupSection>*+*,._14DcuW_groupSessions>*+*{margin-top:2px}._14DcuW_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}._14DcuW_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}._14DcuW_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}._14DcuW_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}._14DcuW_skeletonDot,._14DcuW_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite _14DcuW_search-skeleton}._14DcuW_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}._14DcuW_skeletonBarWide{width:90%;height:13px}@keyframes _14DcuW_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}._14DcuW_groupSection{position:relative}._14DcuW_groupSection+._14DcuW_groupSection{margin-top:4px}._14DcuW_listTopDropIndicator,._14DcuW_workspaceDropBefore:before,._14DcuW_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}._14DcuW_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}._14DcuW_listTopDropActive>._14DcuW_workspaceDropBefore:first-child:before{display:none}._14DcuW_workspaceDropBefore:before{top:-8px}._14DcuW_workspaceDropAfter:after{bottom:-8px}._14DcuW_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}._14DcuW_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}._14DcuW_groupSessions>._14DcuW_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}@media (hover:hover){._14DcuW_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}._14DcuW_sessionOverflowButton:active{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}._14DcuW_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){._14DcuW_sessionOverflowButton,._14DcuW_root:not(._14DcuW_rail) ._14DcuW_iconButton{min-height:44px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{height:44px}._14DcuW_searchInput,._14DcuW_renameInput{font-size:16px}}._14DcuW_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}._14DcuW_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}._14DcuW_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}._14DcuW_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}._14DcuW_filterEmptyHint{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:flex-start;gap:4px;padding:10px 12px;font-size:12px;line-height:18px;display:flex}._14DcuW_filterEmptyHint ._14DcuW_emptyAction{font-size:12px;line-height:18px}._14DcuW_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}._14DcuW_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}._14DcuW_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}._14DcuW_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}._14DcuW_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._14DcuW_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}._14DcuW_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){._14DcuW_wide,._14DcuW_skeletonDot,._14DcuW_skeletonBar{animation:none}._14DcuW_search,._14DcuW_sectionLabel,._14DcuW_searchSlot,._14DcuW_searchInput,._14DcuW_headerActions{transition:none}}`,document.head.appendChild(e)}var Z={archiveActivity:`_14DcuW_archiveActivity`,clearButton:`_14DcuW_clearButton`,deleteAction:`_14DcuW_deleteAction`,deleteStatus:`_14DcuW_deleteStatus`,empty:`_14DcuW_empty`,emptyAction:`_14DcuW_emptyAction`,emptyState:`_14DcuW_emptyState`,fade:`_14DcuW_fade`,filterEmptyHint:`_14DcuW_filterEmptyHint`,flatList:`_14DcuW_flatList`,groupSection:`_14DcuW_groupSection`,groupSessions:`_14DcuW_groupSessions`,headerActions:`_14DcuW_headerActions`,headerActionsHidden:`_14DcuW_headerActionsHidden`,iconButton:`_14DcuW_iconButton`,list:`_14DcuW_list`,listArea:`_14DcuW_listArea`,listTopDropActive:`_14DcuW_listTopDropActive`,listTopDropIndicator:`_14DcuW_listTopDropIndicator`,rail:`_14DcuW_rail`,renameError:`_14DcuW_renameError`,renameInput:`_14DcuW_renameInput`,root:`_14DcuW_root`,search:`_14DcuW_search`,"search-skeleton":`_14DcuW_search-skeleton`,searchButton:`_14DcuW_searchButton`,searchExpanded:`_14DcuW_searchExpanded`,searchInput:`_14DcuW_searchInput`,searchSlot:`_14DcuW_searchSlot`,searchSlotExpanded:`_14DcuW_searchSlotExpanded`,searchStatus:`_14DcuW_searchStatus`,searchTree:`_14DcuW_searchTree`,sectionHeader:`_14DcuW_sectionHeader`,sectionLabel:`_14DcuW_sectionLabel`,sectionLabelHidden:`_14DcuW_sectionLabelHidden`,sessionOverflowButton:`_14DcuW_sessionOverflowButton`,skeletonBar:`_14DcuW_skeletonBar`,skeletonBarWide:`_14DcuW_skeletonBarWide`,skeletonBars:`_14DcuW_skeletonBars`,skeletonDot:`_14DcuW_skeletonDot`,skeletonRow:`_14DcuW_skeletonRow`,treeBody:`_14DcuW_treeBody`,viewOptionsMenu:`_14DcuW_viewOptionsMenu`,wide:`_14DcuW_wide`,"wide-in":`_14DcuW_wide-in`,workspaceDropAfter:`_14DcuW_workspaceDropAfter`,workspaceDropBefore:`_14DcuW_workspaceDropBefore`};function Og({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:Z.sessionOverflowButton,disabled:e.loading,onClick:()=>{e.listErrorPage===`more`?n(e.listErrorWorkspaceId??void 0):t()},children:r(`sessions.retry`)})]}):null}function kg(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 Ag(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function jg({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:Z.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 Mg=`codexhost.sidebar.hostScopeFilter.v1`,Ng=`codexhost:apply-host-scope-workspace-selection`;function Pg(e){return e.some(e=>e.remote!==void 0)}function Fg(e){return e.some(e=>e.remote?.hostId.startsWith(`remote-peer:`)===!0)}function Ig(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.remote;if(e===void 0){t.push(r);continue}let i=n.get(e.hostId);i===void 0?n.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.displayName,state:e.state,...e.color===void 0?{}:{color:e.color},workspaceCount:1,workspaces:[r]}):(i.workspaces.push(r),i.workspaceCount+=1,i.color===void 0&&e.color!==void 0&&(i.color=e.color))}return t.length===0&&n.size===0?[]:[{key:`local`,workspaceCount:t.length,workspaces:t},...n.values()]}function Lg(e,t){return e.selectedHost===`all`||Ig(t).some(t=>t.key===e.selectedHost)?e:{...e,selectedHost:`all`}}function Rg(e,t,n){let r=Ig(t),i=new Map(r.map(e=>[e.key,e])),a=n?.preserveHostKeys,o=e.selectedHost!==`all`&&e.selectedHost!==`local`&&!i.has(e.selectedHost)?`all`:e.selectedHost,s=o!==e.selectedHost,c={};for(let[t,n]of Object.entries(e.perHost)){let e=i.get(t);if(e===void 0){if(t!==`local`){a?.has(t)===!0?c[t]=n:s=!0;continue}n.workspaceIds.length>0?(s=!0,c[t]={mode:n.mode,workspaceIds:[]}):c[t]=n;continue}if(t!==`local`&&(e.state===`connecting`||e.state!==`connected`&&a?.has(t)===!0)){c[t]=n;continue}let r=new Set(e.workspaces.map(e=>e.workspaceId)),o=n.workspaceIds.filter(e=>r.has(e));o.length===n.workspaceIds.length?c[t]=n:(s=!0,c[t]={mode:n.mode,workspaceIds:o})}return s?{selectedHost:o,perHost:c}:e}function zg(e,t){let n=Lg(e,t);return n.selectedHost!==`all`||Ig(t).some(e=>n.perHost[e.key]?.mode===`selected`)}function Bg(e,t){let n=Lg(t,e);return e.filter(e=>{let t=e.remote?.hostId??`local`;if(n.selectedHost===`local`){if(e.remote!==void 0)return!1}else if(n.selectedHost!==`all`&&e.remote?.hostId!==n.selectedHost)return!1;let r=n.perHost[t];return r?.mode!==`selected`||r.workspaceIds.includes(e.workspaceId)})}function Vg(e){return typeof e==`string`?e:e.id}function Hg(e){return typeof e!=`string`&&(e.remote??e.projectionValues?.remoteHost??null)!==null}function Ug(e,t,n,r){let i=Lg(r,n);if(!zg(i,n))return[...e];let a=t instanceof Set?t:new Set(t),o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set;for(let e of n){let t=a.has(e.workspaceId);for(let n of e.sessionIds)o.add(n),t&&s.add(n)}let c=(i.selectedHost===`all`||i.selectedHost===`local`)&&i.perHost.local?.mode!==`selected`;return e.filter(e=>{let t=Vg(e);return s.has(t)?!0:!o.has(t)&&!Hg(e)&&c})}function Wg(e,t){if(t===void 0||t.mode!==`selected`)return e.workspaceCount;let n=new Set(t.workspaceIds),r=0;for(let t of e.workspaces)n.has(t.workspaceId)&&(r+=1);return r}function Gg(e,t){return e.selectedHost===t?e:{...e,selectedHost:t}}function Kg(e,t,n,r){let i=e.perHost[t],a=n===`selected`?i===void 0?[...new Set(r)]:[...i.workspaceIds]:i===void 0?[]:[...i.workspaceIds];return{...e,perHost:{...e.perHost,[t]:{mode:n,workspaceIds:a}}}}function qg(e,t,n,r){let i=e.perHost[t],a=i?.mode===`selected`?i.workspaceIds:[...r],o=a.includes(n)?a.filter(e=>e!==n):[...a,n];return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:o}}}}function Jg(e,t,n){return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:[...new Set(n)]}}}}function Yg(){return{selectedHost:`all`,perHost:{}}}function Xg(e,t,n){let r=Lg(e,n),i=t?.remote?.hostId??`local`,a=r.selectedHost,o=r.perHost,s=!1;a!==`all`&&a!==i&&(a=`all`,s=!0);let c=o[i];return c?.mode===`selected`&&(t===void 0?(o={...o,[i]:{...c,mode:`all`}},s=!0):c.workspaceIds.includes(t.workspaceId)||(o={...o,[i]:{mode:`selected`,workspaceIds:[...c.workspaceIds,t.workspaceId]}},s=!0)),s?{selectedHost:a,perHost:o}:e}function Zg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qg(e){if(e===null||e===``)return Yg();try{let t=JSON.parse(e);if(!Zg(t))return Yg();let n=typeof t.selectedHost==`string`&&t.selectedHost.trim()!==``?t.selectedHost:`all`,r={};if(Zg(t.perHost))for(let[e,n]of Object.entries(t.perHost)){if(e===``||!Zg(n)||n.mode!==`all`&&n.mode!==`selected`)continue;let t=Array.isArray(n.workspaceIds)?[...new Set(n.workspaceIds.filter(e=>typeof e==`string`))]:[];r[e]={mode:n.mode,workspaceIds:t}}return{selectedHost:n,perHost:r}}catch{return Yg()}}function $g(e){try{let t=e===void 0?typeof window<`u`?window.localStorage:null:e;return t===null?Yg():Qg(t.getItem(Mg))}catch{return Yg()}}function e_(e,t){try{let n=t===void 0?typeof window<`u`?window.localStorage:null:t;if(n===null)return;n.setItem(Mg,JSON.stringify(e))}catch{}}let t_=`@deepseek-ai/dsh-client-ui-workspace/HostScopeFilter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(t_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=t_,e.textContent=`.jFA5LW_tabBar{scrollbar-width:none;flex:none;align-items:center;gap:2px;margin-bottom:2px;padding:2px 0 6px;display:flex;overflow-x:auto}.jFA5LW_tabBar::-webkit-scrollbar{display:none}.jFA5LW_tabItem{max-width:136px;height:26px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:7px;flex:none;align-items:center;gap:5px;padding:0 8px;font-size:12px;font-weight:500;line-height:16px;display:inline-flex}.jFA5LW_tabItem:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_tabItemActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);color:var(--dsw-alias-label-primary)}.jFA5LW_tabItemActive:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}.jFA5LW_tabItem:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_tabLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_tabDot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:5px;height:5px}.jFA5LW_anchorRoot{align-items:center;min-width:0;display:inline-flex;position:relative}.jFA5LW_trigger{max-width:128px;height:22px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;align-items:center;gap:4px;padding:0 6px;font-size:11.5px;font-weight:500;line-height:16px;display:inline-flex}.jFA5LW_trigger:hover,.jFA5LW_triggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_triggerActive{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_triggerActive:hover,.jFA5LW_triggerActive.jFA5LW_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_trigger:focus-visible,.jFA5LW_hostRow:focus-visible,.jFA5LW_segmentButton:focus-visible,.jFA5LW_perHostTrigger:focus-visible,.jFA5LW_footerAction:focus-visible,.jFA5LW_resetLink:focus-visible,.jFA5LW_miniLink:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_triggerChevron{opacity:.65;flex:none}.jFA5LW_dot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.5;border-radius:50%;flex:none;width:6px;height:6px}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#3b76cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#7460cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#2f8c70}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#c27803}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#c94a6a}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#94a3b8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.9}.jFA5LW_popover{z-index:1100;box-sizing:border-box;width:min(260px,100vw - 24px);max-height:calc(100vh - 24px - max(12px, var(--dsh-frame-overlay-top,12px)));--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border:0;flex-direction:column;padding:5px;display:flex;position:fixed}.jFA5LW_scrollArea{flex-direction:column;flex:1;gap:2px;min-height:0;display:flex;overflow-y:auto}.jFA5LW_section{flex-direction:column;gap:1px;display:flex}.jFA5LW_sectionTitleRow{justify-content:space-between;align-items:center;gap:8px;padding:4px 7px 3px;display:flex}.jFA5LW_sectionTitle{letter-spacing:.01em;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:500;line-height:14px}.jFA5LW_resetLink,.jFA5LW_miniLink{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:1px 4px;font-size:11px;line-height:15px;transition:background-color .1s,color .1s}.jFA5LW_resetLink:hover:not(:disabled),.jFA5LW_miniLink:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_miniLink:disabled{opacity:.35;cursor:default}.jFA5LW_hostList{flex-direction:column;gap:1px;display:flex}.jFA5LW_hostRow{width:100%;min-height:28px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s;display:flex}.jFA5LW_hostRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_hostRowSelected{background:color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);font-weight:500}.jFA5LW_hostName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_hostCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_hostCountFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_checkSlot{width:14px;height:14px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.jFA5LW_divider{background:var(--dsw-alias-border-l2);height:1px;margin:4px 3px}.jFA5LW_scopeEditor{flex-direction:column;gap:6px;padding:2px 4px 4px;display:flex}.jFA5LW_segmented{background:var(--dsw-alias-interactive-bg-hover);border-radius:7px;grid-template-columns:1fr 1fr;gap:2px;padding:2px;display:grid}.jFA5LW_segmentButton{box-sizing:border-box;height:24px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;text-overflow:ellipsis;cursor:pointer;background:0 0;border:none;border-radius:5px;padding:0 7px;font-size:11.5px;font-weight:500;line-height:16px;transition:color .1s;overflow:hidden}.jFA5LW_segmentButton:hover:not(.jFA5LW_segmentActive){color:var(--dsw-alias-label-primary)}.jFA5LW_segmentActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-soft)}.jFA5LW_workspacePicker{flex-direction:column;gap:3px;display:flex}.jFA5LW_workspacePickerBar{justify-content:space-between;align-items:center;gap:6px;padding:0 3px;display:flex}.jFA5LW_workspacePickerCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:15px}.jFA5LW_workspacePickerActions{align-items:center;gap:2px;display:inline-flex}.jFA5LW_workspaceList{flex-direction:column;gap:1px;max-height:160px;display:flex;overflow-y:auto}.jFA5LW_workspaceOption{min-height:25px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:5px;align-items:center;gap:7px;padding:2px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_workspaceOption:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_workspaceCheckbox{width:13px;height:13px;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));cursor:pointer;flex:none;margin:0}.jFA5LW_workspaceOptionName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_noWorkspaces{color:var(--dsw-alias-label-tertiary);padding:6px;font-size:11.5px;line-height:16px}.jFA5LW_allHostsScopeList{flex-direction:column;gap:1px;display:flex}.jFA5LW_perHostAccordion{border-radius:6px;flex-direction:column;display:flex}.jFA5LW_perHostTrigger{width:100%;min-height:27px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;padding:3px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_perHostTrigger:hover,.jFA5LW_perHostTriggerOpen{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_accordionIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_scopeSummaryTag{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_scopeSummaryTagFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_perHostBody{padding:3px 2px 2px 10px}.jFA5LW_footer{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;flex:none;gap:1px;margin-top:4px;padding-top:4px;display:flex}.jFA5LW_footerAction{width:100%;min-height:28px;color:var(--dsw-alias-label-secondary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s,color .1s;display:flex}.jFA5LW_footerAction:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_footerIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_footerAction:hover .jFA5LW_footerIcon{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.jFA5LW_trigger{min-height:32px;padding:0 8px}.jFA5LW_hostRow,.jFA5LW_footerAction{min-height:38px}.jFA5LW_workspaceOption{min-height:34px}}@media (prefers-reduced-motion:reduce){.jFA5LW_trigger,.jFA5LW_hostRow,.jFA5LW_footerAction{transition:none}}`,document.head.appendChild(e)}var Q={accordionIcon:`jFA5LW_accordionIcon`,allHostsScopeList:`jFA5LW_allHostsScopeList`,anchorRoot:`jFA5LW_anchorRoot`,checkSlot:`jFA5LW_checkSlot`,divider:`jFA5LW_divider`,dot:`jFA5LW_dot`,footer:`jFA5LW_footer`,footerAction:`jFA5LW_footerAction`,footerIcon:`jFA5LW_footerIcon`,hostCount:`jFA5LW_hostCount`,hostCountFiltered:`jFA5LW_hostCountFiltered`,hostList:`jFA5LW_hostList`,hostName:`jFA5LW_hostName`,hostRow:`jFA5LW_hostRow`,hostRowSelected:`jFA5LW_hostRowSelected`,miniLink:`jFA5LW_miniLink`,noWorkspaces:`jFA5LW_noWorkspaces`,perHostAccordion:`jFA5LW_perHostAccordion`,perHostBody:`jFA5LW_perHostBody`,perHostTrigger:`jFA5LW_perHostTrigger`,perHostTriggerOpen:`jFA5LW_perHostTriggerOpen`,popover:`jFA5LW_popover`,resetLink:`jFA5LW_resetLink`,scopeEditor:`jFA5LW_scopeEditor`,scopeSummaryTag:`jFA5LW_scopeSummaryTag`,scopeSummaryTagFiltered:`jFA5LW_scopeSummaryTagFiltered`,scrollArea:`jFA5LW_scrollArea`,section:`jFA5LW_section`,sectionTitle:`jFA5LW_sectionTitle`,sectionTitleRow:`jFA5LW_sectionTitleRow`,segmentActive:`jFA5LW_segmentActive`,segmentButton:`jFA5LW_segmentButton`,segmented:`jFA5LW_segmented`,tabBar:`jFA5LW_tabBar`,tabDot:`jFA5LW_tabDot`,tabItem:`jFA5LW_tabItem`,tabItemActive:`jFA5LW_tabItemActive`,tabLabel:`jFA5LW_tabLabel`,trigger:`jFA5LW_trigger`,triggerActive:`jFA5LW_triggerActive`,triggerChevron:`jFA5LW_triggerChevron`,triggerLabel:`jFA5LW_triggerLabel`,triggerOpen:`jFA5LW_triggerOpen`,workspaceCheckbox:`jFA5LW_workspaceCheckbox`,workspaceList:`jFA5LW_workspaceList`,workspaceOption:`jFA5LW_workspaceOption`,workspaceOptionName:`jFA5LW_workspaceOptionName`,workspacePicker:`jFA5LW_workspacePicker`,workspacePickerActions:`jFA5LW_workspacePickerActions`,workspacePickerBar:`jFA5LW_workspacePickerBar`,workspacePickerCount:`jFA5LW_workspacePickerCount`};function n_(e,t){return e.key===`local`?t(`host.local`):e.displayName||e.hostId||e.key}function r_(e,t){return t(e===`connected`?`host.connected`:e===`connecting`?`host.connecting`:`host.disconnected`)}function i_({host:e,state:t,onChange:n,t:r}){let i=t.perHost[e.key],a=i?.mode===`selected`?`selected`:`all`,c=(0,s.useMemo)(()=>new Set(i?.mode===`selected`?i.workspaceIds:[]),[i]),l=(0,s.useMemo)(()=>e.workspaces.map(e=>e.workspaceId),[e.workspaces]),u=Wg(e,i);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scopeEditor,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.segmented,role:`tablist`,"aria-label":r(`hostScope.scope.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`all`,className:R(Q.segmentButton,a===`all`&&Q.segmentActive),onClick:()=>{n(Kg(t,e.key,`all`,l))},children:r(`hostScope.scope.allSessions`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`selected`,className:R(Q.segmentButton,a===`selected`&&Q.segmentActive),onClick:()=>{n(Kg(t,e.key,`selected`,l))},children:r(`hostScope.scope.selectedWorkspaces`)})]}),a===`selected`&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePicker,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePickerBar,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspacePickerCount,children:r(`hostScope.selectedCount`,{selected:u,total:e.workspaceCount})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Q.workspacePickerActions,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:e.workspaces.length===0||u===e.workspaces.length,onClick:()=>{n(Jg(t,e.key,l))},children:r(`hostScope.selectAll`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:u===0,onClick:()=>{n(Jg(t,e.key,[]))},children:r(`hostScope.clear`)})]})]}),e.workspaces.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.noWorkspaces,children:r(`hostScope.noHostWorkspaces`)}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.workspaceList,children:e.workspaces.map(r=>{let i=c.has(r.workspaceId);return/* @__PURE__ */ (0,o.jsxs)(`label`,{className:Q.workspaceOption,title:r.path||r.title,children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`checkbox`,className:Q.workspaceCheckbox,checked:i,onChange:()=>{n(qg(t,e.key,r.workspaceId,l))}}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspaceOptionName,children:r.title})]},r.workspaceId)})})]})]})}function a_({workspaces:e,state:t,onChange:n,t:r}){let i=(0,s.useMemo)(()=>Pg(e),[e]),a=(0,s.useMemo)(()=>Ig(e),[e]),c=(0,s.useMemo)(()=>Lg(t,e),[t,e]);return i?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBar,role:`tablist`,"aria-label":r(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c.selectedHost===`all`,className:R(Q.tabItem,c.selectedHost===`all`&&Q.tabItemActive),onClick:()=>{n(Gg(c,`all`))},children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:r(`hostScope.allShort`)})}),a.map(e=>{let t=c.selectedHost===e.key,i=n_(e,r),a=e.hostId===void 0?i:`${i} · ${r_(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:R(Q.tabItem,t&&Q.tabItemActive),title:a,onClick:()=>{n(Gg(c,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabDot,"data-state":e.state??`disconnected`,"data-color":Ah(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:i})]},e.key)})]}):null}function o_({workspaces:e,state:t,onChange:n,t:r}){let[i,l]=(0,s.useState)(!1),[u,d]=(0,s.useState)(null),f=(0,s.useRef)(null),p=(0,s.useRef)(null),m=(0,s.useRef)(null),h=(0,s.useId)(),g=(0,s.useMemo)(()=>Pg(e),[e]),_=(0,s.useMemo)(()=>Ig(e),[e]),v=(0,s.useMemo)(()=>Lg(t,e),[t,e]),y=(0,s.useMemo)(()=>zg(v,e),[v,e]),b=(0,s.useMemo)(()=>v.selectedHost===`all`?void 0:_.find(e=>e.key===v.selectedHost),[v.selectedHost,_]),x=(0,a.useAnchoredPosition)({open:i,anchorRef:p,panelRef:m,side:`bottom`,align:`end`,gap:4,margin:12});if((0,a.useDismissOnOutsidePointer)(f,i,l,m),(0,s.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),l(!1),p.current?.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[i]),!g)return null;let S=(()=>{if(!y)return r(`hostScope.allShort`);if(b!==void 0){let e=n_(b,r),t=v.perHost[b.key];return t?.mode===`selected`?`${e} · ${Wg(b,t)}`:e}return r(`hostScope.filtered`)})(),C=b?.hostId===void 0?void 0:b.hostId,w=()=>{l(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:C===void 0?{}:{hostId:C}}))},T=()=>{l(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},ee=e.length;return/* @__PURE__ */ (0,o.jsxs)(`span`,{ref:f,className:Q.anchorRoot,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:p,type:`button`,className:R(Q.trigger,y&&Q.triggerActive,i&&Q.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?h:void 0,"aria-label":r(`hostScope.trigger.aria`,{current:S}),title:r(`hostScope.trigger.aria`,{current:S}),onClick:e=>{e.stopPropagation(),l(e=>!e)},children:[b?.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":b.state??`disconnected`,"data-color":Ah(b.hostId,b.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.triggerLabel,children:S}),/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:12,className:Q.triggerChevron})]}),i&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:m,id:h,role:`dialog`,"aria-label":r(`hostScope.popover.aria`),className:Q.popover,style:x??{visibility:`hidden`,left:0,top:0},onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scrollArea,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.sectionTitleRow,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:r(`hostScope.host.label`)}),y&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.resetLink,onClick:()=>{n(Yg())},children:r(`hostScope.reset`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.hostList,role:`radiogroup`,"aria-label":r(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":v.selectedHost===`all`,className:R(Q.hostRow,v.selectedHost===`all`&&Q.hostRowSelected),onClick:()=>{n(Gg(v,`all`))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:r(`hostScope.allHosts`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostCount,children:ee}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:v.selectedHost===`all`&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:14})})]}),_.map(e=>{let t=v.selectedHost===e.key,i=v.perHost[e.key],s=i?.mode===`selected`,c=Wg(e,i),l=s?`${c}/${e.workspaceCount}`:String(e.workspaceCount),u=n_(e,r),d=e.hostId===void 0?u:`${u} · ${r_(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:R(Q.hostRow,t&&Q.hostRowSelected),title:d,onClick:()=>{n(Gg(v,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":Ah(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:u}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Q.hostCount,s&&Q.hostCountFiltered),children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:t&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:14})})]},e.key)})]})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.sectionTitleRow,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:r(`hostScope.scope.label`)})}),b===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.allHostsScopeList,children:_.map(e=>{let t=u===e.key,i=v.perHost[e.key],s=i?.mode===`selected`,c=s?`${Wg(e,i)}/${e.workspaceCount}`:r(`hostScope.allShort`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.perHostAccordion,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:R(Q.perHostTrigger,t&&Q.perHostTriggerOpen),"aria-expanded":t,onClick:()=>{d(t=>t===e.key?null:e.key)},children:[t?/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:12,className:Q.accordionIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronRightOutlineRegular,{size:12,className:Q.accordionIcon}),e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":Ah(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:n_(e,r)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Q.scopeSummaryTag,s&&Q.scopeSummaryTagFiltered),children:c})]}),t&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.perHostBody,children:/* @__PURE__ */ (0,o.jsx)(i_,{host:e,state:v,onChange:n,t:r})})]},e.key)})}):/* @__PURE__ */ (0,o.jsx)(i_,{host:b,state:v,onChange:n,t:r})]})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.footer,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:w,children:[/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.addRemoteWorkspace`)})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:T,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.manageRemoteHosts`)})]})]})]}),document.body)]})}function s_(e,t){let n=Ig(e),r=n.find(e=>e.key===`local`)??{key:`local`,workspaces:[]},i=/* @__PURE__ */ new Map;for(let e of n)e.key!==`local`&&e.hostId!==void 0&&i.set(e.hostId,e);for(let e of t){if(!e.enabled){i.delete(e.hostId);continue}let t=i.get(e.hostId);t===void 0?i.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.name,state:e.state,workspaces:[]}):i.set(e.hostId,{...t,displayName:e.name||t.displayName,state:e.state||t.state})}return[r,...i.values()]}function c_(e,t){return t===void 0?`local`:e.find(e=>e.workspaceId===t)?.remote?.hostId??`local`}function l_(e,t,n){let r=t.trim().toLowerCase();return r===``?[...e]:e.filter(e=>(e.key===`local`?n:e.displayName??e.hostId??e.key).toLowerCase().includes(r)||e.hostId!==void 0&&e.hostId.toLowerCase().includes(r))}function u_(e,t,n){let r=t.trim().toLowerCase();return r===``?[...e]:e.filter(e=>{let t=n(e).toLowerCase(),i=(e.path??``).toLowerCase();return t.includes(r)||i.includes(r)})}function d_(e,t){if(!e)return;let n=e.replace(/[\\/]+$/u,``);if(!n)return;let r=n.split(/[\\/]+/u).filter(Boolean);if(r.length<2)return;let i=r[r.length-2];if(i&&i!==t&&i!==`~`&&i!==`Users`&&i!==`home`)return i}function f_(e){if(typeof e!=`object`||!e)return[];let t=e.result;if(typeof t!=`object`||!t)return[];let n=t,r=(n.ok===!0&&typeof n.value==`object`&&n.value!==null?n.value:n).peers;if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e;typeof t.hostId==`string`&&t.hostId!==``&&typeof t.name==`string`&&typeof t.state==`string`&&i.push({hostId:t.hostId,name:t.name,state:t.state,enabled:t.enabled!==!1})}return i}function p_(e,t){if(t.workspaceId!==void 0){let n=e.find(e=>e.workspaceId===t.workspaceId);if(n!==void 0)return n}let n=t.path.replace(/[\\/]+$/u,``);return e.find(e=>e.remote?.hostId===t.hostId&&e.path.replace(/[\\/]+$/u,``)===n)}let m_=`@deepseek-ai/dsh-client-ui-workspace/HeroLocationWorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(m_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=m_,e.textContent=`.tXrwyq_root{align-items:center;gap:4px;min-width:0;max-width:100%;display:inline-flex}.tXrwyq_trigger{min-width:0;max-width:240px;height:30px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9999px;align-items:center;gap:7px;padding:0 10px;font-size:13.5px;font-weight:450;line-height:20px;transition:background-color .11s,color .11s;display:inline-flex}.tXrwyq_trigger:hover:not(:disabled),.tXrwyq_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.tXrwyq_trigger:disabled{opacity:.55;cursor:default}.tXrwyq_trigger:focus-visible,.tXrwyq_row:focus-visible,.tXrwyq_footerAction:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.tXrwyq_triggerPlaceholder{color:var(--dsw-alias-label-tertiary);font-weight:400}.tXrwyq_triggerPlaceholder:hover:not(:disabled),.tXrwyq_triggerPlaceholder.tXrwyq_triggerOpen{color:var(--dsw-alias-label-secondary)}.tXrwyq_triggerLocation{flex:0 auto;max-width:180px}.tXrwyq_triggerProject{flex:0 auto;max-width:260px}.tXrwyq_triggerIcon{color:currentColor;opacity:.9;flex:none}.tXrwyq_triggerPlaceholder .tXrwyq_triggerIcon{opacity:.8}.tXrwyq_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_statusDot{background:var(--dsw-alias-label-tertiary);opacity:.78;border-radius:50%;flex:none;width:6px;height:6px}.tXrwyq_statusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.92}.tXrwyq_statusDot[data-state=auth-error]{background:var(--dsw-alias-state-error-primary);opacity:.92}.tXrwyq_popover{z-index:1100;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);--dsw-elevation-stroke-color:transparent;box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border-radius:16px;flex-direction:column;padding:6px;display:flex;position:fixed}.tXrwyq_popoverLocation{width:min(264px,100vw - 24px)}.tXrwyq_popoverProject{width:min(280px,100vw - 24px)}.tXrwyq_searchRow{align-items:center;gap:8px;height:36px;padding:0 10px;display:flex}.tXrwyq_searchIcon{color:var(--dsw-alias-label-tertiary);flex:none}.tXrwyq_searchInput{min-width:0;height:100%;color:var(--dsw-alias-label-primary);font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0;font-size:14px;line-height:20px}.tXrwyq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.tXrwyq_divider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:4px 10px 6px}.tXrwyq_footerDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:6px 10px 4px}.tXrwyq_list{flex-direction:column;gap:2px;max-height:260px;display:flex;overflow-y:auto}.tXrwyq_row{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_row:hover,.tXrwyq_rowActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_rowIcon{width:16px;height:16px;color:var(--dsw-alias-label-secondary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_rowMain{flex:1;align-items:baseline;gap:7px;min-width:0;display:flex}.tXrwyq_rowTitle{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_rowHint{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-tertiary);flex:0 auto;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.tXrwyq_rowStatus{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:16px}.tXrwyq_checkSlot{width:16px;height:16px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_emptyState{text-align:center;color:var(--dsw-alias-label-tertiary);padding:16px 10px;font-size:13px;line-height:18px}.tXrwyq_footerAction{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_footerAction:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_footerAction:disabled{opacity:.5;cursor:default}.tXrwyq_footerIcon{color:var(--dsw-alias-label-secondary);flex:none}.tXrwyq_modalAction{min-width:72px}.tXrwyq_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}@media (hover:none),(pointer:coarse){.tXrwyq_trigger{min-height:34px;padding:0 11px}.tXrwyq_row,.tXrwyq_footerAction{min-height:40px}}@media (prefers-reduced-motion:reduce){.tXrwyq_trigger,.tXrwyq_row,.tXrwyq_footerAction{transition:none}}`,document.head.appendChild(e)}var $={checkSlot:`tXrwyq_checkSlot`,divider:`tXrwyq_divider`,emptyState:`tXrwyq_emptyState`,footerAction:`tXrwyq_footerAction`,footerDivider:`tXrwyq_footerDivider`,footerIcon:`tXrwyq_footerIcon`,list:`tXrwyq_list`,modalAction:`tXrwyq_modalAction`,modalError:`tXrwyq_modalError`,popover:`tXrwyq_popover`,popoverLocation:`tXrwyq_popoverLocation`,popoverProject:`tXrwyq_popoverProject`,root:`tXrwyq_root`,row:`tXrwyq_row`,rowActive:`tXrwyq_rowActive`,rowHint:`tXrwyq_rowHint`,rowIcon:`tXrwyq_rowIcon`,rowMain:`tXrwyq_rowMain`,rowStatus:`tXrwyq_rowStatus`,rowTitle:`tXrwyq_rowTitle`,searchIcon:`tXrwyq_searchIcon`,searchInput:`tXrwyq_searchInput`,searchRow:`tXrwyq_searchRow`,statusDot:`tXrwyq_statusDot`,trigger:`tXrwyq_trigger`,triggerIcon:`tXrwyq_triggerIcon`,triggerLabel:`tXrwyq_triggerLabel`,triggerLocation:`tXrwyq_triggerLocation`,triggerOpen:`tXrwyq_triggerOpen`,triggerPlaceholder:`tXrwyq_triggerPlaceholder`,triggerProject:`tXrwyq_triggerProject`};let h_=`codexhost:remote-peers-updated`,g_=`codexhost:remote-workspace-created`,__=`codexhost/remote-peers/list`,v_=`::no-project`;function y_({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2.25`,y:`2.75`,width:`11.5`,height:`8`,rx:`1.5`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.25 12.75h13.5`})]})}function b_({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`8.5`,rx:`1.6`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function x_(e,t){return e.key===`local`?t(`host.thisComputer`):e.displayName||e.hostId||e.key}function S_(e,t){if(e!==void 0&&e!==`connected`)return t(e===`connecting`?`host.connecting`:`host.disconnected`)}function C_({location:e,className:t}){return e.key===`local`?/* @__PURE__ */ (0,o.jsx)(y_,{className:t}):e.state!==void 0&&e.state!==`connected`?/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.statusDot,"data-state":e.state,"aria-hidden":`true`}):/* @__PURE__ */ (0,o.jsx)(b_,{className:t})}async function w_(e){try{let t=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hero-peers-${Date.now()}`,n=await fetch(`api/${__}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:t,method:__,payload:{args:{}}}),...e===void 0?{}:{signal:e}});return n.ok?f_(await n.json()):null}catch{return null}}function T_({open:e,selectedId:t,fallbackLabel:n,onOpenChange:r,onPick:i,onClose:l,useWorkspaces:u,createWorkspace:d,useDirectoryFlow:f,renderSlot:p,t:m}){let h=u(e=>e),g=h.items,_=h.canStartProjectless===!0,v=f(e=>e),[y,b]=(0,s.useState)([]),[x,S]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),[T,ee]=(0,s.useState)(!1),[E,D]=(0,s.useState)(``),[te,O]=(0,s.useState)(``),[ne,re]=(0,s.useState)(-1),[ie,ae]=(0,s.useState)(-1),[k,oe]=(0,s.useState)(!1),[A,se]=(0,s.useState)(!1),[ce,le]=(0,s.useState)(!1),[ue,de]=(0,s.useState)(null),j=(0,a.usePhoneSidebar)(),fe=(0,s.useRef)(!1),pe=(0,s.useRef)(null),[me,he]=(0,s.useState)(null),ge=(0,s.useRef)(null),_e=(0,s.useRef)(null),ve=(0,s.useRef)(null),ye=(0,s.useRef)(null),be=(0,s.useRef)(null),xe=(0,s.useRef)(null),Se=(0,s.useRef)(null),Ce=(0,s.useId)(),we=(0,s.useId)(),M=e||T,Te=k||A,Ee=(0,s.useMemo)(()=>c_(g,t),[g,t]),De=(0,s.useMemo)(()=>s_(g,y),[g,y]),Oe=(0,s.useMemo)(()=>new Set(De.map(e=>e.key)),[De]),ke=(0,s.useMemo)(()=>new Set(y.filter(e=>!e.enabled).map(e=>e.hostId)),[y]),Ae=h.phase===`ready`&&h.state===`idle`&&x,[je,Me]=(0,s.useState)(()=>Ee),Ne=(0,s.useCallback)((e,t=!1)=>{ee(e),r?.(e),e||(t||Me(Oe.has(Ee)?Ee:`local`),l())},[Oe,l,r,Ee]);(0,s.useEffect)(()=>{e&&(w(!1),ee(!0))},[e]);let Pe=(0,s.useCallback)(e=>{w_(e).then(t=>{e?.aborted||t===null||(b(t),S(!0))})},[]);(0,s.useEffect)(()=>{let e=new AbortController;Pe(e.signal);let t=()=>{Pe()};return window.addEventListener(h_,t),()=>{e.abort(),window.removeEventListener(h_,t)}},[Pe]),(0,s.useEffect)(()=>{C&&Pe()},[C,Pe]),(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;t&&typeof t.hostId==`string`&&typeof t.path==`string`&&pe.current!==null&&t.hostId===pe.current&&(pe.current=null,he({hostId:t.hostId,path:t.path,...typeof t.workspaceId==`string`?{workspaceId:t.workspaceId}:{}}))};return window.addEventListener(g_,e),()=>{window.removeEventListener(g_,e)}},[]);let Fe=(0,s.useRef)(t);(0,s.useEffect)(()=>{if(t!==Fe.current&&(Fe.current=t,t!==void 0)){let e=c_(g,t);Me(Oe.has(e)?e:`local`)}},[Oe,t,g]),(0,s.useEffect)(()=>{t!==void 0&&Ee!==`local`&&Oe.has(Ee)&&Me(e=>e===`local`?Ee:e)},[Oe,t,Ee]);let Ie=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=e=>e!==`local`&&!Oe.has(e)&&(Ae||ke.has(e));e(je)&&Me(`local`),pe.current!==null&&e(pe.current)&&(pe.current=null),me!==null&&e(me.hostId)&&he(null);let n=t===void 0?void 0:g.find(e=>e.workspaceId===t),r=n?.remote!==void 0&&e(n.remote.hostId),a=me!==null&&!e(me.hostId)&&me.workspaceId===t,o=Ae&&t!==void 0&&n===void 0&&!a&&(je!==`local`||t.startsWith(`remote-peer:`));r||o?_&&Ie.current!==t&&(Ie.current=t,i(null)):Ie.current=void 0},[je,Oe,_,ke,Ae,i,me,t,g]);let N=(0,s.useMemo)(()=>De.find(e=>e.key===je)??De[0]??{key:`local`,workspaces:[]},[je,De]);(0,s.useEffect)(()=>{if(me===null)return;let e=p_(g,me);e!==void 0&&(he(null),Me(e.remote?.hostId??`local`),i(e.workspaceId))},[i,me,g]),(0,s.useEffect)(()=>{k&&!v&&oe(!1)},[k,v]);let Le=(0,a.useAnchoredPosition)({open:C,anchorRef:_e,panelRef:ye,side:`bottom`,align:`start`,gap:6,margin:12}),Re=(0,a.useAnchoredPosition)({open:M,anchorRef:ve,panelRef:be,side:`bottom`,align:`start`,gap:6,margin:12});(0,a.useDismissOnOutsidePointer)(ge,C,w,ye),(0,a.useDismissOnOutsidePointer)(ge,M,(0,s.useCallback)(e=>{e||Ne(!1)},[Ne]),be),(0,s.useEffect)(()=>{if(!C)return;D(``),re(-1);let e=requestAnimationFrame(()=>{xe.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[C]),(0,s.useEffect)(()=>{if(!M)return;O(``),ae(-1);let e=requestAnimationFrame(()=>{Se.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[M]),(0,s.useEffect)(()=>{if(!C&&!M)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),C?(w(!1),_e.current?.focus({preventScroll:!0})):M&&(Ne(!1),ve.current?.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[C,M,Ne]);let ze=(0,s.useCallback)(e=>on(e.title,m(`workspace.defaultName`)),[m]),Be=(0,s.useMemo)(()=>l_(De,E,m(`host.thisComputer`)),[De,E,m]),Ve=(0,s.useMemo)(()=>u_(N.workspaces,te,ze),[N.workspaces,te,ze]),He=N.key===`local`&&_&&te.trim()===``,Ue=(0,s.useMemo)(()=>[...He?[{id:v_,workspace:void 0}]:[],...Ve.map(e=>({id:e.workspaceId,workspace:e}))],[Ve,He]);(0,s.useEffect)(()=>{re(e=>Be.length===0?-1:e>=Be.length?0:e)},[Be.length]),(0,s.useEffect)(()=>{ae(e=>Ue.length===0?-1:e>=Ue.length?0:e)},[Ue.length]);let P=De.length>1,We=x_(N,m),Ge=(0,s.useMemo)(()=>t===void 0?void 0:g.find(e=>e.workspaceId===t),[t,g]),Ke=Ge!==void 0&&(Ge.remote?.hostId??`local`)===N.key,qe=Ke&&Ge!==void 0?ze(Ge):t===void 0&&N.key===`local`&&n!==void 0?n:m(`heroPicker.project.choose`),Je=!Ke&&(t!==void 0||N.key!==`local`||n===void 0),Ye=e=>{let t=e.key!==N.key;Me(e.key),w(!1),t&&Ne(!0)},Xe=e=>{pe.current=null,Ne(!1,!0),i(e===v_?null:e)},Ze=(0,s.useCallback)(()=>{pe.current=null,fe.current=j?.open===!0,Ne(!1,!0),le(!1),de(null),oe(!0)},[j?.open,Ne]),Qe=()=>{N.key===`local`?v&&!Te&&Ze():N.hostId?.startsWith(`remote-peer:`)&&N.state===`connected`&&(Ne(!1),pe.current=N.hostId,window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:{hostId:N.hostId}})))},$e=N.key===`local`?v:N.hostId?.startsWith(`remote-peer:`)===!0&&N.state===`connected`,et=()=>{w(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},F=e=>d({path:e}).then(e=>{oe(!1),Me(`local`),i(e.workspaceId)}).catch(e=>{de(e instanceof Error?e.message:String(e)),oe(!1),le(!0)}),tt={open:k,busy:A,onPicked:e=>{se(!0),F(e).finally(()=>{se(!1)})},onCancel:()=>{oe(!1)},onError:e=>{oe(!1),de(e),le(!0)}},nt=e=>{if(Be.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),re(e=>e<0?0:(e+1)%Be.length);else if(e.key===`ArrowUp`)e.preventDefault(),re(e=>e<0?Be.length-1:(e-1+Be.length)%Be.length);else if(e.key===`Enter`){e.preventDefault();let t=Be[ne>=0?ne:0];t!==void 0&&Ye(t)}}},rt=e=>{if(Ue.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),ae(e=>e<0?0:(e+1)%Ue.length);else if(e.key===`ArrowUp`)e.preventDefault(),ae(e=>e<0?Ue.length-1:(e-1+Ue.length)%Ue.length);else if(e.key===`Enter`){e.preventDefault();let t=Ue[ie>=0?ie:0];t!==void 0&&Xe(t.id)}}},it=()=>{le(!1),de(null)};return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:ge,className:$.root,"data-hero-location-picker":``,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:_e,type:`button`,className:R($.trigger,$.triggerLocation,C&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":C,"aria-controls":C?Ce:void 0,"aria-label":m(`heroPicker.location.aria`,{current:We}),disabled:Te,"data-hero-location-trigger":``,onClick:()=>{Ne(!1),w(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(C_,{location:N,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:We})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:ve,type:`button`,className:R($.trigger,$.triggerProject,Je&&$.triggerPlaceholder,M&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":M,"aria-controls":M?we:void 0,"aria-label":m(`heroPicker.project.aria`,{current:qe}),disabled:Te,"data-hero-project-trigger":``,onClick:()=>{w(!1),Ne(!M)},children:[Je?/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:15,className:$.triggerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenOutlineRegular,{size:15,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:qe})]}),C&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:ye,id:Ce,role:`dialog`,"aria-label":m(`heroPicker.location.placeholder`),className:R($.popover,$.popoverLocation),style:Le??{visibility:`hidden`,left:0,top:0},"data-hero-location-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:xe,type:`text`,className:$.searchInput,value:E,placeholder:m(`heroPicker.location.placeholder`),"aria-label":m(`heroPicker.location.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{D(e.target.value),re(e.target.value.trim()===``?-1:0)},onKeyDown:nt})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.location.placeholder`),onMouseLeave:()=>re(-1),children:Be.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:m(`heroPicker.location.empty`)}):Be.map((e,t)=>{let n=e.key===N.key,r=x_(e,m),i=S_(e.state,m);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:R($.row,t===ne&&$.rowActive),onMouseEnter:()=>re(t),onClick:()=>Ye(e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(C_,{location:e})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowMain,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:r})}),i!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowStatus,children:i}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:n&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.key)})}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,onClick:et,children:[P?/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:15,className:$.footerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(P?`heroPicker.location.manageRemote`:`heroPicker.location.connectRemote`)})]})]}),document.body),M&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:be,id:we,role:`dialog`,"aria-label":m(`heroPicker.project.placeholder`),className:R($.popover,$.popoverProject),style:Re??{visibility:`hidden`,left:0,top:0},"data-hero-project-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:Se,type:`text`,className:$.searchInput,value:te,placeholder:m(`heroPicker.project.placeholder`),"aria-label":m(`heroPicker.project.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{O(e.target.value),ae(e.target.value.trim()===``?-1:0)},onKeyDown:rt})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.project.placeholder`),onMouseLeave:()=>ae(-1),children:h.phase===`pending`&&Ue.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,role:`status`,children:m(`picker.loading`)}):Ue.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:te.trim()===``?m(`heroPicker.project.empty`):m(`heroPicker.project.noMatches`)}):Ue.map((e,n)=>{let r=e.workspace===void 0,i=r?t===void 0:e.id===t,s=r?m(`heroPicker.project.noProject`):ze(e.workspace),c=r?void 0:d_(e.workspace.path,s);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,className:R($.row,n===ie&&$.rowActive),title:e.workspace?.path||s,onMouseEnter:()=>ae(n),onClick:()=>Xe(e.id),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:15})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:$.rowMain,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowHint,children:c})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:i&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.id)})}),$e&&/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,disabled:Te,onClick:Qe,children:[/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(`heroPicker.project.new`)})]})]})]}),document.body),p(`conversation.hero.workspace.directoryFlow`,tt),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:fe.current,open:ce,onClose:it,closeLabel:m(`close`),title:m(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.modalAction,onClick:it,children:m(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:$.modalAction,disabled:!v,onClick:Ze,children:m(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.modalError,role:`alert`,children:ue})})]})}let E_=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(E_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=E_,e.textContent=`.s4nt4G_modalAction{min-width:72px}.s4nt4G_modalError,.s4nt4G_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.s4nt4G_modalError{color:var(--dsw-alias-state-error-primary)}.s4nt4G_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var D_={menuStatus:`s4nt4G_menuStatus`,modalAction:`s4nt4G_modalAction`,modalError:`s4nt4G_modalError`};let O_=`::add-workspace`,k_=`::no-workspace`;function A_({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),ee=(0,a.usePhoneSidebar)(),E=(0,s.useRef)(!1),[D,te]=(0,s.useState)(!1),O=w||D;(0,s.useEffect)(()=>{m?.(O)},[O,m]);let ne=c(e=>e);(0,s.useEffect)(()=>{w&&!ne&&T(!1)},[w,ne]);let re=ne?[{id:O_,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16}),disabled:O}]:[],ie=!p&&v.length>0,ae=d!==void 0&&!p,k=ae?[{id:k_,label:e(`menu.noWorkspace`),disabled:O}]:[],oe=ie?[...k,...v.map(t=>({id:t.workspaceId,label:on(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:16}),disabled:O}))]:[...k,...re],A=oe.length===0,se=()=>{x(!1),C(null)},ce=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)}),le=(0,s.useCallback)(()=>{E.current=ee?.open===!0,f(),x(!1),C(null),T(!0)},[f,ee?.open]),ue=p||_.phase===`ready`,de=!ae&&!ie&&ue&&re.length===1;(0,s.useEffect)(()=>{t&&de&&!O&&le()},[t,de,O,le]);let j={open:w,busy:D,onPicked:e=>{te(!0),ce(e).finally(()=>{te(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},fe=e=>{e===k_?d?.():e===O_?le():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:t&&!de&&!A,anchor:null,items:oe,...ie?{footer:re}:{},selectedId:g??(ae?k_:void 0),onSelect:fe,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!de&&!A&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:D_.menuStatus,role:`status`,children:e(`picker.loading`)}),l(j),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:E.current,open:b,onClose:se,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:D_.modalAction,onClick:se,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:D_.modalAction,disabled:!ne,onClick:le,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:D_.modalError,role:`alert`,children:S})})]})}function j_(e){return/* @__PURE__ */ (0,o.jsx)(T_,{...e})}function M_(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 N_(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 P_({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}=ln(),{busy:g,failed:_,save:v}=Xt(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:Z.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:R(Z.iconButton,Z.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:Jt.error,role:`alert`,children:l(`threadTree.style.error`)})})}function F_(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),re(c,t.find(e=>e.blank)?.id)}function I_(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function L_({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.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:Z.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function R_({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:ee,setSessionOrder:D,home:te,t:O,revealSessionId:ne,onSessionRevealed:re,shortcuts:ie,loadMoreSessions:ae,hostScopeFilterControl:k,hostScopeFiltered:oe=!1,singleRemoteHostScoped:A=!1,onResetHostScope:se}){let ce=ln(),le=(0,a.usePhoneSidebar)(),ue=g(e=>e.activePanelId!==null),de=t(e=>e),j=ue?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,fe=(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]),me=ne===void 0||!p?void 0:E(fe,ce.rootId(ne)),[he,_e]=(0,s.useState)({}),[ve,be]=(0,s.useState)(null),we=(0,s.useRef)(!1),[M,Te]=(0,s.useState)(null),Ee=(0,s.useRef)(!1),De=ve!==null||M!==null;N_(De);let Oe=j===void 0||!p?void 0:E(fe,ce.rootId(j)),ke=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of d)for(let n of t.workspaceIds??[])e.has(n)||e.set(n,t.id);return e},[d]),Ae=(0,s.useMemo)(()=>{if(!S)return/* @__PURE__ */ new Map;let e=e=>`${e.remote?.hostId??`local`}\n${ke.get(e.workspaceId)??``}`,t=/* @__PURE__ */ new Map;for(let n of i){let r=e(n),i=t.get(r)??/* @__PURE__ */ new Map;n.path&&i.set(n.path,n.workspaceId),t.set(r,i)}return new Map(i.map(n=>{let r=t.get(e(n)),i=ye(n.path,[...r?.keys()??[]]);return[n.workspaceId,i===void 0?void 0:r?.get(i)]}))},[S,ke,i]),je=(0,s.useMemo)(()=>{let e=new Set(Ae.values());return[...i.map(e=>e.workspaceId),``].filter(t=>C[t]??(t===``||e.has(t)))},[C,Ae,i]),Me=(0,s.useMemo)(()=>{let t=pe(e,i,u,de,{expandedGroups:je,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:je.includes(``),containsCurrent:!1,sessions:[]}),t},[e,i,u,de,je,m]),Ne=Date.now(),Pe=(e,t)=>{if(we.current)return;we.current=!0,be(null);let n=Me.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=kg(n.sessions,he[n.key]??5,j,ne).rows,o=F_(r,a,e,t);o!==void 0&&D(e.accountKey,o)},Fe=(e,t)=>{if(Ee.current||(Ee.current=!0,Te(null),!rn(i,e.workspaceId,t.id)))return;let n=Ae.get(e.workspaceId),r=i.filter(e=>!e.remote&&!ke.has(e.workspaceId)&&Ae.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)})},Ie=(0,s.useMemo)(()=>{let e=new Set(Me.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of Me){let r=Ae.get(n.key);for(;r!==void 0&&!e.has(r);)r=Ae.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[Me,Ae]),N=Ie.get(void 0)??[],Le=N[0]?.workspaceId!==void 0&&M?.over?.id===N[0].workspaceId&&M.over.half===`before`,Re=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of Ie.get(n.key)??[])t(e,r)};for(let e of N)t(e,e.key);return e},[Ie,N]),ze=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[Oe,me]){let n=t===void 0?void 0:Re.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[Oe,me,Re]),[Be,Ve]=(0,s.useState)(!1),He=N.filter(e=>e.key!==``&&!ke.has(e.key)),Ue=(0,s.useMemo)(()=>{let e=new Map(N.map(e=>[e.key,e]));return new Map(d.map(t=>[t.id,(t.workspaceIds??[]).flatMap(n=>{let r=e.get(n);return r!==void 0&&ke.get(n)===t.id?[r]:[]})]))},[d,N,ke]),P=Ag(He,5,ze),We=Be?He:P.rows,Ge=Ce(T,xe),Ke=B_(d,e,u,de,T),qe=Ce(T,Se),Je=e=>{e.expanded&&_e(t=>({...t,[e.key]:5})),w(e.key,!e.expanded)},Ye=ge(e,u.pinnedSessionIds,u,de).filter(e=>e.pinned),Xe=[];if(Ye.length>0&&(Xe.push(`section:${xe}`),Ge))for(let e of ce.rows(Ye))Xe.push(`session:${e.id}`);let Ze=(t,s)=>{let l=t.workspaceId,u=Ie.get(t.key)??[],d=ke.has(t.key),f=M!==null&&!d&&rn(i,M.workspaceId,l)&&Ae.get(M.workspaceId)===Ae.get(t.key),p=kg(t.sessions,he[t.key]??5,j,ne);Xe.push(`workspace:${t.key}`);let h=t.expanded?u.map(e=>Ze(e,s+1)):[],g=ce.rows(p.rows),x=c.get(t.key),S=new Set(x===void 0?[]:p.rows.flatMap(e=>x.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),C=e=>l===void 0?`recent:${e}`:S.has(e)?`linked:${t.key}:${e}`:`session:${e}`;for(let e of g)Xe.push(C(e.id));let T=!t.remote&&e.hasMore,ee=t.expanded&&(p.hiddenCount>0||T);ee&&Xe.push(`overflow:${t.key}`);let E=l!==void 0&&M?.over?.id===l?M.over.half:null,D=l===void 0||t.remote||d?void 0:{start:()=>{Ee.current=!1,Te({workspaceId:l,over:null})},end:()=>{M?.over!==null&&M?.over!==void 0?Fe(M,M.over):Te(null),Ee.current=!1}},k=l===void 0||!f?void 0:e=>{Te(t=>t===null?t:{...t,over:{id:l,half:e}})},oe=l===void 0||!f?void 0:e=>{Fe(M,{id:l,half:e})};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${s*12}px`},className:R(Z.groupSection,E===`before`&&Z.workspaceDropBefore,E===`after`&&Z.workspaceDropAfter),onDragOver:M===null?void 0:e=>{e.preventDefault(),(k!==void 0||Ae.get(t.key)===void 0)&&(e.stopPropagation(),k===void 0?(e.dataTransfer.dropEffect=`none`,M.over!==null&&Te({...M,over:null})):(e.dataTransfer.dropEffect=`move`,k(I_(e))))},onDrop:M===null?void 0:e=>{e.preventDefault(),(oe!==void 0||Ae.get(t.key)===void 0)&&(e.stopPropagation(),oe===void 0?(Ee.current=!0,Te(null)):oe(I_(e)))},children:[l===void 0?/* @__PURE__ */ (0,o.jsx)(Cg,{label:O(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{Je(t)},rowKey:`workspace:${t.key}`,action:m?{label:O(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{w(t.key,!0),le?.close(),n()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(lg,{newShortcut:ie.find(e=>e.id===`session.new`),group:t,showHost:!A,home:te,t:O,onToggle:()=>{Je(t)},onCreate:()=>{t.workspaceId!==void 0&&(w(t.key,t.expanded),le?.close(),n(t.workspaceId))},drag:D,actions:t.workspaceId===void 0?void 0:{rename:()=>{
|
|
123
|
+
x(!1),(e===`rename`||e===`delete`)&&(e===`rename`?h.rename():h.delete())},portal:!0,autoFocus:!0,getAnchorRect:S===null?void 0:()=>S,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:F.iconButton,"aria-label":f(`actions.workspace.aria`,{name:_}),"aria-haspopup":`menu`,"aria-expanded":b,onClick:e=>{e.stopPropagation(),C(null),x(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})})}),(!p.remote||p.remote.state===`connected`&&!!e.cwd)&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:f(`actions.newSession`),shortcutKeys:d?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:F.iconButton,"aria-keyshortcuts":d?.aria,"aria-label":f(`actions.newSession.aria`,{name:_}),onClick:e=>{e.stopPropagation(),r()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{})})})]})]}),w=p.cwd!==void 0&&p.cwd!==``?p.cwd:void 0;return p.workspaceId===void 0||w===void 0&&p.createdAt===void 0?ne:/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:ne,content:/* @__PURE__ */ (0,o.jsx)(Sg,{label:p.label,cwd:w===void 0?void 0:ee(w,u),createdAt:p.createdAt,t:f}),openDelayMs:800,disabled:b,copyText:w,copyLabel:f(`copy`),copiedLabel:f(`hover.copied`)})}function Eg({node:e,now:t,renderSlot:n,t:r}){let i=rt(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`),s=e.remote===void 0?void 0:fm(e.remote.hostId,e.remote.color),c=e.remote?.state===`connected`?r(`host.connected`):e.remote?.state===`connecting`?r(`host.connecting`):r(`host.disconnected`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTitle,children:vg(e,r)}),e.remote&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.hoverHost,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.hoverHostDot,"data-color":s,"data-state":e.remote.state,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:`${e.remote.displayName} · ${c}`})]}),e.cwd&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.hoverTime,children:bg(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:F.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:R(F.hoverStatus,F.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`row.archived`)})]})]})}function Dg({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let s=e.id===t,c=rt(e,i),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(F.searchResultRow,s&&F.selected,e.archived&&F.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:F.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.searchResultTitle,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.titleText,children:e.title||i(`session.untitled`)})}),e.remote&&/* @__PURE__ */ (0,o.jsx)(eg,{host:e.remote,variant:`session`,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(at,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.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:F.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:F.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.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:F.searchResultSnippet,children:e.snippet})]})]})}function Og({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}=pn(),y=mg(),ee=e.tree?.depth??0,b=h[e.id]===!0,x=ee===0?d:void 0,S=vg(e,p),C=e.id===n,ne=rt(e,p),w=ne[0],T=!m.archived&&w.state!==`idle`,E=m.remote===void 0?void 0:fm(m.remote.hostId,m.remote.color),D=f&&m.remote!==void 0&&E!==void 0,O=x!==void 0&&!m.blank&&!m.archived,k=m.blank?void 0:m.reference,re=O||k!==void 0,ie=(0,s.useRef)(!1),[ae,A]=(0,s.useState)(!1),[j,oe]=(0,s.useState)(null),se=(0,s.useMemo)(()=>[ae,A],[ae]),ce=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(ce.current?.scrollIntoView({block:`nearest`}),u())},[u]);let le=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:ce,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":ee,"data-thread-sortable":String(O),"data-thread-pinned":String(e.pinned),style:{"--dsh-thread-indent":`${Math.min(ee,3)*24}px`},className:R(F.sessionRow,C&&F.selected,ae&&F.menuOpen,m.archived&&F.archived,x?.marker===`before`&&F.dropBefore,x?.marker===`after`&&F.dropAfter),role:`treeitem`,"aria-selected":C,"aria-current":C?`page`:void 0,"aria-level":ee+1,"aria-expanded":e.tree?.descendantCount?b:void 0,tabIndex:-1,onContextMenu:e=>{m.blank||e.target.closest(`button`)||(e.preventDefault(),oe(new DOMRect(e.clientX,e.clientY,0,0)),A(!0))},onKeyDown:t=>{t.target!==t.currentTarget||m.blank||(ie.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),oe(null),A(!0)):t.key===`F2`&&!m.archived&&(t.preventDefault(),c(e.id,m.title)))},"aria-description":m.archived?p(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{ie.current=!1},onClick:()=>{ie.current||(C&&!m.archived&&e.tree?.descendantCount?(b&&_(e.tree.descendantIds),g(e.id,!b,y)):i(e.id))},draggable:re,onDragStart:re?t=>{ie.current=!0,t.dataTransfer.effectAllowed=k===void 0?`move`:O?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,k===void 0?e.id:te(k).clipboardText),k!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(k)),O&&x?.start()}:void 0,onDragEnd:re?e=>x?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:x===void 0?void 0:e=>{x.active&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,x.hover(Cg(e)))},onDrop:x===void 0?void 0:e=>{x.active&&(e.preventDefault(),x.drop(Cg(e)))},children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.sessionMain,children:/* @__PURE__ */ (0,o.jsx)($h,{identityLabel:e.tree?.descendantCount?!b&&v===`ring`?p(`threadTree.expandSummary`,{title:S,summary:ag(e.tree.descendantCount,e.tree.activity,p)}):p(b?`threadTree.collapse`:`threadTree.expand`,{n:e.tree.descendantCount}):void 0,identityExpanded:e.tree?.descendantCount?b:void 0,identityControls:y,identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[l(`sidebar.session.row.identity`,{sessionId:e.id}),!b&&v===`ring`&&!!e.tree?.descendantCount&&/* @__PURE__ */ (0,o.jsx)(lg,{activity:e.tree.activity}),D&&m.remote&&E!==void 0&&/* @__PURE__ */ (0,o.jsx)(wg,{color:E,state:m.remote.state,className:F.remoteSessionGlobe})]}),ambient:!m.archived&&!m.blank&&!T&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:S,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),g(e.id,!b,y)}:void 0,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.trailing,children:[!m.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(F.time,T&&F.timeStatus),"data-session-status":T?w.state:void 0,children:T?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(at,{statuses:ne}),w.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:w.trailingLabel})]}):yg(m.updatedAt,r,p)}),!m.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:F.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:ae,onClose:()=>{A(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:S,phoneSidebarFooterBackLabel:p(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:F.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(Eg,{node:e,now:r,renderSlot:l,t:p})}),getAnchorRect:j===null?void 0:()=>j,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:F.iconButton,"aria-label":p(`actions.session.aria`,{name:S}),"aria-haspopup":`menu`,"aria-expanded":ae,onClick:()=>{oe(null),A(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:ee>0},{hookContext:se})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:F.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:m.title,threadTreeChild:ee>0})})]})]})})}),!b&&v===`summary`&&/* @__PURE__ */ (0,o.jsx)(_g,{node:e,title:S,toggle:()=>g(e.id,!0,y),t:p})]});return/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:le,content:/* @__PURE__ */ (0,o.jsx)(Eg,{node:e,now:r,renderSlot:l,t:p}),openDelayMs:800,disabled:ae||x?.active===!0,copyText:m.blank||m.title===``?void 0:m.title,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}let kg=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(kg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=kg,e.textContent=`.Jek-Ha_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var Ag={exits:`Jek-Ha_exits`};function jg(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function Mg(e){if(!e)return;let t=jg(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){let t=e===r?0:-1;(!e.hasAttribute(`tabindex`)||e.tabIndex!==t)&&(e.tabIndex=t)}}function Ng(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=jg(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`}),Mg(t))}function Pg(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function Fg(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var Ig=class extends s.Component{armed=!1;list=(0,s.createRef)();overlay=(0,s.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;componentDidMount(){Mg(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||Pg(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)||!Fg(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(Mg(this.list.current),n===null){(!Pg(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(!Fg(t.rect,a)&&(r===void 0||!Fg(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:Ng,onFocusCapture:()=>Mg(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:Ag.exits,"aria-hidden":`true`})]})}};let Lg=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Lg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Lg,e.textContent=`.Z54rEq_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}.Z54rEq_heading[data-row-key]{cursor:pointer}.Z54rEq_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.Z54rEq_heading[data-row-key]:focus-visible,.Z54rEq_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.Z54rEq_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.Z54rEq_chevron,.Z54rEq_collapsed{flex-shrink:0}.Z54rEq_collapsed{transform:rotate(-90deg)}.Z54rEq_trailing{align-items:center;min-width:0;margin-inline-start:auto;display:inline-flex}.Z54rEq_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}.Z54rEq_actionAfterTrailing{margin-inline-start:0}.Z54rEq_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (pointer:coarse){.Z54rEq_heading{min-height:44px}.Z54rEq_action{width:44px;height:44px}}`,document.head.appendChild(e)}var Rg={action:`Z54rEq_action`,actionAfterTrailing:`Z54rEq_actionAfterTrailing`,chevron:`Z54rEq_chevron`,collapsed:`Z54rEq_collapsed`,heading:`Z54rEq_heading`,title:`Z54rEq_title`,trailing:`Z54rEq_trailing`};function zg({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,trailing:s,action:c}){let l=n!==void 0&&r!==void 0&&i!==void 0,u=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:Rg.title,children:e}),l&&/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{className:n?Rg.chevron:Rg.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Rg.trailing,onClick:e=>{e.stopPropagation()},children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:c.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:R(Rg.action,s!==void 0&&Rg.actionAfterTrailing),"aria-label":c.label,onClick:e=>{e.stopPropagation(),c.onActivate()},children:c.icon})})]});return l?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Rg.heading,role:`treeitem`,tabIndex:-1,"data-row-key":i,"aria-label":e,"aria-expanded":n,onClick:r,children:u}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Rg.heading,children:u})}let Bg=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Bg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Bg,e.textContent=`.t4p6JG_section{margin-bottom:8px}.t4p6JG_section>*+[data-thread-branch]{margin-top:2px}`,document.head.appendChild(e)}var Vg={section:`t4p6JG_section`};function Hg({rows:e,customSection:t,currentId:n,onOpen:r,onRenameRequest:i,renderSlot:s,t:c,revealSessionId:l,onSessionRevealed:u,showHost:d=!0,expanded:f,onToggle:p,children:m}){if(e.length===0&&!t)return null;let h=t?.name??c(`section.pinned`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":h,className:Vg.section,"data-sidebar-pinned":!t||void 0,children:[/* @__PURE__ */ (0,o.jsx)(zg,{label:h,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:14}),expanded:f,onToggle:p,rowKey:`section:${t?.key??`pinned`}`}),f&&/* @__PURE__ */ (0,o.jsx)(hg,{roots:e,children:e=>/* @__PURE__ */ (0,o.jsx)(Og,{node:e,showHost:d,currentId:n,now:Date.now(),onOpen:r,onRenameRequest:i,renderSlot:s,onReveal:e.id===l?()=>u(e.id):void 0,t:c},e.id)}),f&&m]})}let Ug=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ug)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ug,e.textContent=`._14DcuW_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] ._14DcuW_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] ._14DcuW_list{scrollbar-gutter:auto}._14DcuW_root._14DcuW_rail{padding-right:0}._14DcuW_iconButton{corner-shape:round;cursor:pointer;width:28px;height:28px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 82%, transparent);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:background-color .14s,color .14s;display:inline-flex}._14DcuW_iconButton:focus-visible,._14DcuW_searchButton:focus-visible,._14DcuW_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._14DcuW_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}._14DcuW_viewOptionsMenu{min-width:200px}._14DcuW_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}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{margin-top:2px;margin-bottom:4px;margin-right:-4px}._14DcuW_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}._14DcuW_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}._14DcuW_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}._14DcuW_searchSlotExpanded{max-width:100%;padding-left:0}._14DcuW_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}._14DcuW_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}._14DcuW_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}._14DcuW_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}._14DcuW_searchButton{corner-shape:round;cursor:pointer;width:28px;height:28px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 82%, transparent);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:background-color .14s,color .14s;display:inline-flex}._14DcuW_searchExpanded ._14DcuW_searchButton{width:28px;height:30px}._14DcuW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}._14DcuW_searchExpanded ._14DcuW_searchButton:hover{background:0 0}._14DcuW_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}._14DcuW_searchExpanded ._14DcuW_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}._14DcuW_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}._14DcuW_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}._14DcuW_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_rail ._14DcuW_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}._14DcuW_rail ._14DcuW_headerActions{max-width:none}._14DcuW_rail ._14DcuW_iconButton{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_rail ._14DcuW_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}._14DcuW_rail ._14DcuW_searchButton{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_rail ._14DcuW_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_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;position:relative;overflow:visible}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea{padding-top:6px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{content:"";top:0;left:calc(4px - var(--dsh-sidebar-inline-padding));background:color-mix(in srgb, var(--dsw-alias-border-l3) 38%, transparent);pointer-events:none;height:1px;position:absolute;right:0}body[data-ds-dark-theme] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 34%, transparent)}@media (resolution>=2x){._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 56%, transparent);transform-origin:top;transform:scaleY(.5)}body[data-ds-dark-theme] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 48%, transparent)}}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{left:4px;right:var(--dsh-session-list-edge-inset)}._14DcuW_rail ._14DcuW_listArea{margin-left:0;margin-right:0;padding-left:0}._14DcuW_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}._14DcuW_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]:not([data-tauri-shell]) ._14DcuW_fade,[data-phone-drawer] ._14DcuW_fade,body[data-codexhost-wallpaper] ._14DcuW_fade{display:none}._14DcuW_wide{animation:_14DcuW_wide-in .2s var(--ds-ease-in-out)}@keyframes _14DcuW_wide-in{0%{opacity:0}}._14DcuW_list{overscroll-behavior-y:contain;--dsh-scrollbar-width:var(--dsh-session-list-scrollbar-width);--dsh-scrollbar-track-margin:6px;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}._14DcuW_flatList>*+*,._14DcuW_searchTree>[role=treeitem]+[role=treeitem],._14DcuW_groupSection>*+*,._14DcuW_groupSessions>*+*{margin-top:2px}._14DcuW_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}._14DcuW_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}._14DcuW_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}._14DcuW_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}._14DcuW_skeletonDot,._14DcuW_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite _14DcuW_search-skeleton}._14DcuW_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}._14DcuW_skeletonBarWide{width:90%;height:13px}@keyframes _14DcuW_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}._14DcuW_groupSection{position:relative}._14DcuW_groupSection+._14DcuW_groupSection{margin-top:4px}._14DcuW_listTopDropIndicator,._14DcuW_workspaceDropBefore:before,._14DcuW_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}._14DcuW_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}._14DcuW_listTopDropActive>._14DcuW_workspaceDropBefore:first-child:before{display:none}._14DcuW_workspaceDropBefore:before{top:-8px}._14DcuW_workspaceDropAfter:after{bottom:-8px}._14DcuW_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}._14DcuW_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}._14DcuW_groupSessions>._14DcuW_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}@media (hover:hover){._14DcuW_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}._14DcuW_sessionOverflowButton:active{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}._14DcuW_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){._14DcuW_sessionOverflowButton,._14DcuW_root:not(._14DcuW_rail) ._14DcuW_iconButton{min-height:44px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{height:44px}._14DcuW_searchInput,._14DcuW_renameInput{font-size:16px}}._14DcuW_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}._14DcuW_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}._14DcuW_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}._14DcuW_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}._14DcuW_filterEmptyHint{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:flex-start;gap:4px;padding:10px 12px;font-size:12px;line-height:18px;display:flex}._14DcuW_filterEmptyHint ._14DcuW_emptyAction{font-size:12px;line-height:18px}._14DcuW_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}._14DcuW_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}._14DcuW_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}._14DcuW_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}._14DcuW_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._14DcuW_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}._14DcuW_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){._14DcuW_wide,._14DcuW_skeletonDot,._14DcuW_skeletonBar{animation:none}._14DcuW_search,._14DcuW_sectionLabel,._14DcuW_searchSlot,._14DcuW_searchInput,._14DcuW_headerActions{transition:none}}`,document.head.appendChild(e)}var Z={archiveActivity:`_14DcuW_archiveActivity`,clearButton:`_14DcuW_clearButton`,deleteAction:`_14DcuW_deleteAction`,deleteStatus:`_14DcuW_deleteStatus`,empty:`_14DcuW_empty`,emptyAction:`_14DcuW_emptyAction`,emptyState:`_14DcuW_emptyState`,fade:`_14DcuW_fade`,filterEmptyHint:`_14DcuW_filterEmptyHint`,flatList:`_14DcuW_flatList`,groupSection:`_14DcuW_groupSection`,groupSessions:`_14DcuW_groupSessions`,headerActions:`_14DcuW_headerActions`,headerActionsHidden:`_14DcuW_headerActionsHidden`,iconButton:`_14DcuW_iconButton`,list:`_14DcuW_list`,listArea:`_14DcuW_listArea`,listTopDropActive:`_14DcuW_listTopDropActive`,listTopDropIndicator:`_14DcuW_listTopDropIndicator`,rail:`_14DcuW_rail`,renameError:`_14DcuW_renameError`,renameInput:`_14DcuW_renameInput`,root:`_14DcuW_root`,search:`_14DcuW_search`,"search-skeleton":`_14DcuW_search-skeleton`,searchButton:`_14DcuW_searchButton`,searchExpanded:`_14DcuW_searchExpanded`,searchInput:`_14DcuW_searchInput`,searchSlot:`_14DcuW_searchSlot`,searchSlotExpanded:`_14DcuW_searchSlotExpanded`,searchStatus:`_14DcuW_searchStatus`,searchTree:`_14DcuW_searchTree`,sectionHeader:`_14DcuW_sectionHeader`,sectionLabel:`_14DcuW_sectionLabel`,sectionLabelHidden:`_14DcuW_sectionLabelHidden`,sessionOverflowButton:`_14DcuW_sessionOverflowButton`,skeletonBar:`_14DcuW_skeletonBar`,skeletonBarWide:`_14DcuW_skeletonBarWide`,skeletonBars:`_14DcuW_skeletonBars`,skeletonDot:`_14DcuW_skeletonDot`,skeletonRow:`_14DcuW_skeletonRow`,treeBody:`_14DcuW_treeBody`,viewOptionsMenu:`_14DcuW_viewOptionsMenu`,wide:`_14DcuW_wide`,"wide-in":`_14DcuW_wide-in`,workspaceDropAfter:`_14DcuW_workspaceDropAfter`,workspaceDropBefore:`_14DcuW_workspaceDropBefore`};function Wg({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:Z.sessionOverflowButton,disabled:e.loading,onClick:()=>{e.listErrorPage===`more`?n(e.listErrorWorkspaceId??void 0):t()},children:r(`sessions.retry`)})]}):null}function Gg(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 Kg(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function qg({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:Z.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 Jg=`codexhost.sidebar.hostScopeFilter.v1`,Yg=`codexhost:apply-host-scope-workspace-selection`;function Xg(e){return e.some(e=>e.remote!==void 0)}function Zg(e){return e.some(e=>e.remote?.hostId.startsWith(`remote-peer:`)===!0)}function Qg(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.remote;if(e===void 0){t.push(r);continue}let i=n.get(e.hostId);i===void 0?n.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.displayName,state:e.state,...e.color===void 0?{}:{color:e.color},workspaceCount:1,workspaces:[r]}):(i.workspaces.push(r),i.workspaceCount+=1,i.color===void 0&&e.color!==void 0&&(i.color=e.color))}return t.length===0&&n.size===0?[]:[{key:`local`,workspaceCount:t.length,workspaces:t},...n.values()]}function $g(e,t){return e.selectedHost===`all`||Qg(t).some(t=>t.key===e.selectedHost)?e:{...e,selectedHost:`all`}}function e_(e,t,n){let r=Qg(t),i=new Map(r.map(e=>[e.key,e])),a=n?.preserveHostKeys,o=e.selectedHost!==`all`&&e.selectedHost!==`local`&&!i.has(e.selectedHost)?`all`:e.selectedHost,s=o!==e.selectedHost,c={};for(let[t,n]of Object.entries(e.perHost)){let e=i.get(t);if(e===void 0){if(t!==`local`){a?.has(t)===!0?c[t]=n:s=!0;continue}n.workspaceIds.length>0?(s=!0,c[t]={mode:n.mode,workspaceIds:[]}):c[t]=n;continue}if(t!==`local`&&(e.state===`connecting`||e.state!==`connected`&&a?.has(t)===!0)){c[t]=n;continue}let r=new Set(e.workspaces.map(e=>e.workspaceId)),o=n.workspaceIds.filter(e=>r.has(e));o.length===n.workspaceIds.length?c[t]=n:(s=!0,c[t]={mode:n.mode,workspaceIds:o})}return s?{selectedHost:o,perHost:c}:e}function t_(e,t){let n=$g(e,t);return n.selectedHost!==`all`||Qg(t).some(e=>n.perHost[e.key]?.mode===`selected`)}function n_(e,t){let n=$g(t,e);return e.filter(e=>{let t=e.remote?.hostId??`local`;if(n.selectedHost===`local`){if(e.remote!==void 0)return!1}else if(n.selectedHost!==`all`&&e.remote?.hostId!==n.selectedHost)return!1;let r=n.perHost[t];return r?.mode!==`selected`||r.workspaceIds.includes(e.workspaceId)})}function r_(e){return typeof e==`string`?e:e.id}function i_(e){return typeof e!=`string`&&(e.remote??e.projectionValues?.remoteHost??null)!==null}function a_(e,t,n,r,i){let a=$g(r,n);if(!t_(a,n))return[...e];let o=t instanceof Set?t:new Set(t),s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set;for(let e of n){let t=o.has(e.workspaceId);for(let n of e.sessionIds)s.add(n),t&&c.add(n)}let l=(a.selectedHost===`all`||a.selectedHost===`local`)&&a.perHost.local?.mode!==`selected`;return e.filter(e=>{let t=r_(e),n=i?.get(t)??t;return c.has(n)?!0:!s.has(n)&&!i_(e)&&l})}function o_(e,t){if(t===void 0||t.mode!==`selected`)return e.workspaceCount;let n=new Set(t.workspaceIds),r=0;for(let t of e.workspaces)n.has(t.workspaceId)&&(r+=1);return r}function s_(e,t){return e.selectedHost===t?e:{...e,selectedHost:t}}function c_(e,t,n,r){let i=e.perHost[t],a=n===`selected`?i===void 0?[...new Set(r)]:[...i.workspaceIds]:i===void 0?[]:[...i.workspaceIds];return{...e,perHost:{...e.perHost,[t]:{mode:n,workspaceIds:a}}}}function l_(e,t,n,r){let i=e.perHost[t],a=i?.mode===`selected`?i.workspaceIds:[...r],o=a.includes(n)?a.filter(e=>e!==n):[...a,n];return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:o}}}}function u_(e,t,n){return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:[...new Set(n)]}}}}function d_(){return{selectedHost:`all`,perHost:{}}}function f_(e,t,n){let r=$g(e,n),i=t?.remote?.hostId??`local`,a=r.selectedHost,o=r.perHost,s=!1;a!==`all`&&a!==i&&(a=`all`,s=!0);let c=o[i];return c?.mode===`selected`&&(t===void 0?(o={...o,[i]:{...c,mode:`all`}},s=!0):c.workspaceIds.includes(t.workspaceId)||(o={...o,[i]:{mode:`selected`,workspaceIds:[...c.workspaceIds,t.workspaceId]}},s=!0)),s?{selectedHost:a,perHost:o}:e}function p_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m_(e){if(e===null||e===``)return d_();try{let t=JSON.parse(e);if(!p_(t))return d_();let n=typeof t.selectedHost==`string`&&t.selectedHost.trim()!==``?t.selectedHost:`all`,r={};if(p_(t.perHost))for(let[e,n]of Object.entries(t.perHost)){if(e===``||!p_(n)||n.mode!==`all`&&n.mode!==`selected`)continue;let t=Array.isArray(n.workspaceIds)?[...new Set(n.workspaceIds.filter(e=>typeof e==`string`))]:[];r[e]={mode:n.mode,workspaceIds:t}}return{selectedHost:n,perHost:r}}catch{return d_()}}function h_(e){try{let t=e===void 0?typeof window<`u`?window.localStorage:null:e;return t===null?d_():m_(t.getItem(Jg))}catch{return d_()}}function g_(e,t){try{let n=t===void 0?typeof window<`u`?window.localStorage:null:t;if(n===null)return;n.setItem(Jg,JSON.stringify(e))}catch{}}let __=`@deepseek-ai/dsh-client-ui-workspace/HostScopeFilter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(__)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=__,e.textContent=`.jFA5LW_tabBarRow{border-bottom:1px solid var(--dsw-alias-border-l2,#80808024);flex:none;align-items:flex-end;gap:6px;margin:0 4px 6px;display:flex}.jFA5LW_tabBar{scrollbar-width:none;flex:1;align-items:center;gap:12px;min-width:0;padding:0;display:flex;overflow:auto hidden}.jFA5LW_tabBar::-webkit-scrollbar{display:none}.jFA5LW_tabTrailing{flex:none;align-items:center;padding-bottom:3px;display:inline-flex}.jFA5LW_tabItem{max-width:136px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:0;flex:none;align-items:center;gap:5px;padding:3px 1px 7px;font-size:12.5px;font-weight:500;line-height:16px;display:inline-flex;position:relative}.jFA5LW_tabItem:hover{color:var(--dsw-alias-label-primary)}.jFA5LW_tabItemActive{color:var(--dsw-alias-label-primary);font-weight:600}.jFA5LW_tabItemActive:after{content:"";background:var(--dsw-alias-label-primary);border-radius:2px;height:1.5px;position:absolute;bottom:0;left:0;right:0}.jFA5LW_tabItem:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px;border-radius:4px}.jFA5LW_iconTrigger{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}.jFA5LW_iconTrigger:hover,.jFA5LW_iconTriggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_iconTriggerActive{color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent)}.jFA5LW_iconTriggerActive:hover,.jFA5LW_iconTriggerActive.jFA5LW_iconTriggerOpen{color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent)}.jFA5LW_iconTrigger:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_iconTriggerPip{background:var(--dsw-alias-state-business-primary);border-radius:50%;width:5px;height:5px;position:absolute;top:3px;right:3px}.jFA5LW_tabLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_tabDot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:5px;height:5px}.jFA5LW_anchorRoot{align-items:center;min-width:0;display:inline-flex;position:relative}.jFA5LW_trigger{max-width:128px;height:22px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;align-items:center;gap:4px;padding:0 6px;font-size:11.5px;font-weight:500;line-height:16px;display:inline-flex}.jFA5LW_trigger:hover,.jFA5LW_triggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_triggerActive{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_triggerActive:hover,.jFA5LW_triggerActive.jFA5LW_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_trigger:focus-visible,.jFA5LW_hostRow:focus-visible,.jFA5LW_segmentButton:focus-visible,.jFA5LW_perHostTrigger:focus-visible,.jFA5LW_footerAction:focus-visible,.jFA5LW_resetLink:focus-visible,.jFA5LW_miniLink:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_triggerChevron{opacity:.65;flex:none}.jFA5LW_dot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.5;border-radius:50%;flex:none;width:6px;height:6px}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#3b76cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#7460cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#2f8c70}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#c27803}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#c94a6a}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#94a3b8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.9}.jFA5LW_popover{z-index:1100;box-sizing:border-box;width:min(260px,100vw - 24px);max-height:calc(100vh - 24px - max(12px, var(--dsh-frame-overlay-top,12px)));--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border:0;flex-direction:column;padding:5px;display:flex;position:fixed}.jFA5LW_scrollArea{flex-direction:column;flex:1;gap:2px;min-height:0;display:flex;overflow-y:auto}.jFA5LW_section{flex-direction:column;gap:1px;display:flex}.jFA5LW_sectionTitleRow{justify-content:space-between;align-items:center;gap:8px;padding:4px 7px 3px;display:flex}.jFA5LW_sectionTitle{letter-spacing:.01em;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:500;line-height:14px}.jFA5LW_resetLink,.jFA5LW_miniLink{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:1px 4px;font-size:11px;line-height:15px;transition:background-color .1s,color .1s}.jFA5LW_resetLink:hover:not(:disabled),.jFA5LW_miniLink:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_miniLink:disabled{opacity:.35;cursor:default}.jFA5LW_hostList{flex-direction:column;gap:1px;display:flex}.jFA5LW_hostRow{width:100%;min-height:28px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s;display:flex}.jFA5LW_hostRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_hostRowSelected{background:color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);font-weight:500}.jFA5LW_hostName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_hostCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_hostCountFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_checkSlot{width:14px;height:14px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.jFA5LW_divider{background:var(--dsw-alias-border-l2);height:1px;margin:4px 3px}.jFA5LW_scopeEditor{flex-direction:column;gap:6px;padding:2px 4px 4px;display:flex}.jFA5LW_segmented{background:var(--dsw-alias-interactive-bg-hover);border-radius:7px;grid-template-columns:1fr 1fr;gap:2px;padding:2px;display:grid}.jFA5LW_segmentButton{box-sizing:border-box;height:24px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;text-overflow:ellipsis;cursor:pointer;background:0 0;border:none;border-radius:5px;padding:0 7px;font-size:11.5px;font-weight:500;line-height:16px;transition:color .1s;overflow:hidden}.jFA5LW_segmentButton:hover:not(.jFA5LW_segmentActive){color:var(--dsw-alias-label-primary)}.jFA5LW_segmentActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-soft)}.jFA5LW_workspacePicker{flex-direction:column;gap:3px;display:flex}.jFA5LW_workspacePickerBar{justify-content:space-between;align-items:center;gap:6px;padding:0 3px;display:flex}.jFA5LW_workspacePickerCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:15px}.jFA5LW_workspacePickerActions{align-items:center;gap:2px;display:inline-flex}.jFA5LW_workspaceList{flex-direction:column;gap:1px;max-height:160px;display:flex;overflow-y:auto}.jFA5LW_workspaceOption{min-height:25px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:5px;align-items:center;gap:7px;padding:2px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_workspaceOption:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_workspaceCheckbox{width:13px;height:13px;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));cursor:pointer;flex:none;margin:0}.jFA5LW_workspaceOptionName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_noWorkspaces{color:var(--dsw-alias-label-tertiary);padding:6px;font-size:11.5px;line-height:16px}.jFA5LW_allHostsScopeList{flex-direction:column;gap:1px;display:flex}.jFA5LW_perHostAccordion{border-radius:6px;flex-direction:column;display:flex}.jFA5LW_perHostTrigger{width:100%;min-height:27px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;padding:3px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_perHostTrigger:hover,.jFA5LW_perHostTriggerOpen{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_accordionIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_scopeSummaryTag{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_scopeSummaryTagFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_perHostBody{padding:3px 2px 2px 10px}.jFA5LW_footer{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;flex:none;gap:1px;margin-top:4px;padding-top:4px;display:flex}.jFA5LW_footerAction{width:100%;min-height:28px;color:var(--dsw-alias-label-secondary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s,color .1s;display:flex}.jFA5LW_footerAction:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_footerIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_footerAction:hover .jFA5LW_footerIcon{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.jFA5LW_trigger{min-height:32px;padding:0 8px}.jFA5LW_hostRow,.jFA5LW_footerAction{min-height:38px}.jFA5LW_workspaceOption{min-height:34px}}@media (prefers-reduced-motion:reduce){.jFA5LW_trigger,.jFA5LW_hostRow,.jFA5LW_footerAction{transition:none}}`,document.head.appendChild(e)}var Q={accordionIcon:`jFA5LW_accordionIcon`,allHostsScopeList:`jFA5LW_allHostsScopeList`,anchorRoot:`jFA5LW_anchorRoot`,checkSlot:`jFA5LW_checkSlot`,divider:`jFA5LW_divider`,dot:`jFA5LW_dot`,footer:`jFA5LW_footer`,footerAction:`jFA5LW_footerAction`,footerIcon:`jFA5LW_footerIcon`,hostCount:`jFA5LW_hostCount`,hostCountFiltered:`jFA5LW_hostCountFiltered`,hostList:`jFA5LW_hostList`,hostName:`jFA5LW_hostName`,hostRow:`jFA5LW_hostRow`,hostRowSelected:`jFA5LW_hostRowSelected`,iconTrigger:`jFA5LW_iconTrigger`,iconTriggerActive:`jFA5LW_iconTriggerActive`,iconTriggerOpen:`jFA5LW_iconTriggerOpen`,iconTriggerPip:`jFA5LW_iconTriggerPip`,miniLink:`jFA5LW_miniLink`,noWorkspaces:`jFA5LW_noWorkspaces`,perHostAccordion:`jFA5LW_perHostAccordion`,perHostBody:`jFA5LW_perHostBody`,perHostTrigger:`jFA5LW_perHostTrigger`,perHostTriggerOpen:`jFA5LW_perHostTriggerOpen`,popover:`jFA5LW_popover`,resetLink:`jFA5LW_resetLink`,scopeEditor:`jFA5LW_scopeEditor`,scopeSummaryTag:`jFA5LW_scopeSummaryTag`,scopeSummaryTagFiltered:`jFA5LW_scopeSummaryTagFiltered`,scrollArea:`jFA5LW_scrollArea`,section:`jFA5LW_section`,sectionTitle:`jFA5LW_sectionTitle`,sectionTitleRow:`jFA5LW_sectionTitleRow`,segmentActive:`jFA5LW_segmentActive`,segmentButton:`jFA5LW_segmentButton`,segmented:`jFA5LW_segmented`,tabBar:`jFA5LW_tabBar`,tabBarRow:`jFA5LW_tabBarRow`,tabDot:`jFA5LW_tabDot`,tabItem:`jFA5LW_tabItem`,tabItemActive:`jFA5LW_tabItemActive`,tabLabel:`jFA5LW_tabLabel`,tabTrailing:`jFA5LW_tabTrailing`,trigger:`jFA5LW_trigger`,triggerActive:`jFA5LW_triggerActive`,triggerChevron:`jFA5LW_triggerChevron`,triggerLabel:`jFA5LW_triggerLabel`,triggerOpen:`jFA5LW_triggerOpen`,workspaceCheckbox:`jFA5LW_workspaceCheckbox`,workspaceList:`jFA5LW_workspaceList`,workspaceOption:`jFA5LW_workspaceOption`,workspaceOptionName:`jFA5LW_workspaceOptionName`,workspacePicker:`jFA5LW_workspacePicker`,workspacePickerActions:`jFA5LW_workspacePickerActions`,workspacePickerBar:`jFA5LW_workspacePickerBar`,workspacePickerCount:`jFA5LW_workspacePickerCount`};function v_(e,t){return e.key===`local`?t(`host.local`):e.displayName||e.hostId||e.key}function y_(e,t){return t(e===`connected`?`host.connected`:e===`connecting`?`host.connecting`:`host.disconnected`)}function b_({host:e,state:t,onChange:n,t:r}){let i=t.perHost[e.key],a=i?.mode===`selected`?`selected`:`all`,c=(0,s.useMemo)(()=>new Set(i?.mode===`selected`?i.workspaceIds:[]),[i]),l=(0,s.useMemo)(()=>e.workspaces.map(e=>e.workspaceId),[e.workspaces]),u=o_(e,i);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scopeEditor,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.segmented,role:`tablist`,"aria-label":r(`hostScope.scope.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`all`,className:R(Q.segmentButton,a===`all`&&Q.segmentActive),onClick:()=>{n(c_(t,e.key,`all`,l))},children:r(`hostScope.scope.allSessions`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`selected`,className:R(Q.segmentButton,a===`selected`&&Q.segmentActive),onClick:()=>{n(c_(t,e.key,`selected`,l))},children:r(`hostScope.scope.selectedWorkspaces`)})]}),a===`selected`&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePicker,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePickerBar,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspacePickerCount,children:r(`hostScope.selectedCount`,{selected:u,total:e.workspaceCount})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Q.workspacePickerActions,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:e.workspaces.length===0||u===e.workspaces.length,onClick:()=>{n(u_(t,e.key,l))},children:r(`hostScope.selectAll`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:u===0,onClick:()=>{n(u_(t,e.key,[]))},children:r(`hostScope.clear`)})]})]}),e.workspaces.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.noWorkspaces,children:r(`hostScope.noHostWorkspaces`)}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.workspaceList,children:e.workspaces.map(r=>{let i=c.has(r.workspaceId);return/* @__PURE__ */ (0,o.jsxs)(`label`,{className:Q.workspaceOption,title:r.path||r.title,children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`checkbox`,className:Q.workspaceCheckbox,checked:i,onChange:()=>{n(l_(t,e.key,r.workspaceId,l))}}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspaceOptionName,children:r.title})]},r.workspaceId)})})]})]})}function x_(){return/* @__PURE__ */ (0,o.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M2.2 3.2h11.6L9.4 8.4v4.1l-2.8-1.4V8.4L2.2 3.2Z`})})}function S_({workspaces:e,state:t,onChange:n,t:r}){let i=(0,s.useMemo)(()=>Xg(e),[e]),a=(0,s.useMemo)(()=>Qg(e),[e]),c=(0,s.useMemo)(()=>$g(t,e),[t,e]);return i?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBarRow,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBar,role:`tablist`,"aria-label":r(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c.selectedHost===`all`,className:R(Q.tabItem,c.selectedHost===`all`&&Q.tabItemActive),onClick:()=>{n(s_(c,`all`))},children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:r(`hostScope.allShort`)})}),a.map(e=>{let t=c.selectedHost===e.key,i=v_(e,r),a=e.hostId===void 0?i:`${i} · ${y_(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:R(Q.tabItem,t&&Q.tabItemActive),title:a,onClick:()=>{n(s_(c,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabDot,"data-state":e.state??`disconnected`,"data-color":fm(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:i})]},e.key)})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabTrailing,children:/* @__PURE__ */ (0,o.jsx)(C_,{workspaces:e,state:t,onChange:n,t:r,variant:`icon`})})]}):null}function C_({workspaces:e,state:t,onChange:n,t:r,variant:i=`pill`}){let[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(null),m=(0,s.useRef)(null),h=(0,s.useRef)(null),g=(0,s.useId)(),_=(0,s.useMemo)(()=>Xg(e),[e]),v=(0,s.useMemo)(()=>Qg(e),[e]),y=(0,s.useMemo)(()=>$g(t,e),[t,e]),ee=(0,s.useMemo)(()=>t_(y,e),[y,e]),b=(0,s.useMemo)(()=>y.selectedHost===`all`?void 0:v.find(e=>e.key===y.selectedHost),[y.selectedHost,v]),x=(0,a.useAnchoredPosition)({open:l,anchorRef:m,panelRef:h,side:`bottom`,align:`end`,gap:4,margin:12});if((0,a.useDismissOnOutsidePointer)(p,l,u,h),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(!1),m.current?.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[l]),!_)return null;let S=(()=>{if(!ee)return r(`hostScope.allShort`);if(b!==void 0){let e=v_(b,r),t=y.perHost[b.key];return t?.mode===`selected`?`${e} · ${o_(b,t)}`:e}return r(`hostScope.filtered`)})(),C=b?.hostId===void 0?void 0:b.hostId,te=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:C===void 0?{}:{hostId:C}}))},ne=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},w=e.length,T=v.some(e=>y.perHost[e.key]?.mode===`selected`);return/* @__PURE__ */ (0,o.jsxs)(`span`,{ref:p,className:Q.anchorRoot,children:[i===`icon`?/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:R(Q.iconTrigger,T&&Q.iconTriggerActive,l&&Q.iconTriggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":r(`hostScope.trigger.aria`,{current:S}),title:r(`hostScope.trigger.aria`,{current:S}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(x_,{}),T&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.iconTriggerPip,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:R(Q.trigger,ee&&Q.triggerActive,l&&Q.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":r(`hostScope.trigger.aria`,{current:S}),title:r(`hostScope.trigger.aria`,{current:S}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[b?.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":b.state??`disconnected`,"data-color":fm(b.hostId,b.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.triggerLabel,children:S}),/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:12,className:Q.triggerChevron})]}),l&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:h,id:g,role:`dialog`,"aria-label":r(`hostScope.popover.aria`),className:Q.popover,style:x??{visibility:`hidden`,left:0,top:0},onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scrollArea,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.sectionTitleRow,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:r(`hostScope.host.label`)}),ee&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.resetLink,onClick:()=>{n(d_())},children:r(`hostScope.reset`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.hostList,role:`radiogroup`,"aria-label":r(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":y.selectedHost===`all`,className:R(Q.hostRow,y.selectedHost===`all`&&Q.hostRowSelected),onClick:()=>{n(s_(y,`all`))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:r(`hostScope.allHosts`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostCount,children:w}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:y.selectedHost===`all`&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:14})})]}),v.map(e=>{let t=y.selectedHost===e.key,i=y.perHost[e.key],s=i?.mode===`selected`,c=o_(e,i),l=s?`${c}/${e.workspaceCount}`:String(e.workspaceCount),u=v_(e,r),d=e.hostId===void 0?u:`${u} · ${y_(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:R(Q.hostRow,t&&Q.hostRowSelected),title:d,onClick:()=>{n(s_(y,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":fm(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:u}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Q.hostCount,s&&Q.hostCountFiltered),children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:t&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:14})})]},e.key)})]})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.sectionTitleRow,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:r(`hostScope.scope.label`)})}),b===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.allHostsScopeList,children:v.map(e=>{let t=d===e.key,i=y.perHost[e.key],s=i?.mode===`selected`,c=s?`${o_(e,i)}/${e.workspaceCount}`:r(`hostScope.allShort`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.perHostAccordion,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:R(Q.perHostTrigger,t&&Q.perHostTriggerOpen),"aria-expanded":t,onClick:()=>{f(t=>t===e.key?null:e.key)},children:[t?/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:12,className:Q.accordionIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronRightOutlineRegular,{size:12,className:Q.accordionIcon}),e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":fm(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:v_(e,r)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Q.scopeSummaryTag,s&&Q.scopeSummaryTagFiltered),children:c})]}),t&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.perHostBody,children:/* @__PURE__ */ (0,o.jsx)(b_,{host:e,state:y,onChange:n,t:r})})]},e.key)})}):/* @__PURE__ */ (0,o.jsx)(b_,{host:b,state:y,onChange:n,t:r})]})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.footer,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:te,children:[/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.addRemoteWorkspace`)})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:ne,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.manageRemoteHosts`)})]})]})]}),document.body)]})}function w_(e,t){let n=Qg(e),r=n.find(e=>e.key===`local`)??{key:`local`,workspaces:[]},i=/* @__PURE__ */ new Map;for(let e of n)e.key!==`local`&&e.hostId!==void 0&&i.set(e.hostId,e);for(let e of t){if(!e.enabled){i.delete(e.hostId);continue}let t=i.get(e.hostId);t===void 0?i.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.name,state:e.state,workspaces:[]}):i.set(e.hostId,{...t,displayName:e.name||t.displayName,state:e.state||t.state})}return[r,...i.values()]}function T_(e,t){return t===void 0?`local`:e.find(e=>e.workspaceId===t)?.remote?.hostId??`local`}function E_(e,t,n){let r=t.trim().toLowerCase();return r===``?[...e]:e.filter(e=>(e.key===`local`?n:e.displayName??e.hostId??e.key).toLowerCase().includes(r)||e.hostId!==void 0&&e.hostId.toLowerCase().includes(r))}function D_(e,t,n){let r=t.trim().toLowerCase();return r===``?[...e]:e.filter(e=>{let t=n(e).toLowerCase(),i=(e.path??``).toLowerCase();return t.includes(r)||i.includes(r)})}function O_(e,t){if(!e)return;let n=e.replace(/[\\/]+$/u,``);if(!n)return;let r=n.split(/[\\/]+/u).filter(Boolean);if(r.length<2)return;let i=r[r.length-2];if(i&&i!==t&&i!==`~`&&i!==`Users`&&i!==`home`)return i}function k_(e){if(typeof e!=`object`||!e)return[];let t=e.result;if(typeof t!=`object`||!t)return[];let n=t,r=(n.ok===!0&&typeof n.value==`object`&&n.value!==null?n.value:n).peers;if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e;typeof t.hostId==`string`&&t.hostId!==``&&typeof t.name==`string`&&typeof t.state==`string`&&i.push({hostId:t.hostId,name:t.name,state:t.state,enabled:t.enabled!==!1})}return i}function A_(e,t){if(t.workspaceId!==void 0){let n=e.find(e=>e.workspaceId===t.workspaceId);if(n!==void 0)return n}let n=t.path.replace(/[\\/]+$/u,``);return e.find(e=>e.remote?.hostId===t.hostId&&e.path.replace(/[\\/]+$/u,``)===n)}let j_=`@deepseek-ai/dsh-client-ui-workspace/HeroLocationWorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(j_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=j_,e.textContent=`.tXrwyq_root{align-items:center;gap:4px;min-width:0;max-width:100%;display:inline-flex}.tXrwyq_trigger{min-width:0;max-width:240px;height:30px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9999px;align-items:center;gap:7px;padding:0 10px;font-size:13.5px;font-weight:450;line-height:20px;transition:background-color .11s,color .11s;display:inline-flex}.tXrwyq_trigger:hover:not(:disabled),.tXrwyq_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.tXrwyq_trigger:disabled{opacity:.55;cursor:default}.tXrwyq_trigger:focus-visible,.tXrwyq_row:focus-visible,.tXrwyq_footerAction:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.tXrwyq_triggerPlaceholder{color:var(--dsw-alias-label-tertiary);font-weight:400}.tXrwyq_triggerPlaceholder:hover:not(:disabled),.tXrwyq_triggerPlaceholder.tXrwyq_triggerOpen{color:var(--dsw-alias-label-secondary)}.tXrwyq_triggerLocation{flex:0 auto;max-width:180px}.tXrwyq_triggerProject{flex:0 auto;max-width:260px}.tXrwyq_triggerIcon{color:currentColor;opacity:.9;flex:none}.tXrwyq_triggerPlaceholder .tXrwyq_triggerIcon{opacity:.8}.tXrwyq_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_statusDot{background:var(--dsw-alias-label-tertiary);opacity:.78;border-radius:50%;flex:none;width:6px;height:6px}.tXrwyq_statusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.92}.tXrwyq_statusDot[data-state=auth-error]{background:var(--dsw-alias-state-error-primary);opacity:.92}.tXrwyq_popover{z-index:1100;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);--dsw-elevation-stroke-color:transparent;box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border-radius:16px;flex-direction:column;padding:6px;display:flex;position:fixed}.tXrwyq_popoverLocation{width:min(264px,100vw - 24px)}.tXrwyq_popoverProject{width:min(280px,100vw - 24px)}.tXrwyq_searchRow{align-items:center;gap:8px;height:36px;padding:0 10px;display:flex}.tXrwyq_searchIcon{color:var(--dsw-alias-label-tertiary);flex:none}.tXrwyq_searchInput{min-width:0;height:100%;color:var(--dsw-alias-label-primary);font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0;font-size:14px;line-height:20px}.tXrwyq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.tXrwyq_divider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:4px 10px 6px}.tXrwyq_footerDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:6px 10px 4px}.tXrwyq_list{flex-direction:column;gap:2px;max-height:260px;display:flex;overflow-y:auto}.tXrwyq_row{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_row:hover,.tXrwyq_rowActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_rowIcon{width:16px;height:16px;color:var(--dsw-alias-label-secondary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_rowMain{flex:1;align-items:baseline;gap:7px;min-width:0;display:flex}.tXrwyq_rowTitle{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_rowHint{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-tertiary);flex:0 auto;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.tXrwyq_rowStatus{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:16px}.tXrwyq_checkSlot{width:16px;height:16px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_emptyState{text-align:center;color:var(--dsw-alias-label-tertiary);padding:16px 10px;font-size:13px;line-height:18px}.tXrwyq_footerAction{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_footerAction:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_footerAction:disabled{opacity:.5;cursor:default}.tXrwyq_footerIcon{color:var(--dsw-alias-label-secondary);flex:none}.tXrwyq_modalAction{min-width:72px}.tXrwyq_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}@media (hover:none),(pointer:coarse){.tXrwyq_trigger{min-height:34px;padding:0 11px}.tXrwyq_row,.tXrwyq_footerAction{min-height:40px}}@media (prefers-reduced-motion:reduce){.tXrwyq_trigger,.tXrwyq_row,.tXrwyq_footerAction{transition:none}}`,document.head.appendChild(e)}var $={checkSlot:`tXrwyq_checkSlot`,divider:`tXrwyq_divider`,emptyState:`tXrwyq_emptyState`,footerAction:`tXrwyq_footerAction`,footerDivider:`tXrwyq_footerDivider`,footerIcon:`tXrwyq_footerIcon`,list:`tXrwyq_list`,modalAction:`tXrwyq_modalAction`,modalError:`tXrwyq_modalError`,popover:`tXrwyq_popover`,popoverLocation:`tXrwyq_popoverLocation`,popoverProject:`tXrwyq_popoverProject`,root:`tXrwyq_root`,row:`tXrwyq_row`,rowActive:`tXrwyq_rowActive`,rowHint:`tXrwyq_rowHint`,rowIcon:`tXrwyq_rowIcon`,rowMain:`tXrwyq_rowMain`,rowStatus:`tXrwyq_rowStatus`,rowTitle:`tXrwyq_rowTitle`,searchIcon:`tXrwyq_searchIcon`,searchInput:`tXrwyq_searchInput`,searchRow:`tXrwyq_searchRow`,statusDot:`tXrwyq_statusDot`,trigger:`tXrwyq_trigger`,triggerIcon:`tXrwyq_triggerIcon`,triggerLabel:`tXrwyq_triggerLabel`,triggerLocation:`tXrwyq_triggerLocation`,triggerOpen:`tXrwyq_triggerOpen`,triggerPlaceholder:`tXrwyq_triggerPlaceholder`,triggerProject:`tXrwyq_triggerProject`};let M_=`codexhost:remote-peers-updated`,N_=`codexhost:remote-workspace-created`,P_=`codexhost/remote-peers/list`,F_=`::no-project`;function I_({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2.25`,y:`2.75`,width:`11.5`,height:`8`,rx:`1.5`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.25 12.75h13.5`})]})}function L_({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`8.5`,rx:`1.6`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function R_(e,t){return e.key===`local`?t(`host.thisComputer`):e.displayName||e.hostId||e.key}function z_(e,t){if(e!==void 0&&e!==`connected`)return t(e===`connecting`?`host.connecting`:`host.disconnected`)}function B_({location:e,className:t}){return e.key===`local`?/* @__PURE__ */ (0,o.jsx)(I_,{className:t}):e.state!==void 0&&e.state!==`connected`?/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.statusDot,"data-state":e.state,"aria-hidden":`true`}):/* @__PURE__ */ (0,o.jsx)(L_,{className:t})}async function V_(e){try{let t=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hero-peers-${Date.now()}`,n=await fetch(`api/${P_}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:t,method:P_,payload:{args:{}}}),...e===void 0?{}:{signal:e}});return n.ok?k_(await n.json()):null}catch{return null}}function H_({open:e,selectedId:t,fallbackLabel:n,onOpenChange:r,onPick:i,onClose:l,useWorkspaces:u,createWorkspace:d,useDirectoryFlow:f,renderSlot:p,t:m}){let h=u(e=>e),g=h.items,_=h.canStartProjectless===!0,v=f(e=>e),[y,ee]=(0,s.useState)([]),[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(!1),[te,ne]=(0,s.useState)(!1),[w,T]=(0,s.useState)(``),[E,D]=(0,s.useState)(``),[O,k]=(0,s.useState)(-1),[re,ie]=(0,s.useState)(-1),[ae,A]=(0,s.useState)(!1),[j,oe]=(0,s.useState)(!1),[se,ce]=(0,s.useState)(!1),[le,ue]=(0,s.useState)(null),M=(0,a.usePhoneSidebar)(),de=(0,s.useRef)(!1),fe=(0,s.useRef)(null),[pe,me]=(0,s.useState)(null),he=(0,s.useRef)(null),ge=(0,s.useRef)(null),_e=(0,s.useRef)(null),ve=(0,s.useRef)(null),ye=(0,s.useRef)(null),be=(0,s.useRef)(null),xe=(0,s.useRef)(null),Se=(0,s.useId)(),Ce=(0,s.useId)(),N=e||te,we=ae||j,Te=(0,s.useMemo)(()=>T_(g,t),[g,t]),Ee=(0,s.useMemo)(()=>w_(g,y),[g,y]),De=(0,s.useMemo)(()=>new Set(Ee.map(e=>e.key)),[Ee]),Oe=(0,s.useMemo)(()=>new Set(y.filter(e=>!e.enabled).map(e=>e.hostId)),[y]),ke=h.phase===`ready`&&h.state===`idle`&&b,[Ae,je]=(0,s.useState)(()=>Te),Me=(0,s.useCallback)((e,t=!1)=>{ne(e),r?.(e),e||(t||je(De.has(Te)?Te:`local`),l())},[De,l,r,Te]);(0,s.useEffect)(()=>{e&&(C(!1),ne(!0))},[e]);let Ne=(0,s.useCallback)(e=>{V_(e).then(t=>{e?.aborted||t===null||(ee(t),x(!0))})},[]);(0,s.useEffect)(()=>{let e=new AbortController;Ne(e.signal);let t=()=>{Ne()};return window.addEventListener(M_,t),()=>{e.abort(),window.removeEventListener(M_,t)}},[Ne]),(0,s.useEffect)(()=>{S&&Ne()},[S,Ne]),(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;t&&typeof t.hostId==`string`&&typeof t.path==`string`&&fe.current!==null&&t.hostId===fe.current&&(fe.current=null,me({hostId:t.hostId,path:t.path,...typeof t.workspaceId==`string`?{workspaceId:t.workspaceId}:{}}))};return window.addEventListener(N_,e),()=>{window.removeEventListener(N_,e)}},[]);let Pe=(0,s.useRef)(t);(0,s.useEffect)(()=>{if(t!==Pe.current&&(Pe.current=t,t!==void 0)){let e=T_(g,t);je(De.has(e)?e:`local`)}},[De,t,g]),(0,s.useEffect)(()=>{t!==void 0&&Te!==`local`&&De.has(Te)&&je(e=>e===`local`?Te:e)},[De,t,Te]);let Fe=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=e=>e!==`local`&&!De.has(e)&&(ke||Oe.has(e));e(Ae)&&je(`local`),fe.current!==null&&e(fe.current)&&(fe.current=null),pe!==null&&e(pe.hostId)&&me(null);let n=t===void 0?void 0:g.find(e=>e.workspaceId===t),r=n?.remote!==void 0&&e(n.remote.hostId),a=pe!==null&&!e(pe.hostId)&&pe.workspaceId===t,o=ke&&t!==void 0&&n===void 0&&!a&&(Ae!==`local`||t.startsWith(`remote-peer:`));r||o?_&&Fe.current!==t&&(Fe.current=t,i(null)):Fe.current=void 0},[Ae,De,_,Oe,ke,i,pe,t,g]);let P=(0,s.useMemo)(()=>Ee.find(e=>e.key===Ae)??Ee[0]??{key:`local`,workspaces:[]},[Ae,Ee]);(0,s.useEffect)(()=>{if(pe===null)return;let e=A_(g,pe);e!==void 0&&(me(null),je(e.remote?.hostId??`local`),i(e.workspaceId))},[i,pe,g]),(0,s.useEffect)(()=>{ae&&!v&&A(!1)},[ae,v]);let Ie=(0,a.useAnchoredPosition)({open:S,anchorRef:ge,panelRef:ve,side:`bottom`,align:`start`,gap:6,margin:12}),Le=(0,a.useAnchoredPosition)({open:N,anchorRef:_e,panelRef:ye,side:`bottom`,align:`start`,gap:6,margin:12});(0,a.useDismissOnOutsidePointer)(he,S,C,ve),(0,a.useDismissOnOutsidePointer)(he,N,(0,s.useCallback)(e=>{e||Me(!1)},[Me]),ye),(0,s.useEffect)(()=>{if(!S)return;T(``),k(-1);let e=requestAnimationFrame(()=>{be.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[S]),(0,s.useEffect)(()=>{if(!N)return;D(``),ie(-1);let e=requestAnimationFrame(()=>{xe.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[N]),(0,s.useEffect)(()=>{if(!S&&!N)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),S?(C(!1),ge.current?.focus({preventScroll:!0})):N&&(Me(!1),_e.current?.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[S,N,Me]);let Re=(0,s.useCallback)(e=>un(e.title,m(`workspace.defaultName`)),[m]),ze=(0,s.useMemo)(()=>E_(Ee,w,m(`host.thisComputer`)),[Ee,w,m]),Be=(0,s.useMemo)(()=>D_(P.workspaces,E,Re),[P.workspaces,E,Re]),Ve=P.key===`local`&&_&&E.trim()===``,He=(0,s.useMemo)(()=>[...Ve?[{id:F_,workspace:void 0}]:[],...Be.map(e=>({id:e.workspaceId,workspace:e}))],[Be,Ve]);(0,s.useEffect)(()=>{k(e=>ze.length===0?-1:e>=ze.length?0:e)},[ze.length]),(0,s.useEffect)(()=>{ie(e=>He.length===0?-1:e>=He.length?0:e)},[He.length]);let Ue=Ee.length>1,We=R_(P,m),Ge=(0,s.useMemo)(()=>t===void 0?void 0:g.find(e=>e.workspaceId===t),[t,g]),Ke=Ge!==void 0&&(Ge.remote?.hostId??`local`)===P.key,qe=Ke&&Ge!==void 0?Re(Ge):t===void 0&&P.key===`local`&&n!==void 0?n:m(`heroPicker.project.choose`),Je=!Ke&&(t!==void 0||P.key!==`local`||n===void 0),Ye=e=>{let t=e.key!==P.key;je(e.key),C(!1),t&&Me(!0)},Xe=e=>{fe.current=null,Me(!1,!0),i(e===F_?null:e)},Ze=(0,s.useCallback)(()=>{fe.current=null,de.current=M?.open===!0,Me(!1,!0),ce(!1),ue(null),A(!0)},[M?.open,Me]),Qe=()=>{P.key===`local`?v&&!we&&Ze():P.hostId?.startsWith(`remote-peer:`)&&P.state===`connected`&&(Me(!1),fe.current=P.hostId,window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:{hostId:P.hostId}})))},$e=P.key===`local`?v:P.hostId?.startsWith(`remote-peer:`)===!0&&P.state===`connected`,et=()=>{C(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},tt=e=>d({path:e}).then(e=>{A(!1),je(`local`),i(e.workspaceId)}).catch(e=>{ue(e instanceof Error?e.message:String(e)),A(!1),ce(!0)}),nt={open:ae,busy:j,onPicked:e=>{oe(!0),tt(e).finally(()=>{oe(!1)})},onCancel:()=>{A(!1)},onError:e=>{A(!1),ue(e),ce(!0)}},F=e=>{if(ze.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),k(e=>e<0?0:(e+1)%ze.length);else if(e.key===`ArrowUp`)e.preventDefault(),k(e=>e<0?ze.length-1:(e-1+ze.length)%ze.length);else if(e.key===`Enter`){e.preventDefault();let t=ze[O>=0?O:0];t!==void 0&&Ye(t)}}},rt=e=>{if(He.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),ie(e=>e<0?0:(e+1)%He.length);else if(e.key===`ArrowUp`)e.preventDefault(),ie(e=>e<0?He.length-1:(e-1+He.length)%He.length);else if(e.key===`Enter`){e.preventDefault();let t=He[re>=0?re:0];t!==void 0&&Xe(t.id)}}},it=()=>{ce(!1),ue(null)};return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:he,className:$.root,"data-hero-location-picker":``,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:ge,type:`button`,className:R($.trigger,$.triggerLocation,S&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":S,"aria-controls":S?Se:void 0,"aria-label":m(`heroPicker.location.aria`,{current:We}),disabled:we,"data-hero-location-trigger":``,onClick:()=>{Me(!1),C(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(B_,{location:P,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:We})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:_e,type:`button`,className:R($.trigger,$.triggerProject,Je&&$.triggerPlaceholder,N&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":N,"aria-controls":N?Ce:void 0,"aria-label":m(`heroPicker.project.aria`,{current:qe}),disabled:we,"data-hero-project-trigger":``,onClick:()=>{C(!1),Me(!N)},children:[Je?/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:15,className:$.triggerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenOutlineRegular,{size:15,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:qe})]}),S&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:ve,id:Se,role:`dialog`,"aria-label":m(`heroPicker.location.placeholder`),className:R($.popover,$.popoverLocation),style:Ie??{visibility:`hidden`,left:0,top:0},"data-hero-location-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:be,type:`text`,className:$.searchInput,value:w,placeholder:m(`heroPicker.location.placeholder`),"aria-label":m(`heroPicker.location.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{T(e.target.value),k(e.target.value.trim()===``?-1:0)},onKeyDown:F})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.location.placeholder`),onMouseLeave:()=>k(-1),children:ze.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:m(`heroPicker.location.empty`)}):ze.map((e,t)=>{let n=e.key===P.key,r=R_(e,m),i=z_(e.state,m);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:R($.row,t===O&&$.rowActive),onMouseEnter:()=>k(t),onClick:()=>Ye(e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(B_,{location:e})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowMain,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:r})}),i!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowStatus,children:i}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:n&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.key)})}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,onClick:et,children:[Ue?/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:15,className:$.footerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(Ue?`heroPicker.location.manageRemote`:`heroPicker.location.connectRemote`)})]})]}),document.body),N&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:ye,id:Ce,role:`dialog`,"aria-label":m(`heroPicker.project.placeholder`),className:R($.popover,$.popoverProject),style:Le??{visibility:`hidden`,left:0,top:0},"data-hero-project-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:xe,type:`text`,className:$.searchInput,value:E,placeholder:m(`heroPicker.project.placeholder`),"aria-label":m(`heroPicker.project.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{D(e.target.value),ie(e.target.value.trim()===``?-1:0)},onKeyDown:rt})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.project.placeholder`),onMouseLeave:()=>ie(-1),children:h.phase===`pending`&&He.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,role:`status`,children:m(`picker.loading`)}):He.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:E.trim()===``?m(`heroPicker.project.empty`):m(`heroPicker.project.noMatches`)}):He.map((e,n)=>{let r=e.workspace===void 0,i=r?t===void 0:e.id===t,s=r?m(`heroPicker.project.noProject`):Re(e.workspace),c=r?void 0:O_(e.workspace.path,s);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,className:R($.row,n===re&&$.rowActive),title:e.workspace?.path||s,onMouseEnter:()=>ie(n),onClick:()=>Xe(e.id),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:15})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:$.rowMain,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowHint,children:c})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:i&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.id)})}),$e&&/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,disabled:we,onClick:Qe,children:[/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(`heroPicker.project.new`)})]})]})]}),document.body),p(`conversation.hero.workspace.directoryFlow`,nt),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:de.current,open:se,onClose:it,closeLabel:m(`close`),title:m(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.modalAction,onClick:it,children:m(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:$.modalAction,disabled:!v,onClick:Ze,children:m(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.modalError,role:`alert`,children:le})})]})}let U_=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(U_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=U_,e.textContent=`.s4nt4G_modalAction{min-width:72px}.s4nt4G_modalError,.s4nt4G_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.s4nt4G_modalError{color:var(--dsw-alias-state-error-primary)}.s4nt4G_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var W_={menuStatus:`s4nt4G_menuStatus`,modalAction:`s4nt4G_modalAction`,modalError:`s4nt4G_modalError`};let G_=`::add-workspace`,K_=`::no-workspace`;function q_({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]),[ee,b]=(0,s.useState)(!1),[x,S]=(0,s.useState)(null),[C,te]=(0,s.useState)(!1),ne=(0,a.usePhoneSidebar)(),w=(0,s.useRef)(!1),[T,E]=(0,s.useState)(!1),D=C||T;(0,s.useEffect)(()=>{m?.(D)},[D,m]);let O=c(e=>e);(0,s.useEffect)(()=>{C&&!O&&te(!1)},[C,O]);let k=O?[{id:G_,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16}),disabled:D}]:[],re=!p&&v.length>0,ie=d!==void 0&&!p,ae=ie?[{id:K_,label:e(`menu.noWorkspace`),disabled:D}]:[],A=re?[...ae,...v.map(t=>({id:t.workspaceId,label:un(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:16}),disabled:D}))]:[...ae,...k],j=A.length===0,oe=()=>{b(!1),S(null)},se=e=>i({path:e}).then(e=>{te(!1),u(e.workspaceId)}).catch(e=>{S(e instanceof Error?e.message:String(e)),te(!1),b(!0)}),ce=(0,s.useCallback)(()=>{w.current=ne?.open===!0,f(),b(!1),S(null),te(!0)},[f,ne?.open]),le=p||_.phase===`ready`,ue=!ie&&!re&&le&&k.length===1;(0,s.useEffect)(()=>{t&&ue&&!D&&ce()},[t,ue,D,ce]);let M={open:C,busy:T,onPicked:e=>{E(!0),se(e).finally(()=>{E(!1)})},onCancel:()=>{te(!1)},onError:e=>{te(!1),S(e),b(!0)}},de=e=>{e===K_?d?.():e===G_?ce():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:t&&!ue&&!j,anchor:null,items:A,...re?{footer:k}:{},selectedId:g??(ie?K_:void 0),onSelect:de,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!ue&&!j&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:W_.menuStatus,role:`status`,children:e(`picker.loading`)}),l(M),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:w.current,open:ee,onClose:oe,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:W_.modalAction,onClick:oe,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:W_.modalAction,disabled:!O,onClick:ce,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:W_.modalError,role:`alert`,children:x})})]})}function J_(e){return/* @__PURE__ */ (0,o.jsx)(H_,{...e})}function Y_(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 X_(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 Z_({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}=pn(),{busy:g,failed:_,save:v}=Qt(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:Z.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:R(Z.iconButton,Z.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:Xt.error,role:`alert`,children:l(`threadTree.style.error`)})})}function Q_(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),re(c,t.find(e=>e.blank)?.id)}function $_(e,t,n){if(!t)return/* @__PURE__ */ new Map;let r=e=>`${e.remote?.hostId??`local`}\n${n.get(e.workspaceId)??``}`,i=/* @__PURE__ */ new Map;for(let t of e){let e=r(t),n=i.get(e)??/* @__PURE__ */ new Map;t.path&&n.set(t.path,t.workspaceId),i.set(e,n)}return new Map(e.map(e=>{let t=i.get(r(e)),n=ye(e.path,[...t?.keys()??[]]);return[e.workspaceId,n===void 0?void 0:t?.get(n)]}))}function ev(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function tv({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.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:Z.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function nv({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,allWorkspaces:c=i,linkedRoots:l,ungroupedSessionIds:u,rowState:d,nativeSections:f,onLeaveArchivedOnly:p,workspaceReady:m,canStartProjectless:h,animationResetKey:g,usePanelInfo:_,onRenameRequest:v,onDeleteRequest:y,onSessionRenameRequest:ee,renderSlot:b,insertWorkspaceBefore:x,nestWorkspaces:S,groupExpansion:C,setGroupExpanded:te,sectionExpansion:ne,setSectionExpanded:w,setSessionOrder:E,home:D,t:O,revealSessionId:k,onSessionRevealed:re,shortcuts:ie,loadMoreSessions:ae,hostScopeFiltered:A=!1,singleRemoteHostScoped:j=!1,onResetHostScope:oe}){let se=pn(),ce=(0,a.usePhoneSidebar)(),le=_(e=>e.activePanelId!==null),ue=t(e=>e),M=le?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,de=(0,s.useMemo)(()=>i.map(e=>{let t=l.get(e.workspaceId);return t===void 0||t.size===0?e:{...e,sessionIds:e.sessionIds.filter(e=>!t.has(e))}}),[l,i]),me=k===void 0||!m?void 0:T(de,se.rootId(k)),[he,_e]=(0,s.useState)({}),[ve,ye]=(0,s.useState)(null),be=(0,s.useRef)(!1),[N,we]=(0,s.useState)(null),Te=(0,s.useRef)(!1),Ee=ve!==null||N!==null;X_(Ee);let De=M===void 0||!m?void 0:T(de,se.rootId(M)),Oe=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of f)for(let n of t.workspaceIds??[])e.has(n)||e.set(n,t.id);return e},[f]),ke=(0,s.useMemo)(()=>$_(i,S,Oe),[S,Oe,i]),Ae=(0,s.useMemo)(()=>c===i?ke:$_(c,S,Oe),[c,S,ke,Oe,i]),je=(0,s.useMemo)(()=>{let e=new Set(ke.values());return[...i.map(e=>e.workspaceId),``].filter(t=>C[t]??(t===``||e.has(t)))},[C,ke,i]),Me=(0,s.useMemo)(()=>new Map(fe(e,d,ue).map(e=>[e.id,e])),[e,d,ue]),Ne=(0,s.useMemo)(()=>{let t=pe(e,i,d,ue,{expandedGroups:je,excludePinned:!0},Me);return(h||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:je.includes(``),containsCurrent:!1,activity:{running:0,pendingInteraction:0,completed:0},sessions:[]}),t},[e,i,d,ue,je,h,Me]),Pe=Date.now(),Fe=(e,t)=>{if(be.current)return;be.current=!0,ye(null);let n=Ne.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?u:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=Gg(n.sessions,he[n.key]??5,M,k).rows,o=Q_(r,a,e,t);o!==void 0&&E(e.accountKey,o)},P=(e,t)=>{if(Te.current)return;Te.current=!0,we(null);let n=cn(c,e.workspaceId,t,{sectionOf:Oe,parents:Ae});n!==null&&x(e.workspaceId,n.beforeWorkspaceId).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},Ie=(0,s.useMemo)(()=>{let e=new Set(Ne.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of Ne){let r=ke.get(n.key);for(;r!==void 0&&!e.has(r);)r=ke.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[Ne,ke]),Le=Ie.get(void 0)??[],Re=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of Ie.get(n.key)??[])t(e,r)};for(let e of Le)t(e,e.key);return e},[Ie,Le]),ze=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[De,me]){let n=t===void 0?void 0:Re.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[De,me,Re]),[Be,Ve]=(0,s.useState)(!1),He=Le.filter(e=>e.key!==``&&!Oe.has(e.key)),Ue=(0,s.useMemo)(()=>{let e=new Map(Le.map(e=>[e.key,e]));return new Map(f.map(t=>[t.id,(t.workspaceIds??[]).flatMap(n=>{let r=e.get(n);return r!==void 0&&Oe.get(n)===t.id?[r]:[]})]))},[f,Le,Oe]),We=Kg(He,5,ze),Ge=Be?He:We.rows,Ke=Ce(ne,xe),qe=(0,s.useMemo)(()=>iv(f,e,d,ue,ne,Me),[f,e,d,ue,ne,Me]),Je=Ce(ne,Se),Ye=e=>{e.expanded&&_e(t=>({...t,[e.key]:5})),te(e.key,!e.expanded)},Xe=(0,s.useMemo)(()=>ge(e,d.pinnedSessionIds,d,ue,Me).filter(e=>e.pinned),[e,d,ue,Me]),Ze=[];if(Xe.length>0&&(Ze.push(`section:${xe}`),Ke))for(let e of se.rows(Xe))Ze.push(`session:${e.id}`);let Qe=e=>{let t={...e.activity};for(let n of Ie.get(e.key)??[]){let e=Qe(n);t.running+=e.running,t.pendingInteraction+=e.pendingInteraction,t.completed+=e.completed}return t},$e=(t,i)=>{let s=t.workspaceId,u=Ie.get(t.key)??[],d=Oe.has(t.key),f=N!==null&&sn(c,N.workspaceId,s,{sectionOf:Oe,parents:Ae}),p=Gg(t.sessions,he[t.key]??5,M,k);Ze.push(`workspace:${t.key}`);let m=t.expanded?u.map(e=>$e(e,i+1)):[],g=t.expanded?void 0:Qe(t),_=se.rows(p.rows),x=l.get(t.key),S=new Set(x===void 0?[]:p.rows.flatMap(e=>x.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),C=e=>s===void 0?`recent:${e}`:S.has(e)?`linked:${t.key}:${e}`:`session:${e}`;for(let e of _)Ze.push(C(e.id));let ne=!t.remote&&e.hasMore,w=t.expanded&&(p.hiddenCount>0||ne);w&&Ze.push(`overflow:${t.key}`);let T=s!==void 0&&N?.over?.id===s?N.over.half:null,E=s===void 0||d?void 0:{start:()=>{Te.current=!1,we({workspaceId:s,over:null})},end:()=>{N?.over!==null&&N?.over!==void 0?P(N,N.over):we(null),Te.current=!1}},A=s===void 0||!f?void 0:e=>{we(t=>t===null?t:{...t,over:{id:s,half:e}})},oe=s===void 0||!f?void 0:e=>{P(N,{id:s,half:e})};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${i*12}px`},className:R(Z.groupSection,T===`before`&&Z.workspaceDropBefore,T===`after`&&Z.workspaceDropAfter),onDragOver:N===null?void 0:e=>{e.preventDefault(),(A!==void 0||ke.get(t.key)===void 0)&&(e.stopPropagation(),A===void 0?(e.dataTransfer.dropEffect=`none`,N.over!==null&&we({...N,over:null})):(e.dataTransfer.dropEffect=`move`,A(ev(e))))},onDrop:N===null?void 0:e=>{e.preventDefault(),(oe!==void 0||ke.get(t.key)===void 0)&&(e.stopPropagation(),oe===void 0?(Te.current=!0,we(null)):oe(ev(e)))},children:[s===void 0?/* @__PURE__ */ (0,o.jsx)(zg,{label:O(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{Ye(t)},rowKey:`workspace:${t.key}`,action:h?{label:O(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{te(t.key,!0),ce?.close(),n()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(Tg,{newShortcut:ie.find(e=>e.id===`session.new`),group:t,foldedActivity:g,showHost:!j,home:D,t:O,onToggle:()=>{Ye(t)},onCreate:()=>{t.workspaceId!==void 0&&(te(t.key,t.expanded),ce?.close(),n(t.workspaceId))},drag:E,actions:t.workspaceId===void 0?void 0:{rename:()=>{
|
|
124
124
|
/* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
|
|
125
|
-
t.workspaceId!==void 0&&
|
|
125
|
+
t.workspaceId!==void 0&&v(t.workspaceId,t.label)},delete:()=>{
|
|
126
126
|
/* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
|
|
127
|
-
t.workspaceId!==void 0&&
|
|
127
|
+
t.workspaceId!==void 0&&y(t.workspaceId,t.label)}}}),m.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`group`,children:m}),(_.length>0||w)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,className:Z.groupSessions,style:{"--dsh-workspace-indent":`${s===void 0?0:i*12+22}px`},children:[/* @__PURE__ */ (0,o.jsx)(hg,{roots:p.rows,children:e=>{let n=ve!==null&&ve.accountKey===t.key,i=n&&ve.pinned===e.pinned,a=t=>e.blank?`after`:t,c={start:()=>{be.current=!1,ye({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null})},active:i,marker:n&&ve.over?.id===e.id?ve.over.half:null,hover:t=>{
|
|
128
128
|
/* v8 ignore next -- narrowing guard: Rows gates hover on `active`, which is false while the drag state is null. */
|
|
129
|
-
|
|
129
|
+
ye(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{
|
|
130
130
|
/* v8 ignore next -- narrowing guard: Rows gates drop on `active`, which is false while the drag state is null. */
|
|
131
|
-
ve!==null&&Pe(ve,{id:e.id,half:a(t)})},end:e=>{!e&&ve?.over!==null&&ve?.over!==void 0?Pe(ve,ve.over):be(null),we.current=!1}};return/* @__PURE__ */ (0,o.jsx)(fg,{rowKey:C(e.id),showHost:!t.remote&&!(l===void 0&&A),node:e,currentId:j,now:Ne,onOpen:r,onRenameRequest:y,renderSlot:b,onReveal:e.id===ne&&t.key===me?()=>{re(e.id)}:void 0,drag:l===void 0||t.remote||(e.tree?.depth??0)>0?void 0:s,t:O},e.id)}}),ee&&/* @__PURE__ */ (0,o.jsx)(jg,{rowKey:`overflow:${t.key}`,hiddenCount:p.hiddenCount,hasMore:T,loading:!t.remote&&e.loading,expand:()=>{_e(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:()=>{ae(l===void 0||t.remote?void 0:l)},t:O})]})]},t.key)},Qe=/* @__PURE__ */ new Map;for(let e of Ke)Xe.push(...V_([e],ce.rows)),e.expanded&&Qe.set(e.key,(Ue.get(e.id)??[]).map(e=>Ze(e,0)));!oe&&Me.length===0&&Ye.length===0&&d.length===0&&Xe.push(`empty`);let $e=He.length>0||oe,et=oe&&He.length===0,F=[];if($e&&Xe.push(`section:${Se}`),qe){et&&(Xe.push(`empty:host-scope`),F.push(/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:O(`hostScope.emptyWorkspaces`)}),se!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:se,children:O(`hostScope.showAll`)})]},`empty:host-scope`)));for(let e of We)F.push(Ze(e,0));!Be&&P.hiddenCount>0&&(Xe.push(`overflow:workspaces`),F.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>{Ve(!0)},children:O(`workspaces.expand`)},`overflow:workspaces`)))}let tt=N.find(e=>e.key===``);return tt!==void 0&&F.push(Ze(tt,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.treeBody,Z.wide),children:[Le&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(bg,{className:R(Z.list,Le&&Z.listTopDropActive),label:O(`section.sessions`),rowKeys:Xe,ready:e.phase===`ready`&&p&&!De,resetKey:JSON.stringify([h,he,Be,Ge,qe]),children:[/* @__PURE__ */ (0,o.jsx)(Eg,{rows:Ye,currentId:j,showHost:!A,onOpen:r,onRenameRequest:y,renderSlot:b,revealSessionId:ne,onSessionRevealed:re,expanded:Ge,onToggle:()=>{ee(xe,!Ge)},t:O}),/* @__PURE__ */ (0,o.jsx)(H_,{sections:Ke,groupRows:Qe,currentId:j,showHost:!A,onOpen:r,onRenameRequest:y,renderSlot:b,revealSessionId:ne,onSessionRevealed:re,setSectionExpanded:ee,t:O}),!oe&&Me.length===0&&Ye.length===0&&d.length===0&&/* @__PURE__ */ (0,o.jsx)(L_,{rowState:u,onLeaveArchivedOnly:f,partial:e.hasMore,t:O}),$e&&/* @__PURE__ */ (0,o.jsx)(Cg,{label:O(`section.workspaces`),expanded:qe,onToggle:()=>{qe&&Ve(!1),ee(`workspaces`,!qe)},rowKey:`section:workspaces`,trailing:k}),F]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}let z_=[];function B_(e,t,n,r,i){if(!e.length)return[];let a=new Map(fe(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{id:e,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:Ce(i,r)}})}function V_(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function H_({sections:e,groupRows:t,setSectionExpanded:n,...r}){return e.map(({key:e,name:i,rows:a,expanded:s})=>/* @__PURE__ */ (0,o.jsx)(Eg,{...r,rows:a,customSection:{key:e,name:i},expanded:s,onToggle:()=>n(e,!s),children:t?.get(e)},e))}function U_({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,hostScopeFilterControl:b,hostScopeFiltered:x=!1,singleRemoteHostScoped:S=!1,onResetHostScope:C,t:w}){let T=u(e=>e.activePanelId!==null),ee=a(e=>e),E=ln(),D=(0,s.useMemo)(()=>ge(e,t,n,ee).filter(e=>!e.pinned&&!n.sectionedSessionIds?.has(e.id)),[e,t,n,ee]),te=ge(e,n.pinnedSessionIds,n,ee).filter(e=>e.pinned),[O,ne]=(0,s.useState)(null),re=(0,s.useRef)(!1),[ie,ae]=(0,s.useState)(10);N_(O!==null);let k=T?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,oe=kg(D,ie,k,g),A=kg(D,10,k,g).hiddenCount>0,se=(e,n)=>{if(re.current)return;re.current=!0,ne(null);let r=F_(t,D,e,n);r!==void 0&&d(be,r)},ce=Date.now(),le=Ce(f,xe),ue=B_(r,e,n,ee,f);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(bg,{className:R(Z.list,Z.flatList),label:w(`section.sessions`),rowKeys:[...te.length===0?[]:[`section:${xe}`],...le?E.rows(te).map(e=>`session:${e.id}`):[],...V_(ue,E.rows),...D.length===0&&te.length===0&&r.length===0?[x?`empty:host-scope`:`empty`]:[],...E.rows(oe.rows).map(e=>`session:${e.id}`),...A||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&m&&O===null,resetKey:`${h}/${ie}/${String(le)}`,children:[/* @__PURE__ */ (0,o.jsx)(Eg,{rows:te,currentId:k,showHost:!S,onOpen:c,onRenameRequest:l,renderSlot:v,revealSessionId:g,onSessionRevealed:_,expanded:le,onToggle:()=>{p(xe,!le)},t:w}),/* @__PURE__ */ (0,o.jsx)(H_,{sections:ue,currentId:k,showHost:!S,onOpen:c,onRenameRequest:l,renderSlot:v,revealSessionId:g,onSessionRevealed:_,setSectionExpanded:p,t:w}),(te.length>0||r.length>0||b!==void 0)&&/* @__PURE__ */ (0,o.jsx)(Cg,{label:w(`section.sessions`),trailing:b}),D.length===0&&te.length===0&&r.length===0&&(x?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:w(`hostScope.emptySessions`)}),C!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:C,children:w(`hostScope.showAll`)})]}):/* @__PURE__ */ (0,o.jsx)(L_,{rowState:n,onLeaveArchivedOnly:i,partial:e.hasMore,t:w})),/* @__PURE__ */ (0,o.jsx)(eg,{roots:oe.rows,children:e=>{let t=O!==null&&O.pinned===e.pinned,n=t=>e.blank?`after`:t;return/* @__PURE__ */ (0,o.jsx)(fg,{node:e,showHost:!S,currentId:k,now:ce,onOpen:c,onRenameRequest:l,renderSlot:v,onReveal:e.id===g?()=>{_(e.id)}:void 0,drag:{start:()=>{re.current=!1,ne({accountKey:be,sessionId:e.id,pinned:e.pinned,over:null})},active:t,marker:t&&O.over?.id===e.id?O.over.half:null,hover:t=>{ne(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{O!==null&&se(O,{id:e.id,half:n(t)})},end:e=>{!e&&O?.over!==null&&O?.over!==void 0?se(O,O.over):ne(null),re.current=!1}},t:w},e.id)}}),/* @__PURE__ */ (0,o.jsx)(jg,{rowKey:`overflow:flat`,hiddenCount:oe.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:ie>10,expand:()=>ae(ie+10),collapse:A?()=>ae(10):void 0,loadMoreSessions:y,t:w})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function W_({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)(()=>_e(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:R(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.list,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchTree,role:`tree`,"aria-label":p(`search.results.aria`),children:v.items.map(e=>/* @__PURE__ */ (0,o.jsx)(dg,{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:Z.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonDot}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.skeletonBars,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonBar}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Z.skeletonBar,Z.skeletonBarWide)})]})]},e))}),!y&&v.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,children:p(`search.noMatches`)}),v.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchStatus,children:p(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function G_(e){return/* @__PURE__ */ (0,o.jsx)(un,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(K_,{...e})})}function K_({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:ee,requestAddWorkspace:E,closeAddWorkspace:D,setDirectoryBusy:te,dismissForkError:ie,refreshSessions:ae,loadMoreSessions:k,renderSlot:oe,t:A}){let se=C(e=>e.home),ce=w(e=>e),le=ce.find(e=>e.id===`session.search`),ue=ce.find(e=>e.id===`workspace.add`),de=T(e=>e),j=r(e=>e),fe=c(e=>e.items),pe=c(e=>e.canStartProjectless===!0),he=A(`workspace.defaultName`),ge=(0,s.useMemo)(()=>fe.map(e=>({...e,title:on(e.title,he)})),[fe,he]),_e=c(e=>e.phase),ve=c(e=>e.state),ye=c(e=>e.archivedSessionIds),xe=c(e=>e.pinnedSessionIds),Se=c(e=>e.threadSections??z_),Ce=S(e=>e),we=l(e=>e.groupBy),M=l(e=>e.orderBy),Oe=l(e=>e.archivedFilter??`default`),ke=l(e=>e.groupExpansion),Ae=ln(),je=l(e=>e.sectionExpansion),Me=l(e=>e.sessionOrderByAccount),Ne=e=>{ye.includes(e)?m():(Ae.selectSidebarRow(e),f(e))},Pe=()=>{u.setArchivedFilter(`default`)},Fe=_e===`ready`&&ve!==`loading`,Ie=Object.values(j.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,N=Ie!==void 0&&j.byId[Ie]?.blank===!0?Ie:void 0,Le=(0,s.useMemo)(()=>{let e=new Set(ge.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...j.ids,...ye])].filter(t=>!e.has(t))},[ye,j.ids,ge]),Re=(0,s.useMemo)(()=>({pinnedSessionIds:xe,archivedSessionIds:ye}),[ye,xe]),ze=Oe===`only`?z_:Se,Be=(0,s.useMemo)(()=>({...Re,archivedFilter:Oe,sectionedSessionIds:new Set(ze.flatMap(e=>e.threadIds))}),[Re,Oe,ze]),Ve=(0,s.useMemo)(()=>me(j,ye),[ye,j]),He=(0,s.useMemo)(()=>Te(j,Be),[j,Be]),Ue=(0,s.useMemo)(()=>ge.map(e=>{let{memberIds:t,linkedRootIds:n}=Ee(e.sessionIds,He),r=M===`updated`?O(t,He.summaries):ne(t,Me[e.workspaceId],He.summaries,Re);return{workspace:{...e,sessionIds:re(r,N!==void 0&&t.includes(N)?N:void 0)},linkedRootIds:n}}),[N,He,M,Re,Me,ge]),P=(0,s.useMemo)(()=>Ue.map(({workspace:e})=>e),[Ue]),We=(0,s.useMemo)(()=>new Map(Ue.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[Ue]),Ge=(0,s.useMemo)(()=>O(Le.filter(e=>He.rootIds.has(e)),He.summaries),[He,Le]),Ke=(0,s.useMemo)(()=>{let e=Ve.filter(e=>He.rootIds.has(e));return re(M===`updated`?O(e,He.summaries):ne(e,Me[be],He.summaries,Re),N!==void 0&&Ve.includes(N)?N:void 0)},[N,Ve,He,M,Re,Me]),qe=(0,s.useMemo)(()=>De(ge,j,Be),[j,Be,ge]),Je=(0,s.useMemo)(()=>Object.fromEntries([...P.map(e=>[e.workspaceId,e.sessionIds]),[``,Ge],[be,Ke]]),[Ke,Ge,P]);(0,s.useEffect)(()=>{_e===`ready`&&u.retainAccountKeys([``,be,...ge.map(e=>e.workspaceId)])},[u.retainAccountKeys,_e,ge]),(0,s.useEffect)(()=>{if(j.phase!==`ready`||Fe||M!==`manual`||N===void 0)return;let e={};for(let[t,n]of Object.entries(Je)){if(t!==`__flat_session_order__`&&_e!==`ready`)continue;let r=Me[t]??[];n[0]===N&&r[0]!==N&&(e[t]=[N,...r.filter(e=>e!==N)])}Object.keys(e).length>0&&u.syncSessionOrders(e,qe)},[u.syncSessionOrders,Je,N,j.phase,M,Me,qe,_e,Fe]),(0,s.useEffect)(()=>{j.phase===`ready`&&Fe&&M===`manual`&&N!==void 0&&Object.entries(Je).some(([e,t])=>t[0]===N&&Me[e]?.[0]!==N)&&u.syncSessionOrders(Je,qe)},[u.syncSessionOrders,Je,N,j.phase,M,Me,qe,Fe]);let Ye=(e,t)=>{u.setSessionOrder(e,t,Je,qe)},[Xe,Ze]=(0,s.useState)(``),[Qe,$e]=(0,s.useState)(!1),[et,F]=(0,s.useState)(void 0),tt=M_(Xe).trim(),[nt,rt]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),it=(0,s.useRef)(null),at=(0,s.useRef)(null),ot=de.addRequested,st=(0,s.useRef)(null),[ct,lt]=(0,s.useState)(!1),[ut,dt]=(0,s.useState)(()=>$g()),ft=(0,s.useRef)(null);if(ft.current===null){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(ut.perHost))t!==`local`&&t!==ut.selectedHost&&e.add(t);ft.current=e}let pt=(0,s.useCallback)(e=>{dt(e),e_(e)},[]);(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t||typeof t.hostId!=`string`||t.hostId===``||!Array.isArray(t.workspaceIds))return;let n=t.workspaceIds.filter(e=>typeof e==`string`);ft.current?.add(t.hostId),dt(e=>{let r=Jg(e,t.hostId,n);return e_(r),r})};return window.addEventListener(Ng,e),()=>{window.removeEventListener(Ng,e)}},[]),(0,s.useEffect)(()=>{if(_e!==`ready`||ve!==`idle`)return;let e=window.setTimeout(()=>{let e=ft.current;if(e!==null&&e.size>0)for(let t of P){let n=t.remote?.hostId;n!==void 0&&t.remote?.state===`connected`&&e.delete(n)}let t=Rg(ut,P,e===null||e.size===0?void 0:{preserveHostKeys:e});t!==ut&&pt(t)},250);return()=>{window.clearTimeout(e)}},[ut,P,pt,_e,ve]);let mt=()=>{pt(Yg())},ht=(0,s.useMemo)(()=>Pg(P),[P]),gt=(0,s.useMemo)(()=>Fg(P),[P]),_t=(0,s.useMemo)(()=>Lg(ut,P),[ut,P]),vt=(0,s.useMemo)(()=>ht&&zg(_t,P),[ht,_t,P]),yt=(0,s.useMemo)(()=>ht&&_t.selectedHost!==`all`&&_t.selectedHost!==`local`,[ht,_t.selectedHost]),bt=(0,s.useMemo)(()=>vt?Bg(P,_t):P,[vt,P,_t]),xt=(0,s.useMemo)(()=>new Set(bt.map(e=>e.workspaceId)),[bt]),St=(0,s.useMemo)(()=>vt?Ug(Ke.map(e=>({id:e,remote:j.byId[e]?.projectionValues?.remoteHost??void 0})),xt,P,_t).map(e=>e.id):Ke,[vt,Ke,j.byId,xt,P,_t]),Ct=(0,s.useMemo)(()=>{if(!vt)return j;let e=new Set(Ug(j.ids.map(e=>({id:e,remote:j.byId[e]?.projectionValues?.remoteHost??void 0})),xt,P,_t).map(e=>e.id));return{...j,ids:j.ids.filter(t=>e.has(t))}},[vt,j,xt,P,_t]),wt=(0,s.useMemo)(()=>vt?JSON.stringify(_t):`all`,[vt,_t]),Tt=ht?/* @__PURE__ */ (0,o.jsx)(o_,{workspaces:P,state:_t,onChange:pt,t:A}):void 0,Et=()=>{let e=_t.selectedHost!==`all`&&_t.selectedHost!==`local`?_t.selectedHost:void 0;window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:e===void 0?{}:{hostId:e}}))},I=(0,s.useRef)(!1),L=e=>{if(ye.includes(e)){m();return}let t=Ae.rootId(e),n=ge.find(e=>e.sessionIds.includes(t));if(vt){let e=Xg(_t,n,P);e!==_t&&pt(e)}let r=we===`flat`?void 0:n?.workspaceId,i=ze.find(({threadIds:e})=>e.includes(t))??(r===void 0?void 0:ze.find(({workspaceIds:e})=>e?.includes(r)===!0));i&&u.setSectionExpanded(`native-section:${i.id}`,!0),F(e),Ze(``),$e(!1),Ae.reveal(e),f(e)},Dt=e=>{F(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{tt!==``&&F(void 0)},[tt]);let[Ot,kt]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&Ot){let e=window.setTimeout(()=>{at.current?.focus({preventScroll:!0}),kt(!1)},300);return()=>{window.clearTimeout(e)}}},[e,Ot]),(0,s.useEffect)(()=>{de.searchRequest!==0&&(D(),$e(!0),e?at.current?.focus({preventScroll:!0}):(kt(!0),n()))},[de.searchRequest]),(0,s.useEffect)(()=>{e&&Qe&&!Ot&&at.current?.focus({preventScroll:!0})},[e,Qe,Ot]),(0,s.useEffect)(()=>{if(!e||!Qe||Ot)return;let t=e=>{e.target instanceof Node&&it.current?.contains(e.target)!==!0&&(at.current?.blur(),tt===``&&$e(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[tt,e,Qe,Ot]),(0,s.useEffect)(()=>{if(tt===``){rt({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;rt({query:tt,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{b(tt,e.signal).then(t=>{e.signal.aborted||rt({query:tt,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||rt({query:tt,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[tt,b]);let[At,jt]=(0,s.useState)(null),[Mt,Nt]=(0,s.useState)(``),[Pt,Ft]=(0,s.useState)(!1),[It,Lt]=(0,s.useState)(null),Rt=Mt.trim(),zt=At!==null&&Rt!==``&&ge.some(e=>e.workspaceId!==At.workspaceId&&e.title===Rt),Bt=Pt||Rt===``||At===null||Rt===At.storedTitle||zt,Vt=()=>{Pt||(jt(null),Lt(null))},Ht=()=>{Bt||(Ft(!0),Lt(null),h(At.workspaceId,Rt).then(()=>{Ft(!1),jt(null)}).catch(e=>{Ft(!1),Lt(e instanceof Error?e.message:String(e))}))},Ut=e=>{v(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[Wt,Gt]=(0,s.useState)(null),[Kt,qt]=(0,s.useState)(!1),[Jt,Yt]=(0,s.useState)(null),[Xt,Zt]=(0,s.useState)(null);(0,s.useEffect)(()=>{Jt===null||ge.some(e=>e.workspaceId===Jt)||(qt(!1),Yt(null),Gt(null))},[Jt,ge]);let Qt=()=>{Kt||(Gt(null),Zt(null))},$t=()=>{
|
|
131
|
+
ve!==null&&Fe(ve,{id:e.id,half:a(t)})},end:e=>{!e&&ve?.over!==null&&ve?.over!==void 0?Fe(ve,ve.over):ye(null),be.current=!1}};return/* @__PURE__ */ (0,o.jsx)(Og,{rowKey:C(e.id),showHost:!t.remote&&!(s===void 0&&j),node:e,currentId:M,now:Pe,onOpen:r,onRenameRequest:ee,renderSlot:b,onReveal:e.id===k&&t.key===me?()=>{re(e.id)}:void 0,drag:s===void 0||t.remote||(e.tree?.depth??0)>0?void 0:c,t:O},e.id)}}),w&&/* @__PURE__ */ (0,o.jsx)(qg,{rowKey:`overflow:${t.key}`,hiddenCount:p.hiddenCount,hasMore:ne,loading:!t.remote&&e.loading,expand:()=>{_e(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:()=>{ae(s===void 0||t.remote?void 0:s)},t:O})]})]},t.key)},et=/* @__PURE__ */ new Map;for(let e of qe)Ze.push(...av([e],se.rows)),e.expanded&&et.set(e.key,(Ue.get(e.id)??[]).map(e=>$e(e,0)));!A&&Ne.length===0&&Xe.length===0&&f.length===0&&Ze.push(`empty`);let tt=He.length>0||A,nt=!(tt||Xe.length>0||qe.length>0)&&Ge[0]?.workspaceId!==void 0&&N?.over?.id===Ge[0].workspaceId&&N.over.half===`before`,F=A&&He.length===0,rt=[];if(tt&&Ze.push(`section:${Se}`),Je){F&&(Ze.push(`empty:host-scope`),rt.push(/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:O(`hostScope.emptyWorkspaces`)}),oe!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:oe,children:O(`hostScope.showAll`)})]},`empty:host-scope`)));for(let e of Ge)rt.push($e(e,0));!Be&&We.hiddenCount>0&&(Ze.push(`overflow:workspaces`),rt.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>{Ve(!0)},children:O(`workspaces.expand`)},`overflow:workspaces`)))}let it=Le.find(e=>e.key===``);return it!==void 0&&rt.push($e(it,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.treeBody,Z.wide),children:[nt&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(Ig,{className:R(Z.list,nt&&Z.listTopDropActive),label:O(`section.sessions`),rowKeys:Ze,ready:e.phase===`ready`&&m&&!Ee,resetKey:JSON.stringify([g,he,Be,Ke,Je]),children:[/* @__PURE__ */ (0,o.jsx)(Hg,{rows:Xe,currentId:M,showHost:!j,onOpen:r,onRenameRequest:ee,renderSlot:b,revealSessionId:k,onSessionRevealed:re,expanded:Ke,onToggle:()=>{w(xe,!Ke)},t:O}),/* @__PURE__ */ (0,o.jsx)(ov,{sections:qe,groupRows:et,currentId:M,showHost:!j,onOpen:r,onRenameRequest:ee,renderSlot:b,revealSessionId:k,onSessionRevealed:re,setSectionExpanded:w,t:O}),!A&&Ne.length===0&&Xe.length===0&&f.length===0&&/* @__PURE__ */ (0,o.jsx)(tv,{rowState:d,onLeaveArchivedOnly:p,partial:e.hasMore,t:O}),tt&&/* @__PURE__ */ (0,o.jsx)(zg,{label:O(`section.workspaces`),expanded:Je,onToggle:()=>{Je&&Ve(!1),w(`workspaces`,!Je)},rowKey:`section:workspaces`}),rt]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}let rv=[];function iv(e,t,n,r,i,a){if(!e.length)return[];let o=a??new Map(fe(t,n,r).map(e=>[e.id,e])),s=/* @__PURE__ */ new Set;return e.map(({id:e,name:t,threadIds:n})=>{let r=`native-section:${e}`;return{id:e,key:r,name:t,rows:n.flatMap(e=>{let t=o.get(e);return!t||t.pinned||s.has(e)?[]:(s.add(e),[t])}),expanded:Ce(i,r)}})}function av(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function ov({sections:e,groupRows:t,setSectionExpanded:n,...r}){return e.map(({key:e,name:i,rows:a,expanded:s})=>/* @__PURE__ */ (0,o.jsx)(Hg,{...r,rows:a,customSection:{key:e,name:i},expanded:s,onToggle:()=>n(e,!s),children:t?.get(e)},e))}function sv({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,hostScopeFiltered:ee=!1,singleRemoteHostScoped:b=!1,onResetHostScope:x,t:S}){let C=u(e=>e.activePanelId!==null),te=a(e=>e),ne=pn(),w=(0,s.useMemo)(()=>new Map(fe(e,n,te).map(e=>[e.id,e])),[e,n,te]),T=(0,s.useMemo)(()=>ge(e,t,n,te,w).filter(e=>!e.pinned&&!n.sectionedSessionIds?.has(e.id)),[e,t,n,te,w]),E=(0,s.useMemo)(()=>ge(e,n.pinnedSessionIds,n,te,w).filter(e=>e.pinned),[e,n,te,w]),[D,O]=(0,s.useState)(null),k=(0,s.useRef)(!1),[re,ie]=(0,s.useState)(10);X_(D!==null);let ae=C?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,A=Gg(T,re,ae,g),j=Gg(T,10,ae,g).hiddenCount>0,oe=(e,n)=>{if(k.current)return;k.current=!0,O(null);let r=Q_(t,T,e,n);r!==void 0&&d(be,r)},se=Date.now(),ce=Ce(f,xe),le=(0,s.useMemo)(()=>iv(r,e,n,te,f,w),[r,e,n,te,f,w]);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(Ig,{className:R(Z.list,Z.flatList),label:S(`section.sessions`),rowKeys:[...E.length===0?[]:[`section:${xe}`],...ce?ne.rows(E).map(e=>`session:${e.id}`):[],...av(le,ne.rows),...T.length===0&&E.length===0&&r.length===0?[ee?`empty:host-scope`:`empty`]:[],...ne.rows(A.rows).map(e=>`session:${e.id}`),...j||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&m&&D===null,resetKey:`${h}/${re}/${String(ce)}`,children:[/* @__PURE__ */ (0,o.jsx)(Hg,{rows:E,currentId:ae,showHost:!b,onOpen:c,onRenameRequest:l,renderSlot:v,revealSessionId:g,onSessionRevealed:_,expanded:ce,onToggle:()=>{p(xe,!ce)},t:S}),/* @__PURE__ */ (0,o.jsx)(ov,{sections:le,currentId:ae,showHost:!b,onOpen:c,onRenameRequest:l,renderSlot:v,revealSessionId:g,onSessionRevealed:_,setSectionExpanded:p,t:S}),(E.length>0||r.length>0)&&/* @__PURE__ */ (0,o.jsx)(zg,{label:S(`section.sessions`)}),T.length===0&&E.length===0&&r.length===0&&(ee?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:S(`hostScope.emptySessions`)}),x!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:x,children:S(`hostScope.showAll`)})]}):/* @__PURE__ */ (0,o.jsx)(tv,{rowState:n,onLeaveArchivedOnly:i,partial:e.hasMore,t:S})),/* @__PURE__ */ (0,o.jsx)(hg,{roots:A.rows,children:e=>{let t=D!==null&&D.pinned===e.pinned,n=t=>e.blank?`after`:t;return/* @__PURE__ */ (0,o.jsx)(Og,{node:e,showHost:!b,currentId:ae,now:se,onOpen:c,onRenameRequest:l,renderSlot:v,onReveal:e.id===g?()=>{_(e.id)}:void 0,drag:{start:()=>{k.current=!1,O({accountKey:be,sessionId:e.id,pinned:e.pinned,over:null})},active:t,marker:t&&D.over?.id===e.id?D.over.half:null,hover:t=>{O(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{D!==null&&oe(D,{id:e.id,half:n(t)})},end:e=>{!e&&D?.over!==null&&D?.over!==void 0?oe(D,D.over):O(null),k.current=!1}},t:S},e.id)}}),/* @__PURE__ */ (0,o.jsx)(qg,{rowKey:`overflow:flat`,hiddenCount:A.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:re>10,expand:()=>ie(re+10),collapse:j?()=>ie(10):void 0,loadMoreSessions:y,t:S})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function cv({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)(()=>_e(h,i,l,a,c,g,_,d),[h,i,l,a,c,g,_,d]),y=_.status===`loading`,ee=m?void 0:Object.values(h.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.list,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchTree,role:`tree`,"aria-label":p(`search.results.aria`),children:v.items.map(e=>/* @__PURE__ */ (0,o.jsx)(Dg,{result:e,currentId:ee,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:Z.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonDot}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.skeletonBars,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonBar}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Z.skeletonBar,Z.skeletonBarWide)})]})]},e))}),!y&&v.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,children:p(`search.noMatches`)}),v.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchStatus,children:p(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function lv(e){return/* @__PURE__ */ (0,o.jsx)(mn,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(uv,{...e})})}function uv({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:ee,searchResultLimit:b,useDirectoryFlow:x,useHostInfo:S,useShortcuts:C,useWorkspaceShortcuts:te,requestSearch:ne,requestAddWorkspace:w,closeAddWorkspace:T,setDirectoryBusy:E,dismissForkError:D,refreshSessions:ie,loadMoreSessions:ae,renderSlot:A,t:j}){let oe=S(e=>e.home),se=C(e=>e),ce=se.find(e=>e.id===`session.search`),le=se.find(e=>e.id===`workspace.add`),ue=te(e=>e),M=r(e=>e),de=c(e=>e.items),fe=c(e=>e.canStartProjectless===!0),pe=j(`workspace.defaultName`),he=(0,s.useMemo)(()=>de.map(e=>({...e,title:un(e.title,pe)})),[de,pe]),ge=c(e=>e.phase),_e=c(e=>e.state),ve=c(e=>e.archivedSessionIds),ye=c(e=>e.pinnedSessionIds),xe=c(e=>e.threadSections??rv),Se=x(e=>e),Ce=l(e=>e.groupBy),N=l(e=>e.orderBy),we=l(e=>e.archivedFilter??`default`),Oe=l(e=>e.groupExpansion),ke=pn(),Ae=l(e=>e.sectionExpansion),je=l(e=>e.sessionOrderByAccount),Me=e=>{ve.includes(e)?m():(ke.selectSidebarRow(e),f(e))},Ne=()=>{u.setArchivedFilter(`default`)},Pe=ge===`ready`&&_e!==`loading`,Fe=Object.values(M.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,P=Fe!==void 0&&M.byId[Fe]?.blank===!0?Fe:void 0,Ie=(0,s.useMemo)(()=>{let e=new Set(he.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...M.ids,...ve])].filter(t=>!e.has(t))},[ve,M.ids,he]),Le=(0,s.useMemo)(()=>({pinnedSessionIds:ye,archivedSessionIds:ve}),[ve,ye]),Re=we===`only`?rv:xe,ze=(0,s.useMemo)(()=>({...Le,archivedFilter:we,sectionedSessionIds:new Set(Re.flatMap(e=>e.threadIds))}),[Le,we,Re]),Be=(0,s.useMemo)(()=>me(M,ve),[ve,M]),Ve=(0,s.useMemo)(()=>Te(M,ze,ke.forest),[M,ze,ke.forest]),He=(0,s.useMemo)(()=>he.map(e=>{let{memberIds:t,linkedRootIds:n}=Ee(e.sessionIds,Ve),r=N===`updated`?O(t,Ve.summaries):k(t,je[e.workspaceId],Ve.summaries,Le);return{workspace:{...e,sessionIds:re(r,P!==void 0&&t.includes(P)?P:void 0)},linkedRootIds:n}}),[P,Ve,N,Le,je,he]),Ue=(0,s.useMemo)(()=>He.map(({workspace:e})=>e),[He]),We=(0,s.useMemo)(()=>new Map(He.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[He]),Ge=(0,s.useMemo)(()=>O(Ie.filter(e=>Ve.rootIds.has(e)),Ve.summaries),[Ve,Ie]),Ke=(0,s.useMemo)(()=>{let e=Be.filter(e=>Ve.rootIds.has(e));return re(N===`updated`?O(e,Ve.summaries):k(e,je[be],Ve.summaries,Le),P!==void 0&&Be.includes(P)?P:void 0)},[P,Be,Ve,N,Le,je]),qe=(0,s.useMemo)(()=>De(he,M,ze,Ve),[M,ze,Ve,he]),Je=(0,s.useMemo)(()=>Object.fromEntries([...Ue.map(e=>[e.workspaceId,e.sessionIds]),[``,Ge],[be,Ke]]),[Ke,Ge,Ue]);(0,s.useEffect)(()=>{ge===`ready`&&u.retainAccountKeys([``,be,...he.map(e=>e.workspaceId)])},[u.retainAccountKeys,ge,he]),(0,s.useEffect)(()=>{if(M.phase!==`ready`||Pe||N!==`manual`||P===void 0)return;let e={};for(let[t,n]of Object.entries(Je)){if(t!==`__flat_session_order__`&&ge!==`ready`)continue;let r=je[t]??[];n[0]===P&&r[0]!==P&&(e[t]=[P,...r.filter(e=>e!==P)])}Object.keys(e).length>0&&u.syncSessionOrders(e,qe)},[u.syncSessionOrders,Je,P,M.phase,N,je,qe,ge,Pe]),(0,s.useEffect)(()=>{M.phase===`ready`&&Pe&&N===`manual`&&P!==void 0&&Object.entries(Je).some(([e,t])=>t[0]===P&&je[e]?.[0]!==P)&&u.syncSessionOrders(Je,qe)},[u.syncSessionOrders,Je,P,M.phase,N,je,qe,Pe]);let Ye=(e,t)=>{u.setSessionOrder(e,t,Je,qe)},[Xe,Ze]=(0,s.useState)(``),[Qe,$e]=(0,s.useState)(!1),[et,tt]=(0,s.useState)(void 0),nt=Y_(Xe).trim(),[F,rt]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),it=(0,s.useRef)(null),at=(0,s.useRef)(null),ot=ue.addRequested,st=(0,s.useRef)(null),[ct,lt]=(0,s.useState)(!1),[ut,dt]=(0,s.useState)(()=>h_()),ft=(0,s.useRef)(null);if(ft.current===null){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(ut.perHost))t!==`local`&&t!==ut.selectedHost&&e.add(t);ft.current=e}let pt=(0,s.useCallback)(e=>{dt(e),g_(e)},[]);(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t||typeof t.hostId!=`string`||t.hostId===``||!Array.isArray(t.workspaceIds))return;let n=t.workspaceIds.filter(e=>typeof e==`string`);ft.current?.add(t.hostId),dt(e=>{let r=u_(e,t.hostId,n);return g_(r),r})};return window.addEventListener(Yg,e),()=>{window.removeEventListener(Yg,e)}},[]),(0,s.useEffect)(()=>{if(ge!==`ready`||_e!==`idle`)return;let e=window.setTimeout(()=>{let e=ft.current;if(e!==null&&e.size>0)for(let t of Ue){let n=t.remote?.hostId;n!==void 0&&t.remote?.state===`connected`&&e.delete(n)}let t=e_(ut,Ue,e===null||e.size===0?void 0:{preserveHostKeys:e});t!==ut&&pt(t)},250);return()=>{window.clearTimeout(e)}},[ut,Ue,pt,ge,_e]);let mt=()=>{pt(d_())},ht=(0,s.useMemo)(()=>Xg(Ue),[Ue]),gt=(0,s.useMemo)(()=>Zg(Ue),[Ue]),_t=(0,s.useMemo)(()=>$g(ut,Ue),[ut,Ue]),vt=(0,s.useMemo)(()=>ht&&t_(_t,Ue),[ht,_t,Ue]),yt=(0,s.useMemo)(()=>ht&&_t.selectedHost!==`all`&&_t.selectedHost!==`local`,[ht,_t.selectedHost]),bt=(0,s.useMemo)(()=>vt?n_(Ue,_t):Ue,[vt,Ue,_t]),xt=(0,s.useMemo)(()=>new Set(bt.map(e=>e.workspaceId)),[bt]),St=(0,s.useMemo)(()=>vt?a_(Ke.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),xt,Ue,_t).map(e=>e.id):Ke,[vt,Ke,M.byId,xt,Ue,_t]),Ct=(0,s.useMemo)(()=>{if(!vt)return M;let e=new Set(a_(M.ids.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),xt,Ue,_t,Ve.rootOf).map(e=>e.id));return{...M,ids:M.ids.filter(t=>e.has(t))}},[vt,M,xt,Ue,_t,Ve.rootOf]),wt=(0,s.useMemo)(()=>vt?JSON.stringify(_t):`all`,[vt,_t]),Tt=()=>{let e=_t.selectedHost!==`all`&&_t.selectedHost!==`local`?_t.selectedHost:void 0;window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:e===void 0?{}:{hostId:e}}))},Et=(0,s.useRef)(!1),Dt=e=>{if(ve.includes(e)){m();return}let t=ke.rootId(e),n=he.find(e=>e.sessionIds.includes(t));if(vt){let e=f_(_t,n,Ue);e!==_t&&pt(e)}let r=Ce===`flat`?void 0:n?.workspaceId,i=Re.find(({threadIds:e})=>e.includes(t))??(r===void 0?void 0:Re.find(({workspaceIds:e})=>e?.includes(r)===!0));i&&u.setSectionExpanded(`native-section:${i.id}`,!0),tt(e),Ze(``),$e(!1),ke.reveal(e),f(e)},Ot=e=>{tt(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{nt!==``&&tt(void 0)},[nt]);let[I,L]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&I){let e=window.setTimeout(()=>{at.current?.focus({preventScroll:!0}),L(!1)},300);return()=>{window.clearTimeout(e)}}},[e,I]),(0,s.useEffect)(()=>{ue.searchRequest!==0&&(T(),$e(!0),e?at.current?.focus({preventScroll:!0}):(L(!0),n()))},[ue.searchRequest]),(0,s.useEffect)(()=>{e&&Qe&&!I&&at.current?.focus({preventScroll:!0})},[e,Qe,I]),(0,s.useEffect)(()=>{if(!e||!Qe||I)return;let t=e=>{e.target instanceof Node&&it.current?.contains(e.target)!==!0&&(at.current?.blur(),nt===``&&$e(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[nt,e,Qe,I]),(0,s.useEffect)(()=>{if(nt===``){rt({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;rt({query:nt,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{ee(nt,e.signal).then(t=>{e.signal.aborted||rt({query:nt,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||rt({query:nt,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[nt,ee]);let[kt,At]=(0,s.useState)(null),[jt,Mt]=(0,s.useState)(``),[Nt,Pt]=(0,s.useState)(!1),[Ft,It]=(0,s.useState)(null),Lt=jt.trim(),Rt=kt!==null&&Lt!==``&&he.some(e=>e.workspaceId!==kt.workspaceId&&e.title===Lt),zt=Nt||Lt===``||kt===null||Lt===kt.storedTitle||Rt,Bt=()=>{Nt||(At(null),It(null))},Vt=()=>{zt||(Pt(!0),It(null),h(kt.workspaceId,Lt).then(()=>{Pt(!1),At(null)}).catch(e=>{Pt(!1),It(e instanceof Error?e.message:String(e))}))},Ht=e=>{v(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[Ut,Wt]=(0,s.useState)(null),[Gt,Kt]=(0,s.useState)(!1),[qt,Jt]=(0,s.useState)(null),[Yt,Xt]=(0,s.useState)(null);(0,s.useEffect)(()=>{qt===null||he.some(e=>e.workspaceId===qt)||(Kt(!1),Jt(null),Wt(null))},[qt,he]);let Zt=()=>{Gt||(Wt(null),Xt(null))},Qt=()=>{
|
|
132
132
|
/* v8 ignore next -- the Modal is absent without a target and its button is disabled while deleting. */
|
|
133
|
-
Kt||Wt===null||(qt(!0),Yt(null),Zt(null),g(Wt.workspaceId).then(()=>{Yt(Wt.workspaceId)}).catch(e=>{qt(!1),Zt(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.root,!e&&Z.rail),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.sectionHeader,children:[e&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Z.sectionLabel,Z.wide,Qe&&Z.sectionLabelHidden),children:A(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:R(Z.searchSlot,Qe&&Z.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:it,className:R(Z.search,Qe&&Z.searchExpanded),onClick:()=>{D(),$e(!0),at.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`search`),shortcutKeys:le?.keys,side:`bottom`,delayMs:500,disabled:Qe,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":A(`search.sessions.aria`),"aria-keyshortcuts":le?.aria,"aria-expanded":Qe,onClick:()=>{ee()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:at,className:Z.searchInput,type:`text`,placeholder:A(`search.placeholder`),maxLength:500,value:Xe,tabIndex:Qe?0:-1,onChange:e=>{Ze(M_(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),Ze(``),$e(!1))}}),Qe&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.clearButton,"aria-label":A(`search.clear`),onClick:e=>{e.stopPropagation(),Ze(``),$e(!1)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.headerActions,e&&Qe&&Z.headerActionsHidden),children:[e&&/* @__PURE__ */ (0,o.jsx)(P_,{groupBy:we,orderBy:M,archivedFilter:Oe,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,Je,qe)},onArchivedFilterPick:u.setArchivedFilter,t:A}),e&>?Ce?/* @__PURE__ */ (0,o.jsx)(a.Menu,{phoneSidebarTitle:A(`workspace.add`),open:ct,onClose:()=>{lt(!1)},items:[{id:`add-local`,label:A(`workspace.addLocal`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})},{id:`add-remote`,label:A(`workspace.addRemote`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconGlobeOutlineRegular,{})}],onSelect:e=>{lt(!1),e===`add-local`?E():e===`add-remote`&&Et()},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.add`),shortcutKeys:ue?.keys,side:`bottom`,delayMs:500,disabled:ct,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:st,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.add`),"aria-keyshortcuts":ue?.aria,"aria-haspopup":`menu`,"aria-expanded":ct,onClick:()=>{lt(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})})}):/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.addRemote`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:st,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.addRemote`),onClick:Et,children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})}):Ce&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.add`),shortcutKeys:ue?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:st,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.add`),"aria-keyshortcuts":ue?.aria,onClick:()=>{E()},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(A_,{t:A,open:ot,anchorRef:st,useWorkspaces:c,createWorkspace:y,useDirectoryFlow:S,renderDirectoryFlow:e=>oe(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:te,side:`right`,onPick:e=>{D(),d(e)},onClose:()=>{D()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.search,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`search`),shortcutKeys:le?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":A(`search.sessions.aria`),"aria-keyshortcuts":le?.aria,onClick:()=>{ee()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:18})})})}),e&&ht&&tt===``&&/* @__PURE__ */ (0,o.jsx)(a_,{workspaces:P,state:_t,onChange:pt,t:A}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.listArea,children:[e&&j.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,role:`status`,children:A(`sessions.loading`)}),e&&(tt===``?we===`flat`?/* @__PURE__ */ (0,o.jsx)(U_,{loadMoreSessions:k,usePanelInfo:t,list:Ct,sessionIds:St,rowState:Be,nativeSections:ze,onLeaveArchivedOnly:Pe,workspaceReady:Fe,animationResetKey:`${we}/${M}/${Oe}/${wt}`,useSessionStatus:i,open:Ne,onSessionRenameRequest:p,renderSlot:oe,setSessionOrder:Ye,sectionExpansion:je,setSectionExpanded:u.setSectionExpanded,revealSessionId:et,onSessionRevealed:Dt,hostScopeFilterControl:Tt,hostScopeFiltered:vt,singleRemoteHostScoped:yt,onResetHostScope:mt,t:A}):/* @__PURE__ */ (0,o.jsx)(R_,{loadMoreSessions:k,usePanelInfo:t,list:Ct,shortcuts:ce,useSessionStatus:i,onSessionRenameRequest:p,renderSlot:oe,workspaces:bt,linkedRoots:We,ungroupedSessionIds:Ge,canStartProjectless:pe,workspaceReady:Fe,nestWorkspaces:we===`workspace-tree`,animationResetKey:`${we}/${M}/${Oe}/${wt}`,groupExpansion:ke,setGroupExpanded:u.setGroupExpanded,sectionExpansion:je,setSectionExpanded:u.setSectionExpanded,setSessionOrder:Ye,rowState:Be,nativeSections:ze,onLeaveArchivedOnly:Pe,startSession:d,open:Ne,insertWorkspaceBefore:_,revealSessionId:et,onSessionRevealed:Dt,hostScopeFilterControl:Tt,hostScopeFiltered:vt,singleRemoteHostScoped:yt,onResetHostScope:mt,home:se,t:A,onRenameRequest:(e,t)=>{jt({workspaceId:e,storedTitle:fe.find(t=>t.workspaceId===e)?.title??t}),Nt(t),Lt(null)},onDeleteRequest:(e,t)=>{Gt({workspaceId:e,title:t}),Zt(null)}}):/* @__PURE__ */ (0,o.jsx)(W_,{usePanelInfo:t,useSessions:r,useSessionStatus:i,open:L,onUnarchive:Ut,workspaces:ge,archivedSessionIds:ye,archivedFilter:Oe,query:tt,remote:nt,resultLimit:x,t:A}))]}),e&&/* @__PURE__ */ (0,o.jsx)(Og,{list:j,refreshSessions:ae,loadMoreSessions:k,t:A}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:At!==null,onClose:Vt,closeLabel:A(`close`),title:A(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:Pt,onClick:Vt,children:A(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:Bt,onClick:Ht,children:A(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:Mt,"aria-label":A(`field.workspaceName`),"data-modal-autofocus":!0,disabled:Pt,onFocus:e=>{e.target.select()},onChange:e=>{Nt(e.target.value),Lt(null)},onCompositionStart:()=>{I.current=!0},onCompositionEnd:()=>{I.current=!1},onKeyDown:e=>{e.key===`Enter`&&!I.current&&(e.preventDefault(),Ht())}}),zt&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:A(`conflict.named`,{name:Rt})}),It!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:It})]}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:Wt!==null,onClose:Qt,closeLabel:A(`close`),title:A(`delete.workspace`),...Wt===null?{}:{description:A(`delete.desc`,{name:Wt.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:Kt,onClick:Qt,children:A(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:Kt,onClick:$t,children:A(`delete.workspace`)})]}),children:[Kt&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:A(`delete.pending`)}),Xt!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:Xt})]}),de.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:A(de.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:ie},de.forkError.seq)]})}function q_({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 J_({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:F.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 Y_({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(X_,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function X_({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:Z.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:Z.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:Z_(e,r)},`${e.kind}-${String(t)}`))]}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function Z_(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 Q_({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)($_,{request:n,...t},n.sessionId):null}function $_({request:e,choose:t,dismiss:n,t:r}){return/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,open:!0,title:r(`archive.children.title`),description:r(`archive.children.description`,{title:e.title}),closeLabel:r(`close`),onClose:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,onClick:()=>t(e,!1),children:r(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,onClick:()=>t(e,!0),children:r(`archive.children.include`,{n:e.children.length})})]}),children:/* @__PURE__ */ (0,o.jsx)(`ul`,{className:Z.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))})})}function ev(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 tv({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 nv({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(rv,{request:n,...t},n.sessionId):null}function rv({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:Z.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:Z.renameError,role:`alert`,children:r(`section.moveFailed`)})]})}function iv({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 av({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&S(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 ov({sessionId:e,usePinned:t,useArchived:n}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e))}}function sv(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:s}=e,[,c]=n(),{pinned:l,archived:u}=ov(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 cv(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:s,archived:c}=ov(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:F.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 lv({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 uv({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(dv,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function dv({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:Z.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:Z.renameError,role:`alert`,children:d})]})}let fv=6e3;function pv({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:fv,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:fv,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:mv(c,s),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function mv(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`);
|
|
133
|
+
Gt||Ut===null||(Kt(!0),Jt(null),Xt(null),g(Ut.workspaceId).then(()=>{Jt(Ut.workspaceId)}).catch(e=>{Kt(!1),Xt(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.root,!e&&Z.rail),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.sectionHeader,children:[e&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:R(Z.sectionLabel,Z.wide,Qe&&Z.sectionLabelHidden),children:j(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:R(Z.searchSlot,Qe&&Z.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:it,className:R(Z.search,Qe&&Z.searchExpanded),onClick:()=>{T(),$e(!0),at.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:j(`search`),shortcutKeys:ce?.keys,side:`bottom`,delayMs:500,disabled:Qe,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":j(`search.sessions.aria`),"aria-keyshortcuts":ce?.aria,"aria-expanded":Qe,onClick:()=>{ne()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:at,className:Z.searchInput,type:`text`,placeholder:j(`search.placeholder`),maxLength:500,value:Xe,tabIndex:Qe?0:-1,onChange:e=>{Ze(Y_(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),Ze(``),$e(!1))}}),Qe&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.clearButton,"aria-label":j(`search.clear`),onClick:e=>{e.stopPropagation(),Ze(``),$e(!1)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:R(Z.headerActions,e&&Qe&&Z.headerActionsHidden),children:[e&&/* @__PURE__ */ (0,o.jsx)(Z_,{groupBy:Ce,orderBy:N,archivedFilter:we,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,Je,qe)},onArchivedFilterPick:u.setArchivedFilter,t:j}),e&>?Se?/* @__PURE__ */ (0,o.jsx)(a.Menu,{phoneSidebarTitle:j(`workspace.add`),open:ct,onClose:()=>{lt(!1)},items:[{id:`add-local`,label:j(`workspace.addLocal`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})},{id:`add-remote`,label:j(`workspace.addRemote`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconGlobeOutlineRegular,{})}],onSelect:e=>{lt(!1),e===`add-local`?w():e===`add-remote`&&Tt()},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:j(`workspace.add`),shortcutKeys:le?.keys,side:`bottom`,delayMs:500,disabled:ct,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:st,type:`button`,className:Z.iconButton,"aria-label":j(`workspace.add`),"aria-keyshortcuts":le?.aria,"aria-haspopup":`menu`,"aria-expanded":ct,onClick:()=>{lt(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})})}):/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:j(`workspace.addRemote`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:st,type:`button`,className:Z.iconButton,"aria-label":j(`workspace.addRemote`),onClick:Tt,children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})}):Se&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:j(`workspace.add`),shortcutKeys:le?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:st,type:`button`,className:Z.iconButton,"aria-label":j(`workspace.add`),"aria-keyshortcuts":le?.aria,onClick:()=>{w()},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(q_,{t:j,open:ot,anchorRef:st,useWorkspaces:c,createWorkspace:y,useDirectoryFlow:x,renderDirectoryFlow:e=>A(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:E,side:`right`,onPick:e=>{T(),d(e)},onClose:()=>{T()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.search,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:j(`search`),shortcutKeys:ce?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":j(`search.sessions.aria`),"aria-keyshortcuts":ce?.aria,onClick:()=>{ne()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:18})})})}),e&&ht&&nt===``&&/* @__PURE__ */ (0,o.jsx)(S_,{workspaces:Ue,state:_t,onChange:pt,t:j}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.listArea,children:[e&&M.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,role:`status`,children:j(`sessions.loading`)}),e&&(nt===``?Ce===`flat`?/* @__PURE__ */ (0,o.jsx)(sv,{loadMoreSessions:ae,usePanelInfo:t,list:Ct,sessionIds:St,rowState:ze,nativeSections:Re,onLeaveArchivedOnly:Ne,workspaceReady:Pe,animationResetKey:`${Ce}/${N}/${we}/${wt}`,useSessionStatus:i,open:Me,onSessionRenameRequest:p,renderSlot:A,setSessionOrder:Ye,sectionExpansion:Ae,setSectionExpanded:u.setSectionExpanded,revealSessionId:et,onSessionRevealed:Ot,hostScopeFiltered:vt,singleRemoteHostScoped:yt,onResetHostScope:mt,t:j}):/* @__PURE__ */ (0,o.jsx)(nv,{loadMoreSessions:ae,usePanelInfo:t,list:Ct,shortcuts:se,useSessionStatus:i,onSessionRenameRequest:p,renderSlot:A,workspaces:bt,allWorkspaces:Ue,linkedRoots:We,ungroupedSessionIds:Ge,canStartProjectless:fe,workspaceReady:Pe,nestWorkspaces:Ce===`workspace-tree`,animationResetKey:`${Ce}/${N}/${we}/${wt}`,groupExpansion:Oe,setGroupExpanded:u.setGroupExpanded,sectionExpansion:Ae,setSectionExpanded:u.setSectionExpanded,setSessionOrder:Ye,rowState:ze,nativeSections:Re,onLeaveArchivedOnly:Ne,startSession:d,open:Me,insertWorkspaceBefore:_,revealSessionId:et,onSessionRevealed:Ot,hostScopeFiltered:vt,singleRemoteHostScoped:yt,onResetHostScope:mt,home:oe,t:j,onRenameRequest:(e,t)=>{At({workspaceId:e,storedTitle:de.find(t=>t.workspaceId===e)?.title??t}),Mt(t),It(null)},onDeleteRequest:(e,t)=>{Wt({workspaceId:e,title:t}),Xt(null)}}):/* @__PURE__ */ (0,o.jsx)(cv,{usePanelInfo:t,useSessions:r,useSessionStatus:i,open:Dt,onUnarchive:Ht,workspaces:he,archivedSessionIds:ve,archivedFilter:we,query:nt,remote:F,resultLimit:b,t:j}))]}),e&&/* @__PURE__ */ (0,o.jsx)(Wg,{list:M,refreshSessions:ie,loadMoreSessions:ae,t:j}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:kt!==null,onClose:Bt,closeLabel:j(`close`),title:j(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:Nt,onClick:Bt,children:j(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:zt,onClick:Vt,children:j(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:jt,"aria-label":j(`field.workspaceName`),"data-modal-autofocus":!0,disabled:Nt,onFocus:e=>{e.target.select()},onChange:e=>{Mt(e.target.value),It(null)},onCompositionStart:()=>{Et.current=!0},onCompositionEnd:()=>{Et.current=!1},onKeyDown:e=>{e.key===`Enter`&&!Et.current&&(e.preventDefault(),Vt())}}),Rt&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:j(`conflict.named`,{name:Lt})}),Ft!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:Ft})]}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:Ut!==null,onClose:Zt,closeLabel:j(`close`),title:j(`delete.workspace`),...Ut===null?{}:{description:j(he.find(e=>e.workspaceId===Ut.workspaceId)?.projectId?`delete.nativeProject`:`delete.desc`,{name:Ut.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:Gt,onClick:Zt,children:j(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:Gt,onClick:Qt,children:j(`delete.workspace`)})]}),children:[Gt&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:j(`delete.pending`)}),Yt!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:Yt})]}),ue.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:j(ue.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:D},ue.forkError.seq)]})}function dv({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 fv({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:F.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 pv({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(mv,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function mv({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:Z.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:Z.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:hv(e,r)},`${e.kind}-${String(t)}`))]}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function hv(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 gv({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(_v,{request:n,...t},n.sessionId):null}function _v({request:e,choose:t,dismiss:n,t:r}){return/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,open:!0,title:r(`archive.children.title`),description:r(`archive.children.description`,{title:e.title}),closeLabel:r(`close`),onClose:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,onClick:()=>t(e,!1),children:r(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,onClick:()=>t(e,!0),children:r(`archive.children.include`,{n:e.children.length})})]}),children:/* @__PURE__ */ (0,o.jsx)(`ul`,{className:Z.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))})})}function vv(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 yv({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 bv({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(xv,{request:n,...t},n.sessionId):null}function xv({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:Z.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:Z.renameError,role:`alert`,children:r(`section.moveFailed`)})]})}function Sv({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 Cv({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&S(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 wv({sessionId:e,usePinned:t,useArchived:n}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e))}}function Tv(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:s}=e,[,c]=n(),{pinned:l,archived:u}=wv(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 Ev(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:s,archived:c}=wv(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:F.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 Dv({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 Ov({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(kv,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function kv({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:Z.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:Z.renameError,role:`alert`,children:d})]})}let Av=6e3;function jv({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:Av,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:Av,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:Mv(c,s),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function Mv(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`);
|
|
134
134
|
/* v8 ignore next 2 -- closed-union backstop; only reached if a notice kind is forged */
|
|
135
|
-
default:return v(e)}}let hv={"host.local":`本机`,"host.thisComputer":`此计算机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"heroPicker.location.aria":`选择工作位置:{current}`,"heroPicker.location.placeholder":`工作位置`,"heroPicker.location.empty":`无匹配位置`,"heroPicker.location.connectRemote":`连接远程主机…`,"heroPicker.location.manageRemote":`管理远程主机`,"heroPicker.project.aria":`选择项目:{current}`,"heroPicker.project.choose":`选择项目`,"heroPicker.project.noProject":`不选择项目`,"heroPicker.project.placeholder":`搜索项目`,"heroPicker.project.empty":`该位置暂无项目`,"heroPicker.project.noMatches":`无匹配项目`,"heroPicker.project.new":`新建项目`,"hostScope.allShort":`全部`,"hostScope.allHosts":`全部主机`,"hostScope.filtered":`已筛选`,"hostScope.trigger.aria":`主机与工作区范围筛选:{current}`,"hostScope.popover.aria":`主机与工作区范围筛选`,"hostScope.host.label":`选择主机`,"hostScope.scope.label":`展示范围`,"hostScope.scope.allSessions":`全部会话`,"hostScope.scope.selectedWorkspaces":`仅选定工作区`,"hostScope.selectedCount":`已选 {selected}/{total}`,"hostScope.selectAll":`全选`,"hostScope.clear":`清空`,"hostScope.reset":`重置筛选`,"hostScope.noHostWorkspaces":`该主机暂无工作区`,"hostScope.emptyWorkspaces":`当前筛选下暂无工作区`,"hostScope.emptySessions":`当前筛选下暂无会话`,"hostScope.showAll":`显示全部`,"hostScope.action.addRemoteWorkspace":`远程新增工作区`,"hostScope.action.manageRemoteHosts":`管理远程主机`,"workspace.addLocal":`添加本机工作区`,"workspace.addRemote":`远程新增工作区…`,"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.partial":`父会话已归档,{n} 个子会话未归档。`,"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}前`},gv={"host.local":`Local`,"host.thisComputer":`This computer`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"heroPicker.location.aria":`Work location: {current}`,"heroPicker.location.placeholder":`Work location`,"heroPicker.location.empty":`No matching locations`,"heroPicker.location.connectRemote":`Connect remote host…`,"heroPicker.location.manageRemote":`Manage remote hosts`,"heroPicker.project.aria":`Project: {current}`,"heroPicker.project.choose":`Choose project`,"heroPicker.project.noProject":`No project`,"heroPicker.project.placeholder":`Search projects`,"heroPicker.project.empty":`No projects on this host`,"heroPicker.project.noMatches":`No matching projects`,"heroPicker.project.new":`New project`,"hostScope.allShort":`All`,"hostScope.allHosts":`All hosts`,"hostScope.filtered":`Filtered`,"hostScope.trigger.aria":`Filter host and workspace scope: {current}`,"hostScope.popover.aria":`Host and workspace scope filter`,"hostScope.host.label":`Host`,"hostScope.scope.label":`Display scope`,"hostScope.scope.allSessions":`All sessions`,"hostScope.scope.selectedWorkspaces":`Selected workspaces`,"hostScope.selectedCount":`{selected}/{total} selected`,"hostScope.selectAll":`Select all`,"hostScope.clear":`Clear`,"hostScope.reset":`Reset`,"hostScope.noHostWorkspaces":`No workspaces on this host`,"hostScope.emptyWorkspaces":`No workspaces match the current filter`,"hostScope.emptySessions":`No sessions match the current filter`,"hostScope.showAll":`Show all`,"hostScope.action.addRemoteWorkspace":`Add remote workspace`,"hostScope.action.manageRemoteHosts":`Manage remote hosts`,"workspace.addLocal":`Add local workspace`,"workspace.addRemote":`Add remote workspace…`,"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.partial":`Parent archived. {n} child sessions could not be archived.`,"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 _v(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!vv(t))continue;let i=j(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 vv(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&e.projectionValues?.threadTreeParent!==void 0}function yv(e,t,n){let r=[];for(let i of _v(e,t,!0)){let t=p(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function bv(e,t,n=_v(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[p(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 xv=()=>!1,Sv=()=>()=>{};function Cv(e){let t=(0,a.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(wv,{...e,closeDrawer:t?.close},e.sessionId)}function wv({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??Sv,c?.getSnapshot??xv),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 Tv=`workspace`,Ev=[`slots`,`sessions`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function Dv(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=M(),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),c=0,f=e=>{s.set({...e,seq:++c})},p=new Ve(e,e.remote.directoryPicker,n,t,a.actions,f),m=nn(e);Kt(e,p,m),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(Tv,{zh:hv,en:gv}),`ui-workspace: dictionaries`);let h=u(),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`),x=e=>{p.openSession(e)},w=ev(n.list,e=>new Set(e.pinnedSessionIds)),T=ev(n.list,e=>new Set(e.archivedSessionIds)),ee=ev(h.state,e=>e.renameTarget),E=(0,r.createSnapshotStore)(null),D=(0,r.createSnapshotStore)(null),te=h.rename,O=e=>{p.unarchiveSession(e).catch(e=>{f({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},ne=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)},re=ev(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))),ie=(0,r.createSnapshotStore)(null),ae=()=>({hooks:{nativeThreads:re,sectionWorkspace:n.list},requestMove:e=>ie.set(e)}),k=()=>({hooks:{threadSectionMove:ie},dismiss:()=>ie.set(null),move:(e,t)=>n.moveSessionToSection?n.moveSessionToSection(e,t):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`))}),oe=()=>({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)})})}}),A=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||bv(n,e,[]).length)throw Error(`Child Session is active`);await p.archiveSession(e)}catch{a++}f({kind:i?`stoppedAndArchived`:`archived`,sessionId:e,failedChildren:a})},se=(e,n)=>{let r=t.list.getSnapshot(),i=r.byId[e],a=i?.displayTitle??e,o=bv(r,e,[]);i?.running||o.length>0?E.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):A(e,n).catch(t=>{let r=Ov(t);r===void 0?f({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):E.set({sessionId:e,displayTitle:a,activity:r,children:n})})},ce=()=>({hooks:{archived:T},archiveSession:e=>{let n=t.list.getSnapshot(),r=yv(n,e,T.getSnapshot());r.length?D.set({sessionId:e,title:n.byId[e]?.displayTitle??e,children:r}):se(e,[])},unarchiveSession:O});d(e,p,h,ce().archiveSession);let le=()=>({hooks:{archiveChildrenRequest:D},dismiss:()=>D.set(null),choose(e,t){D.getSnapshot()===e&&(D.set(null),se(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}),ue=()=>({hooks:{archiveRequest:E},settleSessionArchive:()=>{E.set(null)},stopAndArchiveSession:(e,t=[])=>A(e,t,!0)}),de=()=>({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)})})}}),j=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:S(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(C(r)),f({kind:`sessionLinkCopied`})}catch{f({kind:`sessionLinkCopyFailed`})}})()}}),fe=()=>({requestSessionRename:te}),pe=()=>({hooks:{renameRequest:ee},settleSessionRename:h.closeRename,renameSession:ne}),me=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:O,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),he=()=>({startSession:e=>{p.startSession(e)},open:x,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:g,refreshSessions:()=>{t.refresh()},loadMoreSessions:e=>{t.loadMore(e)},searchResultLimit:t.searchResultLimit,requestSessionRename:te,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}}),ge=()=>({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:l,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:he,locale:Tv},G_)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:Tv,inject:oe},sv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:Tv,inject:ae},tv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:Tv,inject:fe},lv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:Tv,inject:de},iv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:Tv,inject:j},av),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:Tv,inject:ce},q_)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:Tv,inject:ce},J_),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:Tv,inject:oe},cv)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:Tv,inject:k},nv),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:Tv,inject:pe},uv),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:Tv,inject:ue},Y_),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:Tv,inject:le},Q_),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:Tv,store:o,inject:me},pv)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:ge,locale:Tv},j_))}function Ov(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=Cv,n.apply=Dv,n.inject=Ev,t.exports}});
|
|
135
|
+
default:return v(e)}}let Nv={"host.local":`本机`,"host.thisComputer":`此计算机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"heroPicker.location.aria":`选择工作位置:{current}`,"heroPicker.location.placeholder":`工作位置`,"heroPicker.location.empty":`无匹配位置`,"heroPicker.location.connectRemote":`连接远程主机…`,"heroPicker.location.manageRemote":`管理远程主机`,"heroPicker.project.aria":`选择项目:{current}`,"heroPicker.project.choose":`选择项目`,"heroPicker.project.noProject":`不选择项目`,"heroPicker.project.placeholder":`搜索项目`,"heroPicker.project.empty":`该位置暂无项目`,"heroPicker.project.noMatches":`无匹配项目`,"heroPicker.project.new":`新建项目`,"hostScope.allShort":`全部`,"hostScope.allHosts":`全部主机`,"hostScope.filtered":`已筛选`,"hostScope.trigger.aria":`主机与工作区范围筛选:{current}`,"hostScope.popover.aria":`主机与工作区范围筛选`,"hostScope.host.label":`选择主机`,"hostScope.scope.label":`展示范围`,"hostScope.scope.allSessions":`全部会话`,"hostScope.scope.selectedWorkspaces":`仅选定工作区`,"hostScope.selectedCount":`已选 {selected}/{total}`,"hostScope.selectAll":`全选`,"hostScope.clear":`清空`,"hostScope.reset":`重置筛选`,"hostScope.noHostWorkspaces":`该主机暂无工作区`,"hostScope.emptyWorkspaces":`当前筛选下暂无工作区`,"hostScope.emptySessions":`当前筛选下暂无会话`,"hostScope.showAll":`显示全部`,"hostScope.action.addRemoteWorkspace":`远程新增工作区`,"hostScope.action.manageRemoteHosts":`管理远程主机`,"workspace.addLocal":`添加本机工作区`,"workspace.addRemote":`远程新增工作区…`,"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.nativeProject":`将从 Codex 和 Web 的项目列表移除“{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.partial":`父会话已归档,{n} 个子会话未归档。`,"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}前`},Pv={"host.local":`Local`,"host.thisComputer":`This computer`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"heroPicker.location.aria":`Work location: {current}`,"heroPicker.location.placeholder":`Work location`,"heroPicker.location.empty":`No matching locations`,"heroPicker.location.connectRemote":`Connect remote host…`,"heroPicker.location.manageRemote":`Manage remote hosts`,"heroPicker.project.aria":`Project: {current}`,"heroPicker.project.choose":`Choose project`,"heroPicker.project.noProject":`No project`,"heroPicker.project.placeholder":`Search projects`,"heroPicker.project.empty":`No projects on this host`,"heroPicker.project.noMatches":`No matching projects`,"heroPicker.project.new":`New project`,"hostScope.allShort":`All`,"hostScope.allHosts":`All hosts`,"hostScope.filtered":`Filtered`,"hostScope.trigger.aria":`Filter host and workspace scope: {current}`,"hostScope.popover.aria":`Host and workspace scope filter`,"hostScope.host.label":`Host`,"hostScope.scope.label":`Display scope`,"hostScope.scope.allSessions":`All sessions`,"hostScope.scope.selectedWorkspaces":`Selected workspaces`,"hostScope.selectedCount":`{selected}/{total} selected`,"hostScope.selectAll":`Select all`,"hostScope.clear":`Clear`,"hostScope.reset":`Reset`,"hostScope.noHostWorkspaces":`No workspaces on this host`,"hostScope.emptyWorkspaces":`No workspaces match the current filter`,"hostScope.emptySessions":`No sessions match the current filter`,"hostScope.showAll":`Show all`,"hostScope.action.addRemoteWorkspace":`Add remote workspace`,"hostScope.action.manageRemoteHosts":`Manage remote hosts`,"workspace.addLocal":`Add local workspace`,"workspace.addRemote":`Add remote workspace…`,"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.nativeProject":`This removes “{name}” from the project list in Codex and Web. Its folders and conversations are kept. The conversations 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.partial":`Parent archived. {n} child sessions could not be archived.`,"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 Fv(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!Iv(t))continue;let i=de(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 Iv(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&e.projectionValues?.threadTreeParent!==void 0}function Lv(e,t,n){let r=[];for(let i of Fv(e,t,!0)){let t=p(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function Rv(e,t,n=Fv(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[p(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 zv=()=>!1,Bv=()=>()=>{};function Vv(e){let t=(0,a.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(Hv,{...e,closeDrawer:t?.close},e.sessionId)}function Hv({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??Bv,c?.getSnapshot??zv),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 Uv=`workspace`,Wv=[`slots`,`sessions`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function Gv(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=we(),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),c=0,f=e=>{s.set({...e,seq:++c})},p=new Ve(e,e.remote.directoryPicker,n,t,a.actions,f),m=an(e);Jt(e,p,m),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(Uv,{zh:Nv,en:Pv}),`ui-workspace: dictionaries`);let h=u(),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)},ee=_(`conversation.hero.workspace.directoryFlow`),b=e=>{p.openSession(e)},x=vv(n.list,e=>new Set(e.pinnedSessionIds)),te=vv(n.list,e=>new Set(e.archivedSessionIds)),ne=vv(h.state,e=>e.renameTarget),w=(0,r.createSnapshotStore)(null),T=(0,r.createSnapshotStore)(null),E=h.rename,D=e=>{p.unarchiveSession(e).catch(e=>{f({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},O=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)},k=vv(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))),re=(0,r.createSnapshotStore)(null),ie=()=>({hooks:{nativeThreads:k,sectionWorkspace:n.list},requestMove:e=>re.set(e)}),ae=()=>({hooks:{threadSectionMove:re},dismiss:()=>re.set(null),move:(e,t)=>n.moveSessionToSection?n.moveSessionToSection(e,t):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`))}),A=()=>({hooks:{pinned:x,archived:te},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)})})}}),j=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||Rv(n,e,[]).length)throw Error(`Child Session is active`);await p.archiveSession(e)}catch{a++}f({kind:i?`stoppedAndArchived`:`archived`,sessionId:e,failedChildren:a})},oe=(e,n)=>{let r=t.list.getSnapshot(),i=r.byId[e],a=i?.displayTitle??e,o=Rv(r,e,[]);i?.running||o.length>0?w.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):j(e,n).catch(t=>{let r=Kv(t);r===void 0?f({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):w.set({sessionId:e,displayTitle:a,activity:r,children:n})})},se=()=>({hooks:{archived:te},archiveSession:e=>{let n=t.list.getSnapshot(),r=Lv(n,e,te.getSnapshot());r.length?T.set({sessionId:e,title:n.byId[e]?.displayTitle??e,children:r}):oe(e,[])},unarchiveSession:D});d(e,p,h,se().archiveSession);let ce=()=>({hooks:{archiveChildrenRequest:T},dismiss:()=>T.set(null),choose(e,t){T.getSnapshot()===e&&(T.set(null),oe(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}),le=()=>({hooks:{archiveRequest:w},settleSessionArchive:()=>{w.set(null)},stopAndArchiveSession:(e,t=[])=>j(e,t,!0)}),ue=()=>({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)})})}}),M=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:S(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(C(r)),f({kind:`sessionLinkCopied`})}catch{f({kind:`sessionLinkCopyFailed`})}})()}}),de=()=>({requestSessionRename:E}),fe=()=>({hooks:{renameRequest:ne},settleSessionRename:h.closeRename,renameSession:O}),pe=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:D,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),me=()=>({startSession:e=>{p.startSession(e)},open:b,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:g,refreshSessions:()=>{t.refresh()},loadMoreSessions:e=>{t.loadMore(e)},searchResultLimit:t.searchResultLimit,requestSessionRename:E,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}}),he=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:ee}});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:l,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:me,locale:Uv},lv)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:Uv,inject:A},Tv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:Uv,inject:ie},yv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:Uv,inject:de},Dv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:Uv,inject:ue},Sv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:Uv,inject:M},Cv),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:Uv,inject:se},dv)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:Uv,inject:se},fv),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:Uv,inject:A},Ev)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:Uv,inject:ae},bv),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:Uv,inject:fe},Ov),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:Uv,inject:le},pv),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:Uv,inject:ce},gv),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:Uv,store:o,inject:pe},jv)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:he,locale:Uv},J_))}function Kv(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=Vv,n.apply=Gv,n.inject=Wv,t.exports}});
|