openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 13.2 kB
JavaScript
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Wo as n}from"./_4____________________________.js";import{GN as r,JN as i,Jw as a,Yw as o,by as s,eP as c,ec as l,fN as u,nc as d,pN as f,tP as p,vy as m}from"./_2_____________________________.js";import{B as h,C as g,O as _,U as v,c as y,d as b,f as x,g as S,gt as C,j as w,l as T,m as E,s as D,u as O,x as k}from"./_6____________________.js";import{n as A,t as ee}from"./_1____________________________________.js";import{Br as j,zr as te}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{a as ne,i as re,n as M,r as N,s as P,t as F}from"./spring-BQEBN5rD.js";import{n as I,t as ie}from"./chat-mobile-host-release-CSyfmXSl.js";function ae(e,t,r){let i=document.createElement(`div`);i.className=`chat-mobile-host__scroll-fades`,i.setAttribute(`aria-hidden`,`true`),t.append(i);let a=new Map,o=0,s=()=>!t.hidden&&r?.isPresented()!==!1,c=e=>{let n=e;for(;n&&n!==t.parentElement;){let e=getComputedStyle(n).backgroundColor;if(e!==`rgba(0, 0, 0, 0)`&&e!==`transparent`)return e;n=n.parentElement}return getComputedStyle(t).backgroundColor},l=e=>{let t=a.get(e);t&&(f.unobserve(e),t.top.remove(),t.bottom.remove(),a.delete(e))},u=()=>{if(o=0,!s())return;let n=[...e].filter(e=>e.isConnected&&t.contains(e)).toSorted((e,t)=>e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);for(let e of a.keys())n.includes(e)||l(e);let r=t.getBoundingClientRect(),u=i.firstChild;for(let e of n){let t=a.get(e);if(!t){let n=document.createElement(`div`),r=document.createElement(`div`);n.className=`chat-mobile-host__scroll-edge chat-mobile-host__scroll-edge--top`,r.className=`chat-mobile-host__scroll-edge chat-mobile-host__scroll-edge--bottom`,t={top:n,bottom:r},a.set(e,t),f.observe(e)}for(let e of[t.top,t.bottom])e===u?u=u.nextSibling:i.insertBefore(e,u);let n=e.clientHeight>0&&e.scrollHeight>e.clientHeight+1,o=getComputedStyle(e),s=n&&/auto|scroll/.test(o.overflowY);if(t.top.hidden=!s||e.scrollTop<=1,t.bottom.hidden=!s||e.scrollTop+e.clientHeight>=e.scrollHeight-1,!s)continue;let l=e.getBoundingClientRect(),d=c(e),p=l.left-r.left+e.clientLeft,m=l.top-r.top+e.clientTop;for(let n of[t.top,t.bottom])n.style.left=String(p)+`px`,n.style.width=String(e.clientWidth)+`px`,n.style.setProperty(`--mobile-fade-surface`,d);t.top.style.top=String(m)+`px`,t.bottom.style.top=String(m+e.clientHeight-10)+`px`}},d=()=>{s()?o||=requestAnimationFrame(u):(cancelAnimationFrame(o),o=0)},f=new ResizeObserver(d),p=new MutationObserver(e=>{e.some(e=>!i.contains(e.target)&&e.target!==i)&&d()});p.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`hidden`]});let m=n(t,`scroll`,d,{capture:!0,passive:!0}),h=n(t,`load`,d,!0),g=r?n(r.owner,te,d):void 0;return f.observe(t),{schedule:d,remove:l,dispose(){cancelAnimationFrame(o),p.disconnect(),f.disconnect(),m(),h(),g?.(),i.remove()}}}function L(){return(L=e((()=>{j()})))()}function R(e,t,n){return Math.min(n,e*.85,e-Math.max(24,t))}function oe(e){let t,n=!1,r=()=>!(!e.view.mobileHost?.open||e.view.mobileHost.suspended);return w(_,{get when(){return e.view.mobileHost},get children(){var i=B();return i._$$click=t=>{t.preventDefault(),t.stopPropagation(),n&&e.view.mobileHost?.close(),n=!1},i.addEventListener(`pointerleave`,()=>{t=void 0,n=!1}),i.addEventListener(`pointercancel`,()=>{t=void 0,n=!1}),i._$$pointerup=e=>{n=t===e.pointerId,t=void 0},i._$$pointerdown=e=>{t=e.pointerId,n=!1},T(()=>!r()||e.view.mobileHost?.mode!==`expanded`&&e.view.mobileHost?.destination.page?.presentation!==`sheet`,e=>{S(i,`hidden`,e)}),i}})}function se(e){let t=()=>!!e.view.mobileHost?.destination.page,r=()=>e.view.mobileHost?.destination.page?.expandable!==!1,a=()=>r()||e.view.mobileHost?.destination.page?.resizable===!0,o=()=>e.view.mobileHost?.toggleExpanded(e.readShell().getBoundingClientRect().height),s,c=0,l=0,d=!1,f=e=>{let t=e.current>e.maximum?Math.min(e.bounds,e.maximum+P(e.current-e.maximum,e.bounds)):Math.max(e.minimum,e.current),n=Math.max(0,e.minimum-e.current);return{height:t,offset:n,visible:Math.max(0,t-n)}},p=()=>{if(c=0,!s)return;let{height:t,offset:n}=f(s);e.readShell().style.setProperty(`--mobile-live-height`,`${t}px`),e.readShell().style.setProperty(`--mobile-live-translate`,n>0?`0 ${n}px`:`none`),e.readRegion().style.setProperty(`--mobile-live-reserved`,`${s.independent?0:Math.max(0,Math.min(t,s.dock)-n)}px`)},m=(t=!1)=>{cancelAnimationFrame(c),c=0,delete e.readRegion().dataset.mobileDragging,e.readRegion().style.removeProperty(`--mobile-live-reserved`),e.readShell().style.removeProperty(`--mobile-live-translate`),t||e.readShell().style.removeProperty(`--mobile-live-height`)},h=()=>{clearTimeout(l),l=0,e.readRegion().style.removeProperty(`--motion-sheet`),e.readRegion().style.removeProperty(`--motion-sheet-duration`)},g=t=>{h();let{easing:n,durationMs:r}=N(F,Math.max(-20,Math.min(20,t)));e.readRegion().style.setProperty(`--motion-sheet`,`${r}ms ${n}`),e.readRegion().style.setProperty(`--motion-sheet-duration`,`${r}ms`),l=window.setTimeout(()=>{h(),s||e.readShell().style.removeProperty(`--mobile-live-height`)},r+50)},v=t=>{if(t.button!==0||!a())return;h(),d=!1;let n=e.readRegion().getBoundingClientRect(),r=window.visualViewport,i=152+(e.readRegionView()?.readMobileChromeHeight?.()??0),o=Number.parseFloat(getComputedStyle(e.readRegion()).getPropertyValue(`--mobile-safe-top`))||0,c=Math.max(i,Math.min(n.height,r?r.height+r.offsetTop-n.top:n.height)-o),l=e.readShell().getBoundingClientRect().height,u=re();u.add(t.timeStamp,-t.clientY),s={pointer:t.pointerId,y:t.clientY,height:l,current:l,minimum:i,maximum:c,safeTop:o,bounds:n.height,independent:e.view.mobileHost?.destination.page?.presentation===`sheet`,dock:Math.max(i,Math.min(n.height*.52,n.height-200)),expanded:R(n.height,o,c),moved:!1,velocity:u},t.currentTarget instanceof HTMLElement&&t.currentTarget.setPointerCapture(t.pointerId)},D=t=>{if(!s||s.pointer!==t.pointerId||!a())return;s.velocity.add(t.timeStamp,-t.clientY);let n=s.y-t.clientY;!s.moved&&Math.abs(n)<4||(s.moved=!0,d=!0,e.readRegion().dataset.mobileDragging=`true`,s.current=Math.max(0,s.height+n),c||=requestAnimationFrame(p))},O=t=>{let n=s;if(s=void 0,!n?.moved||!e.readRegion().hasAttribute(`data-mobile-dragging`))return;cancelAnimationFrame(c),c=0,delete e.readRegion().dataset.mobileDragging;let r=n.velocity.velocity(t.timeStamp),i=I({height:n.current,start:n.height,minimum:n.minimum,maximum:n.maximum,dock:n.dock,expanded:n.expanded,independent:n.independent},r),a=f(n).visible;if(i.kind===`close`){g(a>0?-r/a:0),e.view.mobileHost?.close(),C(()=>m(!0));return}let o=i.height-a;g(Math.abs(o)>1?r/o:0),e.view.mobileHost?.resize(i.height,i.mode,i.mode===`expanded`?n.dock:0),C(()=>m())},k=()=>{m(),s=void 0};C(()=>{let t=window.visualViewport?n(window.visualViewport,`resize`,()=>{if(!s?.moved)return;let t=e.readRegion().getBoundingClientRect(),n=window.visualViewport;s.maximum=Math.max(s.minimum,Math.min(t.height,n?n.height+n.offsetTop-t.top:t.height)-s.safeTop),s.bounds=t.height,s.dock=Math.max(s.minimum,Math.min(t.height*.52,t.height-200)),s.expanded=R(t.height,s.safeTop,s.maximum),c||=requestAnimationFrame(p)}):void 0;return()=>{t?.(),s=void 0,h(),m()}}),C(()=>{let t=new Set,r=n=>{e.view.mobileHost&&n.target instanceof HTMLElement&&!n.target.hasAttribute(`data-mobile-scrolling`)&&(n.target.setAttribute(`data-mobile-scrolling`,``),t.add(n.target))},i=e=>{e.target instanceof HTMLElement&&(e.target.removeAttribute(`data-mobile-scrolling`),t.delete(e.target))},a=n(e.readShell(),`scroll`,r,{capture:!0,passive:!0}),o=n(e.readShell(),`scrollend`,i,{capture:!0,passive:!0});return()=>{a(),o();for(let e of t)e.removeAttribute(`data-mobile-scrolling`);t.clear()}});let A=()=>{C(()=>{let t=e.readShell(),n=e.view.visualPresentation;return e.view.mobileScrollFades?.connect(e=>ae(e,t,n))})};return w(_,{get when(){return e.view.mobileHost},get children(){return[w(A,{}),w(_,{get when(){return a()},get children(){var t=V();return t._$$click=e=>{r()&&(e.detail===0||!d)&&o(),d=!1,s=void 0},t.addEventListener(`pointercancel`,k),t.addEventListener(`lostpointercapture`,O),t._$$pointerup=O,t._$$pointermove=D,t._$$pointerdown=v,T(()=>r()?e.view.mobileHost?.mode===`expanded`?i(`common.restore`):i(`chat.sidePanel.expandPanel`,{panel:i(`chat.sidePanel.label`)}):i(`board.widget.resizeHandle`,{title:e.view.mobileHost?.destination.page?.title??``}),e=>{S(t,`aria-label`,e)}),t}}),(()=>{var n=U(),a=n.firstChild,s=a.nextSibling,c=s.nextSibling,l=c.nextSibling,d=l.nextSibling;return n.addEventListener(`pointercancel`,k),n.addEventListener(`lostpointercapture`,O),n._$$pointerup=O,n._$$pointermove=D,n._$$pointerdown=e=>{e.target instanceof Element&&!e.target.closest(J)&&v(e)},a._$$click=()=>t()&&e.view.mobileHost?.destination.backTo?e.view.mobileHost.back():e.view.mobileHost?.close(),b(a,w(u,{get name(){return t()&&e.view.mobileHost?.destination.backTo?`chevronLeft`:`x`}})),b(n,w(_,{get when(){return x(()=>!!t())()?e.view.mobileHost?.destination.page:void 0},get fallback(){var t=W(),n=t.firstChild,r=n.nextSibling;return n._$$click=()=>e.view.mobileHost?.navigate({area:`details`}),b(n,()=>i(`chat.sessionDetails.title`)),r._$$click=()=>e.view.mobileHost?.navigate({area:`panels`}),b(r,()=>i(`chat.sessionHeader.panels`)),T(()=>({e:e.view.mobileHost?.destination.area===`details`?`true`:`false`,t:e.view.mobileHost?.destination.area===`panels`?`true`:`false`}),({e,t},i)=>{e!==i?.e&&S(n,`aria-pressed`,e),t!==i?.t&&S(r,`aria-pressed`,t)}),t},children:e=>{let t=y(()=>e().heading??(()=>e().title));return w(_,{get when(){return e().details?.kind===`pull-request`},get fallback(){var n=K(),r=ee(()=>e().title);return(typeof r==`function`||Array.isArray(r))&&E(()=>r,n),b(n,w(t,{})),T(()=>e().details?.kind,e=>{S(n,`data-details-route`,e)}),n},get children(){var n=G();return b(n,w(t,{})),T(()=>e().title,e=>{S(n,`title`,e)}),n}})}}),s),b(n,()=>e.view.mobileHost?.destination.page?.headerActions,c),b(n,w(_,{get when(){return r()},get children(){var t=H();return t._$$click=o,b(t,w(u,{get name(){return e.view.mobileHost?.mode===`expanded`?`sessionPanelRestore`:`sessionPanelExpand`}})),T(()=>e.view.mobileHost?.mode===`expanded`?i(`common.restore`):i(`chat.sidePanel.expandPanel`,{panel:i(`chat.sidePanel.label`)}),e=>{S(t,`aria-label`,e)}),t}}),l),b(n,w(_,{get when(){return x(()=>!!t())()?e.view.mobileHost?.destination.backTo:t()},get children(){var t=H();return t._$$click=()=>e.view.mobileHost?.close(),b(t,w(u,{name:`x`})),T(()=>i(`common.close`),e=>{S(t,`aria-label`,e)}),t}}),d),T(()=>t()&&e.view.mobileHost?.destination.backTo?i(`common.back`):i(`common.close`),e=>{S(a,`aria-label`,e)}),n})()]}})}function z(e){let t=()=>!!e.view.mobileHost?.destination.page,n=()=>!(!e.view.mobileHost?.open&&!e.view.mobileHost?.exiting||e.view.mobileHost.suspended);return w(_,{get when(){return x(()=>!(!t()||e.view.mobileHost?.destination.page?.details))()?e.view.mobileHost?.destination.page:void 0},children:t=>{let r=y(()=>t().render??(()=>t().content)),[i,o]=h();return m(()=>({restore:{identity:[t().key,i()],target:i(),top:0}})),w(a,{value:n,get children(){var n=q();return E(()=>[o,c(e.view.mobileScrollFades?.register)],n),b(n,w(r,{})),T(()=>t().key,e=>{S(n,`data-mobile-page`,e)}),n}})}})}var B,V,H,U,W,G,K,q,J;function Y(){return(Y=e((()=>{O(),v(),f(),A(),ne(),M(),p(),r(),s(),o(),ie(),L(),B=k(`<div class=chat-mobile-host__backdrop aria-hidden=true>`),V=k(`<button class=chat-mobile-host__grabber type=button><span>`),H=k(`<button type=button class=chat-mobile-host__circle>`),U=k(`<header class=chat-mobile-host__header><button type=button class=chat-mobile-host__circle></button><!><!><!><!>`),W=k(`<div class=chat-mobile-host__segments><button type=button></button><button type=button>`),G=k(`<div class=chat-mobile-host__title data-details-route=pull-request>`),K=k(`<div class=chat-mobile-host__title>`),q=k(`<div class=chat-mobile-host__page>`),J=`button, a, input, select, textarea, [role='button'], [contenteditable]`,D([`pointerdown`,`pointerup`,`click`,`pointermove`])})))()}var ce=t({ChatMobilePeopleGrid:()=>le});function le(e){let t=()=>e.people.header.length,n=()=>e.people.header.slice(0,t()>4?3:4);return w(_,{get when(){return t()>0},get children(){var r=Z(),i=r.firstChild,a=i.firstChild,o=a.nextSibling;r._$$click=t=>e.onOpen(t.currentTarget);var s=e.ref;return typeof s==`function`||Array.isArray(s)?E(()=>s,r):e.ref=r,b(i,w(g,{get each(){return n()},children:e=>(()=>{var t=Q();return b(t,w(l,{get sender(){return e.sender},hideTooltip:!0})),t})()}),a),b(i,w(_,{get when(){return t()>4},get children(){var n=X();return n.firstChild,b(n,()=>t()-3,null),T(()=>e.morePeople(t()-3),e=>{S(n,`aria-label`,e)}),n}}),o),T(()=>({e:e.label,t:e.expanded?`true`:`false`,a:e.controls,o:Math.min(t(),4)}),({e,t,a:n,o:a},o)=>{e!==o?.e&&S(r,`aria-label`,e),t!==o?.t&&S(r,`aria-expanded`,t),n!==o?.a&&S(r,`aria-controls`,n),a!==o?.o&&S(i,`data-count`,a)}),r}})}var X,Z,Q;function $(){return($=e((()=>{O(),v(),d(),X=k(`<span class=chat-mobile-people-grid__more>+`),Z=k(`<button type=button class=chat-mobile-people-grid aria-haspopup=dialog><span class=chat-mobile-people-grid__canvas><!><!>`),Q=k(`<span class=chat-mobile-people-grid__avatar>`),D([`click`])})))()}export{z as a,se as i,$ as n,Y as o,oe as r,ce as t};