import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{er as t,hi as n,mi as r}from"./control-ui-foundation-CeFMP1Ly.js";import{Da as i,To as a,b as o,ba as s,fl as c,ja as l,ml as u,va as d,vr as f,w as p,xo as m,ya as h,yr as g}from"./control-ui-core-pH6nakZ-.js";import{G as _,J as v,W as y,Z as b,at as x,h as S,m as C}from"./lit-runtime-BEtFSUCp.js";import{Cn as w,ln as T,m as E,p as D}from"./control-ui-core-DGVkFhVB.js";import{Ht as O,Lt as k,Rt as A,qt as j}from"./control-ui-core-Br5DB0Zj.js";import{In as M,Ln as N}from"./control-ui-boot-wpHCbPL9.js";import{as as P,is as F}from"./control-ui-boot-Cdpgu1Gm.js";import{n as I,t as L}from"./settings-workspace-Bo4nqRhI.js";function R(e){let t=e.result?.sessions??[];return e.error&&!e.result?_:t.length===0?v`
${j(`dashboardsPage.emptyTitle`)}
${j(`dashboardsPage.emptyDescription`)}
`:v`
${S(t,e=>e.key,t=>{let r=l({face:`dashboard`,sessionKey:t.key,fallbackAgentId:e.fallbackAgentId,basePath:e.basePath,row:t,mainKey:e.mainKey}),i=n({kind:`dashboard`,path:r.href},e.basePath)??r.href;return v``})}
`}function z(e,t){let n=e?v` ${P({status:{error:e.error,hasLoaded:e.result!==null,stale:e.result!==null&&e.error!==null},errorMessage:e.error?j(`dashboardsPage.loadError`,{error:e.error}):void 0,onRetry:t})} ${R(e)} `:v`
${j(`common.loading`)}
`;return v`
${w(`dashboards`)}
${j(`subtitles.dashboards`)}
${I(n)} `}function B(){return(B=e((()=>{r(),y(),C(),T(),A(),F(),L(),O(),p(),m(),i()})))()}var V;function H(){return(H=e((()=>{N(),b(),E(),u(),g(),s(),B(),V=class extends c{constructor(...e){super(...e),this.subscriptions=new f(this).effect(()=>this.context?.agentSelection,e=>(this.bindList(),e.subscribe(()=>this.bindList())))}disconnectedCallback(){this.unsubscribeList?.(),this.unsubscribeList=void 0,this.observedSessions=void 0,this.observedScopeId=void 0,this.subscriptions.clear(),super.disconnectedCallback()}willUpdate(e){e.has(`routeData`)&&(this.data=this.routeData),this.bindList()}bindList(){let e=this.context;if(!e)return;let t=e.sessions,n=e.agentSelection.state.scopeId?.trim()||null;if(t===this.observedSessions&&n===this.observedScopeId)return;this.unsubscribeList?.(),this.observedSessions=t,this.observedScopeId=n;let r=d(e),i=r=>{this.context!==e||this.observedSessions!==t||this.observedScopeId!==n||!r.result&&!r.error||(this.data=h(e,r),this.requestUpdate())};this.unsubscribeList=t.subscribeList(r,i);let a=t.listSnapshot(r);i(a),!a.result&&!a.loading&&e.gateway.snapshot.phase===`connected`&&t.refreshList({...r,force:!0})}render(){return z(this.data,()=>{let e=this.context;e?.gateway.snapshot.phase===`connected`&&e.sessions.refreshList({...d(e),force:!0})})}},t([M({context:D,subscribe:!0})],V.prototype,`context`,void 0),t([x({attribute:!1})],V.prototype,`routeData`,void 0),customElements.get(`openclaw-dashboards-page`)||customElements.define(`openclaw-dashboards-page`,V)})))()}H(); //# sourceMappingURL=dashboards-page-BIioM_7T.js.map