UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.4 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{An as i,BA as a,Dn as o,On as s,Qj as c,Xj as l,Zj as u,kn as d,zA as f}from"./control-ui-boot-shared-DFTSUQQ0.js";import{d as p,g as m,h,j as g,l as _,m as v,n as y,r as b,s as x,u as S,x as C}from"./solid-runtime-C416s-HC.js";import{$i as w,Qi as T,Xi as E,Zi as D,ea as O}from"./control-ui-boot-chat-DewxEbIm.js";function k(e){if(e.readSignal?.aborted)return;O();let r,a,s,u,x,S,C=()=>{O(),e.onCancel?.()},E=()=>{(e.readSignal?.aborted||e.onSave(a.value)!==!1)&&O()},k=()=>{let t=a.scrollTop;a.style.height=`auto`,a.style.height=`${a.scrollHeight}px`,a.scrollTop=t,w(r,e.anchorElement?.getBoundingClientRect()??e.anchorRect)},j=e=>{if(e.target===a&&!d(e)&&(c(l.sendMessage,e)||c(l.modifiedEnter,e))&&(e.preventDefault(),E()),e.key===`Tab`){let t=[a,s,u,x,S].filter(e=>e.getClientRects().length>0),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}},M=h(()=>g(y,{get mount(){return document.body},get children(){var t=A(),c=t.firstChild,l=c.nextSibling,d=l.nextSibling.firstChild,h=d.nextSibling,y=h.nextSibling;return t._$$keydown=j,v(()=>e=>{r=e},t),b(c,`blur`,o),b(c,`keyup`,o,!0),b(c,`compositionend`,i),c._$$input=k,v(()=>e=>{a=e},c),l._$$click=E,v(()=>e=>{s=e},l),p(l,g(f,{name:`cornerDownLeft`})),d._$$click=()=>{O(),e.readSignal?.aborted||(e.onDelete??e.onCancel)?.()},v(()=>e=>{u=e},d),p(d,g(f,{name:`trash`})),h._$$click=C,v(()=>e=>{x=e},h),p(h,()=>n(`common.cancel`)),y._$$click=E,v(()=>e=>{S=e},y),p(y,()=>n(`common.save`)),_(()=>({e:!!e.expanded,t:n(`chat.messages.annotationEditor`),a:e.comment,o:n(`chat.messages.annotationComment`),i:n(`chat.messages.annotationComment`),n:n(`chat.messages.saveAnnotation`),s:n(`chat.messages.deleteAnnotation`),h:n(`chat.messages.deleteAnnotation`),r:n(`common.cancel`),d:n(`common.save`)}),({e,t:n,a:r,o:i,i:a,n:o,s,h:u,r:f,d:p},g)=>{e!==g?.e&&t.classList.toggle(`chat-annotation-editor--expanded`,e),n!==g?.t&&m(t,`aria-label`,n),c.value=r??``,i!==g?.o&&m(c,`placeholder`,i),a!==g?.i&&m(c,`aria-label`,a),o!==g?.n&&m(l,`aria-label`,o),s!==g?.s&&m(d,`aria-label`,s),u!==g?.h&&m(d,`title`,u),f!==g?.r&&m(h,`aria-label`,f),p!==g?.d&&m(y,`aria-label`,p)}),t}}),document.createElement(`div`)),N=e.comment,P=T(r,k,e.paneId,M,e.onCancel,()=>a.value===N);e.sourceRange&&typeof Highlight<`u`&&(CSS.highlights.set(`openclaw-comment`,new Highlight(e.sourceRange)),t(P,`abort`,()=>CSS.highlights.delete(`openclaw-comment`),{once:!0}));let F=()=>O();if(e.readSignal){let n=t(e.readSignal,`abort`,F,{once:!0});t(P,`abort`,n,{once:!0})}return a.focus({preventScroll:!0}),a.setSelectionRange(a.value.length,a.value.length),()=>{D(r)&&w(r,e.anchorElement?.getBoundingClientRect()??e.anchorRect)}}var A;function j(){return(j=e((()=>{S(),a(),r(),s(),u(),E(),A=C(`<div class=chat-annotation-editor role=dialog><textarea rows=1></textarea><button type=button class="btn primary chat-annotation-editor__confirm"></button><div class=chat-annotation-editor__controls><button type=button class="btn btn--icon btn--ghost chat-annotation-editor__delete"></button><button type=button class=btn></button><button type=button class="btn primary">`),x([`keydown`,`input`,`keyup`,`click`])})))()}j();export{k as showChatAnnotationEditor};