UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.69 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{lo as t,wa as n,xa as r}from"./control-ui-connection-Bfj9beF_.js";import{bD as i,vD as a}from"./control-ui-boot-shared-DFTSUQQ0.js";import{Ot as o,kt as s,nt as c,rt as l}from"./markdown-runtime-DmM7zNej.js";function u(e,r){e.replaceChildren();let a=n(`chat.workspaceFiles.copyPath`),s=e.closest(`openclaw-tooltip`);if(!s)throw Error(`File path content requires a tooltip owner`);let l=0,u=!1,d=e.ownerDocument,f=d.createElement(`span`);f.className=`markdown-file-tooltip__path`,f.textContent=r;let p=d.createElement(`button`);p.type=`button`,p.setAttribute(`aria-label`,a);let m=c(`copy`,d);p.append(m);let h=d.createElement(`span`);h.setAttribute(`role`,`status`);let g=t=>{t===!1&&!e.closest(`openclaw-tooltip[open]`)&&i({message:n(`common.copyFailed`)}),m.replaceChildren(...c(t?`check`:`copy`,d).childNodes),h.className=t===!1?``:`sr-only`,h.textContent=t===void 0?``:n(t?`common.copied`:`common.copyFailed`)},_=t(p,`click`,()=>{let t=l,n=!1;o(p,r,()=>e.isConnected&&t===l&&s.anchor?.getAttribute(`data-file-path`)===r,e=>{u=!1;let t=s.anchor;e!==void 0&&n&&t instanceof HTMLElement&&s.ownerDocument.activeElement===s.ownerDocument.body&&s.focusTriggerWithoutOpening(t),(e===void 0||n||s.hasAttribute(`open`))&&g(e)},()=>(n=s.hasAttribute(`open`),u=n,n))});e.append(f,p,h),g();let v=new MutationObserver(e=>{e.some((t,n)=>{let r=e[n+1],i=r?r.oldValue:s.getAttribute(`open`);return t.oldValue!==null&&i===null})&&!u&&(l++,g())});return v.observe(s,{attributes:!0,attributeFilter:[`open`],attributeOldValue:!0}),()=>{_(),v.disconnect()}}function d(){return(d=e((()=>{r(),a(),s(),l()})))()}d();export{u as renderMarkdownFileTooltip};