openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 3.91 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Gr as t,Hr as n,ei as r,ii as i,ni as a}from"./_4____________________________.js";import{GN as o,JN as s,ch as c,fN as l,ih as u,pN as d,rh as f,sh as p}from"./_2_____________________________.js";import{Ni as m,Pi as h}from"./deferred-ui-support-DZEPWjAk.js";import{C as g,F as _,O as v,Rt as y,U as b,d as x,g as S,j as C,l as w,r as T,s as E,u as D,x as O}from"./_6____________________.js";function k(e){let t=_(()=>e.host.reconciledSidebarZone()),o=()=>e.host.navigationCatalog.dashboards,c=_(()=>e.host.sidebarSnapshot?e.host.sidebarSnapshot.pages.filter(e=>!e.archived).map(t=>u(t,e.host.getRouteSessionKey())):(o()?.result?.sessions??[]).map(t=>e.host.getSessionNavigationState().toSidebarSession(t))),d=_(()=>{let e=new Map(t().sessionRows);for(let t of c())e.set(t.key,t);return e}),f=_(()=>{let r=n.filter(t=>e.host.sidebarMenus.isRouteEnabled(t)).toSorted((e,t)=>i(e,s).localeCompare(i(t,s))).map(e=>a({type:`route`,route:e}));for(let n of new Set([...t().pluginTabs.keys(),...e.host.pluginNavigation().map(e=>e.key)]))r.push(a({type:`plugin`,key:n}));for(let e of c())r.push(a({type:`session`,key:e.key}));return r});var p=M(),h=p.firstChild,y=h.nextSibling,b=y.nextSibling,T=b.nextSibling;return p.addEventListener(`drop`,t=>e.host.sessionOrganizer.handleSessionListDrop(t)),p.addEventListener(`dragover`,t=>e.host.sessionOrganizer.handleSessionListDragOver(t)),x(p,C(m,{surface:`sidebar`}),h),x(p,C(g,{get each(){return f()},children:n=>{let i=A(e.host,r(n),d,()=>t().pluginTabs);var a=N(),o=a.firstChild;return x(a,i,o),o._$$click=()=>{e.host.sidebarEntries.includes(n)?e.host.sessionOrganizer.removeSidebarEntry(n):e.host.sessionOrganizer.writeSidebarEntryAt(n,void 0,void 0)},x(o,C(l,{name:`pin`})),w(()=>({e:!!e.host.sidebarEntries.includes(n),t:!!e.host.sidebarSnapshot,a:s(e.host.sidebarEntries.includes(n)?`nav.unpin`:`nav.pin`)}),({e,t,a:n},r)=>{e!==r?.e&&o.classList.toggle(`sidebar-pages__pin--pinned`,e),t!==r?.t&&S(o,`disabled`,t),n!==r?.a&&S(o,`aria-label`,n)}),a}}),y),x(p,C(v,{get when(){return o()?.error},children:e=>(()=>{var t=P();return x(t,e),t})()}),b),x(p,C(v,{get when(){return o()?.result?.hasMore},get children(){var t=j();return t._$$click=()=>e.host.navigationCatalog.loadMoreDashboards(),x(t,()=>s(`chat.selectors.loadMoreSessions`)),t}}),T),w(()=>s(`nav.pages`),e=>{S(p,`aria-label`,e)}),p}function A(e,t,n,r){if(t.type===`person`)return;let i=a(t),o=()=>t.type===`plugin`?r().get(t.key):void 0,s=()=>t.type===`session`?n().get(t.key):void 0,l=t.type===`route`?e.sidebarMenus.renderRoute(t.route,e):t.type===`plugin`?C(v,{get when(){return o()},get fallback(){var n=F();return n.kind=`navigation`,n.navigationChildren=!1,n._$owner=y(),w(()=>({e:t.key,t:e.sidebarMenus}),({e,t},r)=>{e!==r?.e&&(n.navigationKey=e),t!==r?.t&&(n.navigationMenus=t)}),n},children:t=>c(e,t)}):C(v,{get when(){return s()},children:t=>e.renderPinnedSidebarSession(t)}),u=()=>!e.sidebarSnapshot&&(t.type===`route`||t.type===`plugin`);var d=I();return d.addEventListener(`dragend`,()=>{u()&&e.sessionOrganizer.finishSidebarEntryDrag()}),T(d,`dragstart`,t.type===`route`?n=>e.sessionOrganizer.startSidebarRouteDrag(n,t.route):t.type===`plugin`?n=>e.sessionOrganizer.startSidebarPluginDrag(n,t.key):void 0),S(d,`data-sidebar-entry`,i),x(d,l),w(()=>({e:e.sessionOrganizer.draggingSidebarEntry===i,t:u()?`true`:`false`}),({e,t},n)=>{e!==n?.e&&d.classList.toggle(`sidebar-zone-entry--dragging`,e),t!==n?.t&&S(d,`draggable`,t)}),d}var j,M,N,P,F,I;function L(){return(L=e((()=>{D(),b(),t(),o(),p(),h(),f(),d(),j=O(`<button type=button class="btn btn--sm">`),M=O(`<nav class=sidebar-pages><!><!><!><!>`),N=O(`<div class=sidebar-pages__entry><button type=button class=sidebar-pages__pin>`),P=O(`<span role=alert>`),F=O(`<openclaw-plugin-contributions>`,1),I=O(`<div class=sidebar-zone-entry>`),E([`click`])})))()}L();export{k as SidebarPages};