openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
4 lines • 2.68 kB
JavaScript
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{Ac as t,Cu as n,Eu as r,Tu as i,ju as a,kc as o}from"./control-ui-core-BncvAZjR.js";import{p as s}from"./control-ui-core-9qYjK5B2.js";import{$ as c,Y as l,ct as u,nt as d,ut as f}from"./lit-runtime-B8uOr6OX.js";import{Fo as p,Io as m}from"./control-ui-boot-shared-DJkUdZmL.js";import{ii as h}from"./ui-DuRgK6kL.js";import{Ci as g,Md as _,Nd as v,O as y,Si as b,T as x}from"./control-ui-boot-shared-D3oo_6Fq.js";import{a as S,o as C}from"./control-ui-boot-new-CxgnwT6A.js";var w;function T(){return(T=e((()=>{l(),d(),r(),p(),i(),t(),S(),g(),x(),v(),m(),w=class extends n{constructor(...e){super(...e),this.sessionKey=``,this.image=null,this.subscriptions=new o(this).watch(()=>this.context?.gateway,(e,t)=>e.subscribe(()=>{this.closeImage(),t()})).watch(()=>this.context?.chatSubmissions,(e,t)=>e.subscribeCreate(()=>{this.closeImage(),t()})).watchStore(()=>this.context?.placementStartup),this.closeImage=()=>{this.image?.release?.(),this.image=null}}disconnectedCallback(){this.closeImage(),this.subscriptions.clear(),super.disconnectedCallback()}render(){let e=this.context.gateway.snapshot,t=e.selfUser?.identity,n=s(this.context,this.sessionKey),r=n?.phase===`failed`,i=n?.phase===`cancelled`,o=n?.action===`check-delivery`,l=!r&&!i,u=n?.initialTurn,d=r&&n?n.discardAndReload?{label:a(`newSession.discardUnsavedAndReload`),onClick:n.discardAndReload}:n.retryable?{label:a(o?`chat.queue.checkDelivery`:`common.retry`),onClick:()=>this.context.placementStartup.retry(n.sessionKey)}:void 0:void 0,f=u?_({text:u.text,mentions:u.mentions,attachments:u.attachments,createdAt:u.createdAt},`available`):this.context.chatSubmissions.readCreateMessage(this.sessionKey);return c`<section class="chat" aria-busy=${String(l)}>
${C({error:r?n.error??a(o?`chat.queue.checkDeliveryHelp`:`newSession.createFailed`):null,errorAction:d?{...d,disabled:e.phase!==`connected`||!e.client?.recoveryScopeReady}:void 0,pendingMessage:f,userId:t?.type===`profile`?t.id:null,submitting:l,statusLabel:e.phase===`connected`?b(null,n):a(`connection.reconnecting`),completion:i?{label:n.error??a(`newSession.placementCancelled`)}:r?{label:a(o?`chat.queue.deliveryUnconfirmed`:`chat.queue.notSent`)}:void 0,renderDraft:()=>c`<div role="status">${a(`connection.reconnecting`)}</div>`,onOpenImage:e=>{this.closeImage(),this.image=e}})}
</section>
${y(this.image,this.closeImage)}`}},h([f({attribute:!1})],w.prototype,`context`,void 0),h([f()],w.prototype,`sessionKey`,void 0),h([u()],w.prototype,`image`,void 0),customElements.get(`openclaw-pending-session-create`)||customElements.define(`openclaw-pending-session-create`,w)})))()}T();