openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 4.43 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Cr as t,Er as n}from"./_4____________________________.js";import{GN as r,JN as i,Jv as a,fN as o,pN as s,qv as c}from"./_2_____________________________.js";import{F as l,J as u,O as d,U as f,d as p,gt as m,j as h,u as g,x as _,y as v}from"./_6____________________.js";import{F as y,L as b,R as x,an as S,en as C,in as w,rn as T,sn as E,tn as D}from"./control-ui-boot-chat-CqvkfPXD.js";import{a as O,c as k,i as A,n as j,o as M,r as N}from"./board-widget-menu-Rj-2CMou.js";import{n as P,t as F}from"./chat-quick-action-A9CqJQrK.js";function I(e){let r=u(()=>e.menuProps),a=l(()=>{let e=r.sidebarLayout,a=[];if(!r.mobile&&e&&r.onLayoutChange){let o=n(e),s=e.columns.flatMap(e=>e.panels).find(e=>e.slot===`dashboard`);s&&e.open&&!e.expanded&&a.push({id:`dashboard-swap`,label:i(`chat.sidePanel.swap`,{main:i(`chat.sidePanel.conversation`),side:i(`chat.sidePanel.dashboard`)}),icon:`arrowLeftRight`,onActivate:()=>{let t=C(e),n=o?.slot===`dashboard`?t.columns.flatMap(e=>e.panels).find(e=>e.slot===`conversation`):s;n&&r.onLayoutChange?.(T(w(t,n.id),o?.slot===`dashboard`?`dashboard`:`conversation`),{dashboardPresentation:`personal`})}}),s&&a.push({id:`dashboard-expand`,label:i(e.expanded?`chat.sidePanel.restore`:`chat.sidePanel.expandPanel`,{panel:i(`chat.sidePanel.dashboard`)}),icon:e.expanded?`minimize`:`maximize`,onActivate:()=>r.onLayoutChange?.(o?.slot===`dashboard`||e.expanded?S(e,!e.expanded):E(e,s.id),{dashboardPresentation:`personal`})}),t(e,`conversation`)||a.push({id:`dashboard-show-chat`,label:i(`chat.sidePanel.showChat`),icon:`messageSquare`,onActivate:()=>r.onLayoutChange?.(T(C(e),`conversation`),{dashboardPresentation:`personal`})})}for(let e of r.layoutMenuActions??[])e.id===`dashboard-default`&&a.push({...e,icon:`bookmark`});return a}),s=P(a),f=l(()=>s().flatMap(e=>e.id===`dashboard-default`?[{kind:`content`,id:`default-separator`,content:R()},e.kind===`content`?{id:`${e.id}-status`,label:a().find(t=>t.id===e.id).label,disabled:!0,render:t=>(()=>{var n=z(),r=n.firstChild,i=r.nextSibling;return v(n,[t,{class:`chat-dashboard-menu__default-status`}],!0),p(n,()=>e.content,r),p(n,h(o,{name:`check`}),i),n})()}:e]:[e])),g=l(()=>{let e=r.widgetMenu;if(!e?.canMutate)return[];let t=j({...e,disabled:!1}),n=t.filter(e=>e.id.startsWith(`move:`)),a=Object.entries(A).find(([,t])=>t.w===e.widget.sizeW&&t.h===e.widget.sizeH)?.[0];for(let e of t)e.kind!==`content`&&e.kind!==`group`&&(e.id.startsWith(`resize:`)?e.class=[`board-widget__preset`,{"is-current":e.id===`resize:${a}`}]:e.id===`height:auto`&&(e.icon=h(o,{name:`arrowUpDown`})));return[{kind:`content`,id:`page-separator`,content:R()},{kind:`content`,id:`resize-heading`,content:h(c,{get label(){return i(`chat.sidePanel.dashboardSize`)}})},{kind:`group`,id:`page-sizes`,class:`chat-dashboard-menu__sizes`,items:t.filter(e=>e.id.startsWith(`resize:`))},...t.filter(e=>e.id===`height:auto`),...n.length?[{id:`page-move`,label:i(`board.widget.moveToTab`),icon:h(o,{name:`panelsTopLeft`}),children:n}]:[],...t.filter(e=>e.id===`separator`||e.id===`remove`)]}),_=l(()=>[...f(),...g(),{kind:`content`,id:`page-granted-capabilities`,content:h(d,{get when(){return r.widgetMenu},children:e=>h(M,{get widget(){return e().widget},presentation:`details`})})}]);return m(()=>(e.onReady({items:_,select:(t,n)=>{n.preventDefault(),e.readMenu()?.close();let i=a().find(e=>e.id===t.id);i?i.kind!==`status`&&!i.disabled&&i.onActivate():r.widgetMenu?.onSelect(t.id)}}),()=>e.onReady(void 0))),null}function L(e){let t=u(()=>e.menuProps),n=e.controls,r=l(()=>b(t)),i=l(()=>h(y,{get model(){return r()},controls:n}),{lazy:!0}),a=P(()=>t.mobile?r().panelActions:r().actions,!0),o=P(()=>t.mobile?r().actions:r().panelActions,!0),s=l(()=>[...a(),...a().length&&o().length?[{kind:`content`,id:`panel-actions`,content:B()}]:[],...o(),{kind:`content`,id:`header-actions`,content:i()}],{lazy:!0});return m(()=>(e.onReady({items:s,select:(t,n)=>{let i=r().allActions.find(e=>e.id===t.id);i&&i.kind!==`status`&&!i.disabled&&(n.preventDefault(),e.readMenu()?.close(),i.onActivate())}}),()=>e.onReady(void 0))),null}var R,z,B;function V(){return(V=e((()=>{g(),f(),k(),O(),N(),s(),a(),r(),D(),x(),F(),R=_(`<div class=board-widget__menu-separator role=separator>`),z=_(`<div><!><!>`),B=_(`<div class=session-menu__separator role=separator>`)})))()}V();export{I as ChatDashboardMenuContent,L as ChatPaneLayoutMenuContent};