openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 2.39 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{sr as t}from"./_4____________________________.js";import{Aw as n,Cw as r,GN as i,WN as a,jw as o,ww as s}from"./_2_____________________________.js";import{B as c,F as l,O as u,U as d,gt as f,j as p,u as m}from"./_6____________________.js";import{Fn as h,In as g}from"./control-ui-boot-chat-styles-DMRbEm40.js";import{K as _,c as v,h as y}from"./markdown-runtime-CtlJb8xA.js";import{c as b,i as x}from"./session-progress-card-CSIgcskI.js";function S(e){let t=l(()=>{a();let t=e.markdown?y(e.markdown,{progressBars:!0,...e.previewLines?{codeBlockChrome:`none`}:{}}):``;return e.omitProgress?b(t):t}),n=document.createElement(`div`);n.className=`session-progress-card__markdown sidebar-markdown`;let[i,s]=c(0),d=r(()=>e.previewLines,()=>()=>s(e=>e+1),{targets:e=>e?[n]:[],changeTiming:`sync`});return h(()=>{i();let r=e.previewLines;return{content:t(),prepareContent:r?e=>n.clientWidth?C(_(e),n,r):``:void 0}})(n),f(()=>e.previewLines?o(document.fonts,d):void 0),f(()=>e.registerControls?.(()=>Array.from(n.querySelectorAll(`a[href], button, summary, [tabindex]`)))),p(u,{get when(){return e.markdown},children:n})}function C(e,n,r){let i=document.createElement(`template`);i.innerHTML=e;let a=document.createElement(`div`);a.className=n.className,a.inert=!0,Object.assign(a.style,{position:`absolute`,visibility:`hidden`,width:`${n.getBoundingClientRect().width}px`}),n.after(a);try{let o=Number.parseFloat(getComputedStyle(n).lineHeight)*r,s=()=>a.getBoundingClientRect().height<=o&&[a,...a.getElementsByTagName(`*`)].every(e=>e.scrollWidth<=e.clientWidth&&e.scrollHeight<=e.clientHeight);if(a.append(i.content.cloneNode(!0)),s())return e;let c=[],l=document.createTreeWalker(i.content,NodeFilter.SHOW_TEXT);for(let e=l.nextNode();e;e=l.nextNode())e instanceof Text&&c.push(e);let u=document.createRange();u.setStart(i.content,0);let d=e=>{u.setEnd(i.content,0);let n=e;if(n>0)for(let e of c){if(n<=e.length){u.setEnd(e,t(e.data,n).length);break}n-=e.length}let r=u.cloneContents(),o=r;for(;o.lastChild;)o=o.lastChild;o instanceof Text?o.data=`${o.data.trimEnd()}…`:r.append(`…`),a.replaceChildren(r)},f=0,p=c.reduce((e,t)=>e+t.length,0);for(;f<p;){let e=Math.ceil((f+p)/2);d(e),s()?f=e:p=e-1}return d(f),a.innerHTML}finally{a.remove()}}function w(){return(w=e((()=>{m(),d(),n(),i(),s(),g(),v(),x()})))()}export{w as n,S as t};